mod error; mod foreign; pub use error::Error; pub struct CBox { pub ptr: *mut libc::c_void, phantom: std::marker::PhantomData, } impl CBox { fn new(t: T) -> Self { unsafe { let size = std::mem::size_of::(); let ptr = libc::malloc(size); *(ptr as *mut T) = t; // FIXME: probably UB Self { ptr, phantom: std::marker::PhantomData, } } } }