pub unsafe trait IStable: Sized {
type Size: IUnsigned;
type Align: IPowerOf2;
type ForbiddenValues: IForbiddenValues;
type UnusedBits: IBitMask;
type HasExactlyOneNiche: ISaturatingAdd;
type ContainsIndirections: IBit;
const REPORT: &'static TypeReport;
const ID: u64;
// Provided methods
fn size() -> usize { ... }
fn align() -> usize { ... }
}Expand description
A trait to describe the layout of a type, marking it as ABI-stable.
Every layout is assumed to start at the type’s first byte.
§Safety
Mis-implementing this trait can lead to memory corruption in sum tyoes
Required Associated Types§
sourcetype ForbiddenValues: IForbiddenValues
type ForbiddenValues: IForbiddenValues
The values that the annotated type cannot occupy.
sourcetype UnusedBits: IBitMask
type UnusedBits: IBitMask
The padding bits in the annotated types
sourcetype HasExactlyOneNiche: ISaturatingAdd
type HasExactlyOneNiche: ISaturatingAdd
Allows the detection of whether or not core::option::Options are stable:
sourcetype ContainsIndirections: IBit
type ContainsIndirections: IBit
Whether or not the type contains indirections (pointers, indices in independent data-structures…)
Required Associated Constants§
sourceconst REPORT: &'static TypeReport
const REPORT: &'static TypeReport
A compile-time generated report of the fields of the type, allowing for compatibility inspection.
sourceconst ID: u64
const ID: u64
A stable (and ideally unique) identifier for the type. Often generated using crate::report::gen_id, but can be manually set.
Provided Methods§
Object Safety§
This trait is not object safe.