Trait safer_ffi::layout::CType

source ·
pub unsafe trait CType: Sized + Copy {
    type OPAQUE_KIND: T;

    // Required methods
    fn short_name() -> String;
    fn define_self__impl(
        language: &dyn HeaderLanguage,
        definer: &mut dyn Definer
    ) -> Result<()>;

    // Provided methods
    fn zeroed() -> Self { ... }
    fn define_self(
        language: &dyn HeaderLanguage,
        definer: &mut dyn Definer
    ) -> Result<()> { ... }
    fn name(_language: &dyn HeaderLanguage) -> String { ... }
    fn name_wrapping_var(
        language: &dyn HeaderLanguage,
        var_name: &str
    ) -> String { ... }
    fn csharp_marshaler() -> Option<String> { ... }
}
Expand description

Safety (non-exhaustive list at the moment):

  • ::core::mem::zeroed::<Self>() must be sound to use.

Required Associated Types§

Required Methods§

source

fn short_name() -> String

source

fn define_self__impl( language: &dyn HeaderLanguage, definer: &mut dyn Definer ) -> Result<()>

Provided Methods§

source

fn zeroed() -> Self

source

fn define_self( language: &dyn HeaderLanguage, definer: &mut dyn Definer ) -> Result<()>

source

fn name(_language: &dyn HeaderLanguage) -> String

source

fn name_wrapping_var(language: &dyn HeaderLanguage, var_name: &str) -> String

source

fn csharp_marshaler() -> Option<String>

Optional marshaler attached to the type (e.g., [MarshalAs(UnmanagedType.FunctionPtr)])

Implementors§

source§

impl CType for BytesVt_Layoutwhere Option<unsafe extern "C" fn(_: *const (), _: usize)>: ConcreteReprC,

source§

impl CType for PollFuture_Layout

Available on crate features futures and dyn-traits only.
source§

impl<'__usability> CType for DropGlueVTable_Layout<'__usability>where unsafe extern "C" fn(_: NonNullOwned<ErasedTy>): ConcreteReprC, PhantomData<*mut (<u8 as IdentityIgnoring<'__usability>>::ItSelf,)>: ConcreteReprC,

Available on crate feature dyn-traits only.
source§

impl<'__usability> CType for StaticDropGlueVTable_Layout<'__usability>where unsafe extern "C" fn(_: NonNullOwned<ErasedTy>): ConcreteReprC, unsafe extern "C" fn(_: NonNullRef<ErasedTy>) -> NonNullOwned<ErasedTy>: ConcreteReprC, PhantomData<*mut (<u8 as IdentityIgnoring<'__usability>>::ItSelf,)>: ConcreteReprC,

Available on crate feature dyn-traits only.
source§

impl<'__usability> CType for FfiFutureExecutorVTable_Layout<'__usability>where unsafe extern "C" fn(_: NonNullOwned<ErasedTy>): ConcreteReprC, unsafe extern "C" fn(_: NonNullRef<ErasedTy>) -> NonNullOwned<ErasedTy>: ConcreteReprC, unsafe extern "C" fn(_: NonNullRef<ErasedTy>, _: CLayoutOf<VirtualPtr<dyn Send + FfiFuture + 'static>>) -> CLayoutOf<VirtualPtr<dyn Send + FfiFuture + 'static>>: ConcreteReprC, unsafe extern "C" fn(_: NonNullRef<ErasedTy>, _: CLayoutOf<Box<dyn Send + FnMut() + 'static>>) -> CLayoutOf<VirtualPtr<dyn Send + FfiFuture + 'static>>: ConcreteReprC, unsafe extern "C" fn(_: NonNullRef<ErasedTy>, _: CLayoutOf<VirtualPtr<dyn FfiFuture + 'static>>) -> CLayoutOf<()>: ConcreteReprC, unsafe extern "C" fn(_: NonNullRef<ErasedTy>) -> CLayoutOf<VirtualPtr<dyn DropGlue + 'static>>: ConcreteReprC, PhantomData<*mut (<u8 as IdentityIgnoring<'__usability>>::ItSelf,)>: ConcreteReprC,

Available on crate features futures and dyn-traits only.
source§

impl<'__usability> CType for FfiFutureVTable_Layout<'__usability>where unsafe extern "C" fn(_: NonNullOwned<ErasedTy>): ConcreteReprC, unsafe extern "C" fn(_: NonNullMut<ErasedTy>, _: CLayoutOf<&'static mut Context<'static>>) -> CLayoutOf<PollFuture>: ConcreteReprC, PhantomData<*mut (<u8 as IdentityIgnoring<'__usability>>::ItSelf,)>: ConcreteReprC,

Available on crate features futures and dyn-traits only.
source§

impl<'a> CType for Bytes_Layout<'a>where *const u8: ConcreteReprC, usize: ConcreteReprC, *const (): ConcreteReprC, NonNull<u8>: ConcreteReprC, PhantomData<&'a [u8]>: ConcreteReprC,

source§

impl<'lt, Ret> CType for RefDynFnMut0_Layout<'lt, Ret>where Ret: ReprC + ReprC, NonNull<c_void>: ConcreteReprC, unsafe extern "C" fn(env_ptr: NonNull<c_void>) -> Ret: ConcreteReprC, PhantomData<&'lt ()>: ConcreteReprC,

source§

impl<'lt, Ret, A1> CType for RefDynFnMut1_Layout<'lt, Ret, A1>where Ret: ReprC + ReprC, A1: ReprC + ReprC, NonNull<c_void>: ConcreteReprC, unsafe extern "C" fn(env_ptr: NonNull<c_void>, _: A1) -> Ret: ConcreteReprC, PhantomData<&'lt ()>: ConcreteReprC,

source§

impl<'lt, T> CType for slice_mut_Layout<'lt, T>where T: 'lt + ReprC, NonNullMut<T>: ConcreteReprC, usize: ConcreteReprC, PhantomData<&'lt ()>: ConcreteReprC,

source§

impl<'lt, T> CType for slice_ref_Layout<'lt, T>where T: 'lt + ReprC, NonNullRef<T>: ConcreteReprC, usize: ConcreteReprC, PhantomData<&'lt ()>: ConcreteReprC,

source§

impl<Ret> CType for ArcDynFn0_Layout<Ret>where Ret: ReprC + ReprC, NonNull<c_void>: ConcreteReprC, unsafe extern "C" fn(env_ptr: NonNull<c_void>) -> Ret: ConcreteReprC, unsafe extern "C" fn(env_ptr: NonNull<c_void>): ConcreteReprC, Option<unsafe extern "C" fn(env_ptr: NonNull<c_void>)>: ConcreteReprC,

Available on crate feature alloc only.
source§

impl<Ret> CType for BoxDynFnMut0_Layout<Ret>where Ret: ReprC + ReprC, NonNull<c_void>: ConcreteReprC, Option<unsafe extern "C" fn(env_ptr: NonNull<c_void>) -> Ret>: ConcreteReprC, Option<unsafe extern "C" fn(env_ptr: NonNull<c_void>)>: ConcreteReprC,

Available on crate feature alloc only.
source§

impl<Ret, A1> CType for ArcDynFn1_Layout<Ret, A1>where Ret: ReprC + ReprC, A1: ReprC + ReprC, NonNull<c_void>: ConcreteReprC, unsafe extern "C" fn(env_ptr: NonNull<c_void>, _: A1) -> Ret: ConcreteReprC, unsafe extern "C" fn(env_ptr: NonNull<c_void>): ConcreteReprC, Option<unsafe extern "C" fn(env_ptr: NonNull<c_void>)>: ConcreteReprC,

Available on crate feature alloc only.
source§

impl<Ret, A1> CType for BoxDynFnMut1_Layout<Ret, A1>where Ret: ReprC + ReprC, A1: ReprC + ReprC, NonNull<c_void>: ConcreteReprC, Option<unsafe extern "C" fn(env_ptr: NonNull<c_void>, _: A1) -> Ret>: ConcreteReprC, Option<unsafe extern "C" fn(env_ptr: NonNull<c_void>)>: ConcreteReprC,

Available on crate feature alloc only.
source§

impl<T0, T1> CType for Tuple2_Layout<T0, T1>where T0: ReprC + ConcreteReprC, T1: ReprC + ConcreteReprC,

source§

impl<T> CType for slice_boxed_Layout<T>where T: ReprC, NonNullOwned<T>: ConcreteReprC, usize: ConcreteReprC,

source§

impl<T> CType for slice_raw_Layout<T>where T: ReprC, NonNull<T>: ConcreteReprC, usize: ConcreteReprC,

source§

impl<T> CType for Vec_Layout<T>where T: ReprC, NonNullOwned<T>: ConcreteReprC, usize: ConcreteReprC,

Available on crate feature alloc only.
source§

impl<T: LegacyCType> CType for T