3 ms·
That should work perfectly with multiple structs. Define #[repr("C")] struct MyThing { length: usize, data: MaybeUninit<MyInner> }
by ATsch 5y ago
That should work perfectly with multiple structs. Define
#[repr("C")]
struct MyThing {
length: usize,
data: MaybeUninit<MyInner>
}
Then initialize with sizeof(data) and MaybeUninit::uninitialized(). When the call is complete, assume_init() and access the fields of the result struct as normal.
- pjmlp 5y agoI see, thanks.