[−][src]Trait ffi_convert::RawPointerConverter
Trait representing the creation of a raw pointer from a struct and the recovery of said pointer.
The from_raw_pointer
function should be used only on pointers obtained thought the
into_raw_pointer
method (and is thus unsafe as we don't have any way to get insurance of that
from the compiler).
The from_raw_pointer
effectively takes back ownership of the pointer. If you didn't create the
pointer yourself, please use the as_ref
method on the raw pointer to borrow it
A generic implementation of this trait exist for every struct, it will use a Box
to create the
pointer. There is also a special implementation available in order to create a
*const libc::c_char
from a CString.
Required methods
fn into_raw_pointer(self) -> *const T
unsafe fn from_raw_pointer(input: *const T) -> Result<Self, Error>
Provided methods
unsafe fn drop_raw_pointer(input: *const T) -> Result<(), Error>
Implementations on Foreign Types
impl RawPointerConverter<c_void> for CString
[src]
fn into_raw_pointer(self) -> *const c_void
[src]
unsafe fn from_raw_pointer(input: *const c_void) -> Result<Self, Error>
[src]
impl RawPointerConverter<i8> for CString
[src]
fn into_raw_pointer(self) -> *const c_char
[src]
unsafe fn from_raw_pointer(input: *const c_char) -> Result<Self, Error>
[src]
Implementors
impl<T> RawPointerConverter<T> for T
[src]
TODO custom derive instead of generic impl, this would prevent CString from having 2 impls... Trait representing conversion operations from and to owned type T to a raw pointer to T