// Opaque stand-in: the tutorial does not provide the actual Stats fields. #[repr(C)] struct Stats { _opaque: [u8;0] } use std::ffi::c_void; #[repr(C, packed)] struct ByteSlice { data: *const u8, len: i64 } #[repr(C, packed)] struct I32Slice { data: *mut i32, len: i64 } #[repr(C, packed)] struct GooseBuilder { header: *mut c_void, stack: *mut c_void } unsafe extern "C" { #[link_name = "cbrt"] fn cube_root(x: f64) -> f64; fn hypot(x: f64, y: f64) -> f64; fn crc32_bytes(s: ByteSlice) -> u32; fn stats_of(xs: I32Slice, out: *mut Stats); fn c_version(out: GooseBuilder); }