pub trait Boxed: Sized {
    unsafe fn from_raw(ptr: *mut c_void) -> Self;
    fn into_raw(self) -> *mut c_void;
    fn as_raw(&self) -> *const c_void;
    fn as_raw_mut(&mut self) -> *mut c_void;
}

Required Methods

Wrap the specified raw pointer

Safety

Caller must ensure that the passed pointer is pointing to a valid unowned object data

Return an the underlying raw pointer while consuming this wrapper.

This will not free object referenced by this pointer so you can use this pointer indefinitely. Be sure to free it (by e.g. calling from_raw() with the same wrapper type) to avoid leaking memory.

Return the underlying raw pointer.

You can use this pointer as long as the original object lives. Be careful not to double-free it.

Return the underlying mutable raw pointer

You can use this pointer as long as the original object lives. Be careful not to double-free it. Note that ownership is still retained in the original object. Use into_raw() if you want to transfer ownership to another wrapper.

Implementors