Skip to main content

HeaderOnlySnapshot

Struct HeaderOnlySnapshot 

Source
pub struct HeaderOnlySnapshot<'view> { /* private fields */ }
Expand description

Header-only handle to a snapshot’s bytes.

HeaderOnlySnapshot is the typestate-distinct counterpart to Snapshot: it validates only the fixed header (magic, format versions, header size, reserved bytes) and exposes the format versions, but it deliberately does not parse or expose the section table. Callers who only need to inspect format compatibility (e.g., to decide whether the snapshot is readable at all) should use this type rather than asking Snapshot to skip section validation.

§Performance

HeaderOnlySnapshot::open is O(1) — it does not walk the section table or payload region. Subsequent accessors are O(1).

Implementations§

Source§

impl<'view> HeaderOnlySnapshot<'view>

Source

pub fn open(bytes: &'view [u8]) -> Result<Self, SnapshotError>

Opens bytes as a header-validated snapshot handle.

Validates the magic bytes, format major and minor, header size, and reserved bytes only. The section table and payload region are not inspected and may still be malformed.

§Errors

Returns SnapshotError for any header-level invariant violation.

§Performance

This function is O(1).

Source

pub const fn bytes(&self) -> &'view [u8]

Returns the borrowed snapshot bytes.

§Performance

This method is O(1).

Source

pub const fn format_major(&self) -> u32

Returns the format major version recorded in the snapshot header.

§Performance

This method is O(1).

Source

pub const fn format_minor(&self) -> u32

Returns the format minor version recorded in the snapshot header.

§Performance

This method is O(1).

Trait Implementations§

Source§

impl<'view> Clone for HeaderOnlySnapshot<'view>

Source§

fn clone(&self) -> HeaderOnlySnapshot<'view>

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<'view> Debug for HeaderOnlySnapshot<'view>

Source§

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

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

impl<'view> Copy for HeaderOnlySnapshot<'view>

Auto Trait Implementations§

§

impl<'view> Freeze for HeaderOnlySnapshot<'view>

§

impl<'view> RefUnwindSafe for HeaderOnlySnapshot<'view>

§

impl<'view> Send for HeaderOnlySnapshot<'view>

§

impl<'view> Sync for HeaderOnlySnapshot<'view>

§

impl<'view> Unpin for HeaderOnlySnapshot<'view>

§

impl<'view> UnsafeUnpin for HeaderOnlySnapshot<'view>

§

impl<'view> UnwindSafe for HeaderOnlySnapshot<'view>

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.