[][src]Trait abi_stable::prefix_type::PrefixTypeTrait

pub unsafe trait PrefixTypeTrait: Sized {
type Prefix;

const METADATA: WithMetadataFor<Self, Self::Prefix>;
const PT_LAYOUT: &'static PTStructLayout;
const PT_FIELD_ACCESSIBILITY: FieldAccessibility;
    fn into_with_metadata(self) -> WithMetadata<Self> { ... }
fn leak_into_prefix<'a>(self) -> &'a Self::Prefix
    where
        Self: 'a,
        Self::Prefix: 'a
, { ... } }

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

Associated Types

type Prefix

A type only accessible through a shared reference.

The fields after the #[sabi(last_prefix_field)] attribute are only potentially accessible in their <field_name> methods, since their existence has to be checked at runtime. This is because multiple versions of the library may be loaded, where in some of them those fields don't exist.

Loading content...

Associated Constants

const METADATA: WithMetadataFor<Self, Self::Prefix>

Just the metadata of Self,for passing to WithMetadata::new, with WithMetadata::new(PrefixTypeTrait::METADATA,value)

const PT_LAYOUT: &'static PTStructLayout

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

const PT_FIELD_ACCESSIBILITY: FieldAccessibility

A bit array,where the bit at the field index represents whether that field is accessible.

Loading content...

Provided methods

fn into_with_metadata(self) -> WithMetadata<Self>

Converts self to a WithMetadata<Self>,.

fn leak_into_prefix<'a>(self) -> &'a Self::Prefix where
    Self: 'a,
    Self::Prefix: 'a, 

Convers Self to its WithMetadata<Self>, then leaks it and casts it to &'a Self::Prefix.

Loading content...

Implementors

Loading content...