Trait safer_ffi::layout::ReprC

source ·
pub unsafe trait ReprC: Sized {
    type CLayout: CType;

    // Required method
    fn is_valid(it: &Self::CLayout) -> bool;
}
Expand description

The meat of the crate. The trait. This trait describes that a type has a defined / fixed #[repr(C)] layout.

This is expressed at the type level by the unsafe (trait) type association of ReprC::CLayout, which must be a CType.

Because of that property, the type may be used in the API of an #[ffi_export]-ed function, where ABI-wise it will be replaced by its equivalent C layout.

Then, #[ffi_export] will transmute the CType parameters back to the provided ReprC types, using from_raw_unchecked.

Although, from a pure point of view, no checks are performed at this step whatsoever, in practice, when debug_assertions are enabled, some “sanity checks” are performed on the input parameters: ReprC::is_valid is called in that case (as part of the implementation of from_raw).

  • Although that may look innocent, it is actually pretty powerful tool:

    For instance, a non-null pointer coming from C can, this way, be automatically checked and unwrapped, and the same applies for enumerations having a finite number of valid bit-patterns.

Safety

It must be sound to transmute from a ReprC::CLayout instance when the bit pattern represents a safe instance of Self.

Implementing ReprC

It is generally recommended to avoid manually (and unsafe-ly) implementing the ReprC trait. Instead, the recommended and blessed way is to use the #[derive_ReprC] attribute on your #[repr(C)] struct (or your field-less #[repr(<integer>)] enum).

Examples

Simple struct
use ::safer_ffi::prelude::*;

#[derive_ReprC]
#[repr(C)]
struct Instant {
    seconds: u64,
    nanos: u32,
}
  • corresponding to the following C definition:

    typedef struct {
        uint64_t seconds;
        uint32_t nanos;
    } Instant_t;
    
Field-less enum
use ::safer_ffi::prelude::*;

#[derive_ReprC]
#[repr(u8)]
enum Status {
    Ok = 0,
    Busy,
    NotInTheMood,
    OnStrike,
    OhNo,
}
  • corresponding to the following C definition:

    typedef uint8_t Status_t; enum {
        STATUS_OK = 0,
        STATUS_BUSY,
        STATUS_NOT_IN_THE_MOOD,
        STATUS_ON_STRIKE,
        STATUS_OH_NO,
    }
    
Generic struct
use ::safer_ffi::prelude::*;

#[derive_ReprC]
#[repr(C)]
struct Point<Coordinate : ReprC> {
    x: Coordinate,
    y: Coordinate,
}

Each monomorphization leads to its own C definition:

  • Point<i32>

    typedef struct {
        int32_t x;
        int32_t y;
    } Point_int32_t;
    
  • Point<f64>

    typedef struct {
        double x;
        double y;
    } Point_double_t;
    

Required Associated Types§

source

type CLayout: CType

The CType having the same layout as Self.

Required Methods§

source

fn is_valid(it: &Self::CLayout) -> bool

Sanity checks that can be performed on an instance of the CType layout.

Such checks are performed when calling from_raw, or equivalently (⚠️ only with debug_assertions enabled ⚠️), from_raw_unchecked.

Implementation-wise, this function is only a “sanity check” step:

  • It is valid (although rather pointless) for this function to always return true, even if the input may be unsafe to transmute to Self, or even be an invalid value of type Self.

  • In the other direction, it is not unsound, although it would be a logic error, to always return false.

  • This is because it is impossible to have a function that for any type is able to tell if a given bit pattern is a safe value of that type.

In practice, if this function returns false, then such result must be trusted, i.e., transmuting such instance to the Self type will, at the very least, break a safety invariant, and it will even most probably break a validity invariant.

On the other hand, if the function returns true, then the result is inconclusive; there is no explicit reason to stop going on, but that doesn’t necessarily make it sound.

TL,DR

This function may yield false positives but no false negatives.

Example: Self = &'borrow i32

When Self = &'borrow i32, we know that the backing pointer is necessarily non-null and well-aligned.

This means that bit-patterns such as 0 as *const i32 or 37 as *const i32 are “blatantly unsound” to transmute to a &'borrow i32, and thus <&'borrow i32 as ReprC>::is_valid will return false in such cases.

But if given 4 as *const i32, or if given { let p = &*Box::new(42) as *const i32; p }, then is_valid will return true in both cases, since it doesn’t know better.

Example: bool or #[repr(u8)] enum Foo { A, B }

In the case of bool, or in the case of a #[repr(<integer>)] field-less enum, then the valid bit-patterns and the invalid bit-patterns are all known and finite.

In that case, ReprC::is_valid will return a bool that truly represents the validity of the bit-pattern, in both directions

  • i.e., no false positives (validity-wise);

Still, there may be safety invariants involved with custom types, so even then it is unclear.

Implementations on Foreign Types§

source§

impl<T> ReprC for Box<T>

§

type CLayout = OpaqueLayout_<PhantomData<Box<T, Global>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<Ret: ReprC, A2: ReprC> ReprC for Option<extern "C" fn(_: A2) -> Ret>

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn(_: <A2 as ReprC>::CLayout) -> <Ret as ReprC>::CLayout>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for u64

§

type CLayout = u64

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<Ret: ReprC, A2: ReprC> ReprC for unsafe extern "C" fn(_: A2) -> Ret

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn(_: <A2 as ReprC>::CLayout) -> <Ret as ReprC>::CLayout>

source§

fn is_valid(c_layout: &Self::CLayout) -> bool

source§

impl<'c> ReprC for Context<'c>

§

type CLayout = OpaqueLayout_<PhantomData<Context<'c>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for i64

§

type CLayout = i64

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<T: ReprC> ReprC for NonNull<T>

source§

impl<Ret: ReprC> ReprC for Option<extern "C" fn() -> Ret>

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn() -> <Ret as ReprC>::CLayout>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<Ret: ReprC, A1: ReprC, A2: ReprC> ReprC for unsafe extern "C" fn(_: A1, _: A2) -> Ret

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn(_: <A1 as ReprC>::CLayout, _: <A2 as ReprC>::CLayout) -> <Ret as ReprC>::CLayout>

source§

fn is_valid(c_layout: &Self::CLayout) -> bool

source§

impl<Ret: ReprC, A2: ReprC> ReprC for extern "C" fn(_: A2) -> Ret

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn(_: <A2 as ReprC>::CLayout) -> <Ret as ReprC>::CLayout>

source§

fn is_valid(c_layout: &Self::CLayout) -> bool

source§

impl<T: ReprC + HasNiche> ReprC for Option<T>

§

type CLayout = <T as ReprC>::CLayout

source§

fn is_valid(it: &Self::CLayout) -> bool

source§

impl<'a, T: 'a + ReprC> ReprC for &'a mut T

source§

impl<Ret: ReprC, A1: ReprC, A2: ReprC> ReprC for Option<unsafe extern "C" fn(_: A1, _: A2) -> Ret>

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn(_: <A1 as ReprC>::CLayout, _: <A2 as ReprC>::CLayout) -> <Ret as ReprC>::CLayout>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for f32

§

type CLayout = f32

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<T: ?Sized> ReprC for PhantomData<T>

§

type CLayout = CVoid

source§

fn is_valid(_: &CVoid) -> bool

source§

impl<T> ReprC for Vec<T>

§

type CLayout = OpaqueLayout_<PhantomData<Vec<T, Global>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for bool

§

type CLayout = Bool

source§

fn is_valid(it: &Bool) -> bool

source§

impl<Ret: ReprC> ReprC for unsafe extern "C" fn() -> Ret

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn() -> <Ret as ReprC>::CLayout>

source§

fn is_valid(c_layout: &Self::CLayout) -> bool

source§

impl<'r, T> ReprC for &'r [T]

§

type CLayout = OpaqueLayout_<PhantomData<&'r [T]>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<Item: ReprC> ReprC for [Item; 2]

Simplified for lighter documentation, but the actual impls range from 1 up to 32, plus a bunch of significant lengths up to 1024.

§

type CLayout = [<Item as ReprC>::CLayout; 2]

source§

fn is_valid(it: &Self::CLayout) -> bool

source§

impl ReprC for c_void

§

type CLayout = CVoid

source§

fn is_valid(_: &CVoid) -> bool

source§

impl<Ret: ReprC, A2: ReprC> ReprC for Option<unsafe extern "C" fn(_: A2) -> Ret>

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn(_: <A2 as ReprC>::CLayout) -> <Ret as ReprC>::CLayout>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<T> ReprC for Arc<T>

§

type CLayout = OpaqueLayout_<PhantomData<Arc<T>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<'r> ReprC for &'r str

§

type CLayout = OpaqueLayout_<PhantomData<&'r str>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for isize

source§

impl ReprC for u16

§

type CLayout = u16

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<'a, T: 'a + ReprC> ReprC for &'a T

source§

impl<Ret: ReprC, A1: ReprC, A2: ReprC> ReprC for extern "C" fn(_: A1, _: A2) -> Ret

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn(_: <A1 as ReprC>::CLayout, _: <A2 as ReprC>::CLayout) -> <Ret as ReprC>::CLayout>

source§

fn is_valid(c_layout: &Self::CLayout) -> bool

source§

impl ReprC for String

§

type CLayout = OpaqueLayout_<PhantomData<String>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<'r, T> ReprC for &'r mut [T]

§

type CLayout = OpaqueLayout_<PhantomData<&'r mut [T]>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<T: ReprC> ReprC for *mut T

§

type CLayout = *mut <T as ReprC>::CLayout

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<T> ReprC for RwLock<T>

§

type CLayout = OpaqueLayout_<PhantomData<RwLock<T>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<T: ReprC> ReprC for *const T

source§

impl<Ret: ReprC> ReprC for extern "C" fn() -> Ret

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn() -> <Ret as ReprC>::CLayout>

source§

fn is_valid(c_layout: &Self::CLayout) -> bool

source§

impl ReprC for i8

§

type CLayout = i8

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for u8

§

type CLayout = u8

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for usize

source§

impl<Ret: ReprC> ReprC for Option<unsafe extern "C" fn() -> Ret>

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn() -> <Ret as ReprC>::CLayout>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for u32

§

type CLayout = u32

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<Item: ReprC> ReprC for [Item; 1]

Simplified for lighter documentation, but the actual impls range from 1 up to 32, plus a bunch of significant lengths up to 1024.

§

type CLayout = [<Item as ReprC>::CLayout; 1]

source§

fn is_valid(it: &Self::CLayout) -> bool

source§

impl<T> ReprC for Rc<T>

§

type CLayout = OpaqueLayout_<PhantomData<Rc<T>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<Ret: ReprC, A1: ReprC, A2: ReprC> ReprC for Option<extern "C" fn(_: A1, _: A2) -> Ret>

Simplified for lighter documentation, but the actual impls include up to 9 function parameters.

§

type CLayout = Option<unsafe extern "C" fn(_: <A1 as ReprC>::CLayout, _: <A2 as ReprC>::CLayout) -> <Ret as ReprC>::CLayout>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for i16

§

type CLayout = i16

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for ()

§

type CLayout = CVoid

source§

fn is_valid(_: &CVoid) -> bool

source§

impl<T> ReprC for RefCell<T>

§

type CLayout = OpaqueLayout_<PhantomData<RefCell<T>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for f64

§

type CLayout = f64

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<K, V> ReprC for HashMap<K, V>

§

type CLayout = OpaqueLayout_<PhantomData<HashMap<K, V, RandomState>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<T> ReprC for Mutex<T>

§

type CLayout = OpaqueLayout_<PhantomData<Mutex<T>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl ReprC for i32

§

type CLayout = i32

source§

fn is_valid(_: &Self::CLayout) -> bool

source§

impl<K, V> ReprC for BTreeMap<K, V>

§

type CLayout = OpaqueLayout_<PhantomData<BTreeMap<K, V, Global>>>

source§

fn is_valid(_: &Self::CLayout) -> bool

Implementors§

source§

impl ReprC for PollFuture

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

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

source§

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

source§

impl ReprC for char_p_boxedwhere NonNullOwned<c_char>: ReprC,

source§

impl ReprC for char_p_rawwhere NonNullRef<c_char>: ReprC,

source§

impl ReprC for DynDropwhere VirtualPtr<dyn Send + Sync + StaticDropGlue + 'static>: ReprC,

Available on crate feature dyn-traits only.
source§

impl ReprC for PollFuture_Layout

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

impl ReprC for Erased

Available on crate feature dyn-traits only.
§

type CLayout = __opaque_Erased

source§

impl ReprC for str_boxedwhere slice_boxed<u8>: ReprC,

source§

impl ReprC for safer_ffi::Stringwhere Vec<u8>: ReprC,

§

type CLayout = <Vec<u8> as ReprC>::CLayout

source§

impl ReprC for c_char

source§

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

Available on crate feature dyn-traits only.
§

type CLayout = DropGlueVTable_Layout<'__usability>

source§

impl<'__usability> ReprC 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.
§

type CLayout = DropGlueVTable_Layout<'__usability>

source§

impl<'__usability> ReprC for StaticDropGlueVTable<'__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> ReprC 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> ReprC for FfiFutureExecutorVTable<'__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> ReprC 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> ReprC for FfiFutureVTable<'__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.
§

type CLayout = FfiFutureVTable_Layout<'__usability>

source§

impl<'__usability> ReprC 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.
§

type CLayout = FfiFutureVTable_Layout<'__usability>

source§

impl<'a> ReprC for Bytes<'a>where *const u8: ConcreteReprC, usize: ConcreteReprC, *const (): ConcreteReprC, &'a BytesVt: ConcreteReprC,

source§

impl<'a> ReprC for Bytes_Layout<'a>where *const u8: ConcreteReprC, usize: ConcreteReprC, *const (): ConcreteReprC, &'a BytesVt: ConcreteReprC,

source§

impl<'a> ReprC for ErasedRef<'a>where NonNullRef<ErasedTy>: ReprC,

Available on crate feature dyn-traits only.
source§

impl<'lt> ReprC for char_p_ref<'lt>where NonNullRef<c_char>: ReprC,

source§

impl<'lt> ReprC for str_ref<'lt>where slice_ref<'lt, u8>: ReprC,

§

type CLayout = <slice_ref<'lt, u8> as ReprC>::CLayout

source§

impl<'lt, Ret> ReprC for RefDynFnMut0<'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> ReprC 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> ReprC for RefDynFnMut1<'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,

§

type CLayout = RefDynFnMut1_Layout<'lt, Ret, A1>

source§

impl<'lt, Ret, A1> ReprC 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,

§

type CLayout = RefDynFnMut1_Layout<'lt, Ret, A1>

source§

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

source§

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

source§

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

source§

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

source§

impl<'out, T: 'out + Sized + ReprC> ReprC for Out<'out, T>

source§

impl<DynTrait: ?Sized + ReprCTrait> ReprC for VirtualPtr<DynTrait>where VirtualPtr_<NonNullOwned<Erased>, DynTrait::VTable>: ReprC,

Available on crate feature dyn-traits only.
§

type CLayout = <VirtualPtr_<NonNullOwned<Erased>, <DynTrait as ReprCTrait>::VTable> as ReprC>::CLayout

source§

impl<Ret> ReprC for ArcDynFn0<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> ReprC 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> ReprC for BoxDynFnMut0<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,

Available on crate feature alloc only.
source§

impl<Ret> ReprC for BoxDynFnMut0_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,

Available on crate feature alloc only.
source§

impl<Ret, A1> ReprC for ArcDynFn1<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.
§

type CLayout = ArcDynFn1_Layout<Ret, A1>

source§

impl<Ret, A1> ReprC 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.
§

type CLayout = ArcDynFn1_Layout<Ret, A1>

source§

impl<Ret, A1> ReprC for BoxDynFnMut1<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,

Available on crate feature alloc only.
source§

impl<Ret, A1> ReprC for BoxDynFnMut1_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,

Available on crate feature alloc only.
source§

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

§

type CLayout = Tuple2_Layout<T0, T1>

source§

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

§

type CLayout = Tuple2_Layout<T0, T1>

source§

impl<T> ReprC for Box_<T>where NonNullOwned<T>: ReprC,

Available on crate feature alloc only.
source§

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

source§

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

source§

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

source§

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

source§

impl<T> ReprC for safer_ffi::Vec<T>where T: ReprC, NonNullOwned<T>: ConcreteReprC, usize: ConcreteReprC,

Available on crate feature alloc only.
source§

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

Available on crate feature alloc only.
source§

impl<T> ReprC for Opaque<T>

§

type CLayout = OpaqueLayout_<PhantomData<T>>

source§

impl<T: ConcreteReprC> ReprC for TaggedOption<T>where Tuple2<bool, CLayoutOf<T>>: ReprC,

§

type CLayout = <Tuple2<bool, <T as ReprC>::CLayout> as ReprC>::CLayout

source§

impl<T: ReprC> ReprC for NonNullMut<T>

source§

impl<T: ReprC> ReprC for NonNullOwned<T>

source§

impl<T: ReprC> ReprC for NonNullRef<T>