abi_stable::prefix_type

Trait PrefixRefTrait

Source
pub unsafe trait PrefixRefTrait: Sized + ImmutableRef<PtrTarget = WithMetadata_<Self::PrefixFields, Self::PrefixFields>> {
    type PrefixFields;

    // Provided methods
    fn from_prefix_ref(this: PrefixRef<Self::PrefixFields>) -> Self { ... }
    fn to_prefix_ref(self) -> PrefixRef<Self::PrefixFields> { ... }
}
Expand description

Marker trait for pointers to prefix field structs.

Generally prefix field structs are named with a _Prefix suffix, and have all the fields of some other struct up to the one with a #[sabi(last_prefix_field)] attribute.

§Safety

Self must either be PrefixRef<Self::PrefixFields>, or a #[repr(transparent)] wrapper around one.

Required Associated Types§

Source

type PrefixFields

A struct that contains all the fields of some other struct up to the field annotated with #[sabi(last_prefix_field)] inclusive.

Those structs are usually named with a _Prefix suffix.

Provided Methods§

Source

fn from_prefix_ref(this: PrefixRef<Self::PrefixFields>) -> Self

Converts a PrefixRef to Self

Source

fn to_prefix_ref(self) -> PrefixRef<Self::PrefixFields>

Converts Self to a PrefixRef

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl PrefixRefTrait for Module_Ref

Source§

impl<'borr, ErasedPtr, I> PrefixRefTrait for VTable_Ref<'borr, ErasedPtr, I>

Source§

type PrefixFields = VTable_Prefix<'borr, ErasedPtr, I>

Source§

impl<P> PrefixRefTrait for PrefixRef<P>

Source§

impl<T: Copy> PrefixRefTrait for PhantModule_Ref<T>