Skip to main content

Manifest

Struct Manifest 

Source
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 str

Fully spelled type name, e.g. "my_crate::User".

§schema_version: u32

Monotonic schema version (1 for the first revision).

§layout: LayoutSpec

In-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<'_>

Source

pub const fn packed_field_bytes(&self) -> usize

Sum of the sizes of all fields, ignoring inter-field padding.

Source

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.

Source

pub const fn is_gap_free(&self) -> bool

Whether the layout has no padding holes (gap-free).

Source

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!.

Trait Implementations§

Source§

impl<'a> Clone for Manifest<'a>

Source§

fn clone(&self) -> Manifest<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Manifest<'a>

Source§

impl<'a> Debug for Manifest<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for Manifest<'a>

Source§

impl<'a> PartialEq for Manifest<'a>

Source§

fn eq(&self, other: &Manifest<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> StructuralPartialEq for Manifest<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Manifest<'a>

§

impl<'a> RefUnwindSafe for Manifest<'a>

§

impl<'a> Send for Manifest<'a>

§

impl<'a> Sync for Manifest<'a>

§

impl<'a> Unpin for Manifest<'a>

§

impl<'a> UnsafeUnpin for Manifest<'a>

§

impl<'a> UnwindSafe for Manifest<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.