[−][src]Trait com::AbiTransferable
Types that are safe to transfer over a COM API boundary.
Safety
Implementing types only have associated Abi
types that are
safe to transfer over a COM FFI boundary. Implementing types
must also be exactly equivalent to their associated types
in layout and abi such that it is safe to transmute between the
two types.
Associated Types
type Abi
The FFI compatible type the implementing type can turn into.
Required methods
fn get_abi(&self) -> Self::Abi
Turn the type into the FFI ABI type.
fn set_abi(&mut self) -> *mut Self::Abi
Set the abi of the implementing type
Provided methods
fn from_abi(abi: &Self::Abi) -> &Self
Convert into a reference to Self from a reference to the ABI
fn from_mut_abi(abi: &mut Self::Abi) -> &mut Self
The mut verison of from_abi
unsafe fn slice_from_abi<'a>(abi: *const Self::Abi, len: usize) -> &'a [Self]
Convert a pointer to a Self::Abi
and and a length to a slice.
Safety
The abi
pointer must be a valid pointer to an array of Self::Abi
items of
len
size for the lifetime 'a
. Nothing can mutate that array while
the slice exists.
unsafe fn slice_from_mut_abi<'a>(
abi: *mut Self::Abi,
len: usize
) -> &'a mut [Self]
abi: *mut Self::Abi,
len: usize
) -> &'a mut [Self]
Convert a pointer to a Self::Abi
and and a length to a mutable slice.
Safety
The same rules apply as with slice_from_abi
but no other references into
the slice are allowed while the slice exists.
fn into_abi(self) -> Self::Abi
Converts and consumes the ABI transferable type into its ABI representation.