Trait com::AbiTransferable [−][src]
pub unsafe trait AbiTransferable: Sized {
type Abi;
fn get_abi(&self) -> Self::Abi;
fn set_abi(&mut self) -> *mut Self::Abi;
fn from_abi(abi: Self::Abi) -> Self { ... }
unsafe fn slice_from_abi<'a>(
abi: *const Self::Abi,
len: usize
) -> &'a [Self] { ... }
unsafe fn slice_from_mut_abi<'a>(
abi: *mut Self::Abi,
len: usize
) -> &'a mut [Self] { ... }
fn into_abi(self) -> Self::Abi { ... }
}
Expand description
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
Required methods
Provided methods
Convert into a reference to Self from a reference to the ABI
unsafe fn slice_from_abi<'a>(abi: *const Self::Abi, len: usize) -> &'a [Self]
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]
unsafe fn slice_from_mut_abi<'a>(
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.