Skip to main content

PrefixTypeTrait

Trait PrefixTypeTrait 

pub unsafe trait PrefixTypeTrait: Sized {
    type PrefixFields;
    type PrefixRef: PrefixRefTrait<PtrTarget = WithMetadata_<Self::PrefixFields, Self::PrefixFields>, PrefixFields = Self::PrefixFields>;

    const PT_LAYOUT: &'static PTStructLayout;
    const PT_FIELD_ACCESSIBILITY: BitArray64<IsAccessible>;

    // Provided method
    fn leak_into_prefix(self) -> Self::PrefixRef { ... }
}
Expand description

For types deriving StableAbi with #[sabi(kind(Prefix(..)))].

§Safety

This trait must be implemented by the StableAbi derive macro.

Required Associated Constants§

const PT_LAYOUT: &'static PTStructLayout

Describes the layout of the struct,exclusively for use in error messages.

const PT_FIELD_ACCESSIBILITY: BitArray64<IsAccessible>

A bit array,where each nth bit represents whether the nth field is accessible.

Required Associated Types§

type PrefixFields

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

Those structs are usually named with a _Prefix suffix.

type PrefixRef: PrefixRefTrait<PtrTarget = WithMetadata_<Self::PrefixFields, Self::PrefixFields>, PrefixFields = Self::PrefixFields>

A pointer to Self::PrefixFields, generally wraps a PrefixRef<Self::PrefixFields>.

Those pointer types are usually named with a _Ref suffix.

Provided Methods§

fn leak_into_prefix(self) -> Self::PrefixRef

Converts Self to Self::PrefixRef,leaking it in the process.

§Warning

You must be careful when calling this function, since this leak is ignored by miri .

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl PrefixTypeTrait for Module

§

const PT_FIELD_ACCESSIBILITY: BitArray64<IsAccessible>

§

const PT_LAYOUT: &'static PTStructLayout = __sabi_PT_LAYOUTModule

§

type PrefixFields = Module_Prefix

§

type PrefixRef = Module_Ref

Source§

impl PrefixTypeTrait for PluginMod

Source§

const PT_FIELD_ACCESSIBILITY: FieldAccessibility

Source§

const PT_LAYOUT: &'static PTStructLayout = __sabi_PT_LAYOUTPluginMod

Source§

type PrefixFields = PluginMod_Prefix

Source§

type PrefixRef = PluginMod_Ref

§

impl<T> PrefixTypeTrait for PhantModule<T>
where T: Copy,

§

const PT_FIELD_ACCESSIBILITY: BitArray64<IsAccessible>

§

const PT_LAYOUT: &'static PTStructLayout = __sabi_PT_LAYOUTPhantModule

§

type PrefixFields = PhantModule_Prefix<T>

§

type PrefixRef = PhantModule_Ref<T>