pub struct Manifest<'a> {
pub type_name: &'a str,
pub schema_version: u32,
pub layout: LayoutSpec,
pub fields: &'a [FieldSpec<'a>],
pub variants: &'a [VariantSpec<'a>],
pub evolution: EvolutionSpec<'a>,
}Expand description
The semantic manifest: the single source of truth drivers read.
Fields§
§type_name: &'a strFully spelled type name, e.g. "my_crate::User".
schema_version: u32Monotonic schema version (1 for the first revision).
layout: LayoutSpecIn-memory layout of the type.
fields: &'a [FieldSpec<'a>]Fields in declaration order (for a struct; empty for an enum).
variants: &'a [VariantSpec<'a>]Variants in declaration order (for a fieldless enum; empty for a struct).
evolution: EvolutionSpec<'a>How this version relates to its predecessor.
Implementations§
Source§impl Manifest<'_>
impl Manifest<'_>
Sourcepub const fn packed_field_bytes(&self) -> usize
pub const fn packed_field_bytes(&self) -> usize
Sum of the sizes of all fields, ignoring inter-field padding.
Sourcepub const fn padding_bytes(&self) -> usize
pub const fn padding_bytes(&self) -> usize
Bytes of padding the compiler inserted between/after fields.
A return value of 0 means the layout is gap-free — the precondition a
zerocopy driver checks before treating the type as plain bytes.
Sourcepub const fn is_gap_free(&self) -> bool
pub const fn is_gap_free(&self) -> bool
Whether the layout has no padding holes (gap-free).
Sourcepub const fn extends(&self, prev: &Manifest<'_>) -> bool
pub const fn extends(&self, prev: &Manifest<'_>) -> bool
Whether self is a layout-compatible, append-only extension of prev:
every field of prev is still present, at the same offset, size and type.
This is the compile-time precondition for evolving a zerocopy type while
keeping old readers valid — new fields may only be appended, never
inserted, reordered, resized or retyped. The type check matters: a field
silently changed from u32 to f32 keeps the same offset and size but
reinterprets the bytes, so it must not pass. Pair with assert_compatible!.