I have a C library which uses a type which is basically a &str:
#[repr(C)]
struct ConstStr {
ptr: *const u8,
len: usize,
}
This is what rust-bindgen currently generates for me, can I somehow get it to generate this instead? If so how?
#[repr(C)]
struct ConstStr<'a> {
ptr: *const u8,
len: usize,
_phantom: PhantomData<&' a str>,
}
This will prevent me from accidentally keeping a ConstStr passed it's lifetime 🙂