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: FieldAccessibility;
// 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§
Sourceconst PT_LAYOUT: &'static PTStructLayout
const PT_LAYOUT: &'static PTStructLayout
Describes the layout of the struct,exclusively for use in error messages.
Sourceconst PT_FIELD_ACCESSIBILITY: FieldAccessibility
const PT_FIELD_ACCESSIBILITY: FieldAccessibility
A bit array,where each nth bit represents whether the nth field is accessible.
Required Associated Types§
Sourcetype PrefixFields
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.
Sourcetype PrefixRef: PrefixRefTrait<PtrTarget = WithMetadata_<Self::PrefixFields, Self::PrefixFields>, PrefixFields = Self::PrefixFields>
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§
Sourcefn leak_into_prefix(self) -> Self::PrefixRef
fn leak_into_prefix(self) -> Self::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.