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>
impl<'view> HeaderOnlySnapshot<'view>
Sourcepub fn open(bytes: &'view [u8]) -> Result<Self, SnapshotError>
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).
Sourcepub const fn format_major(&self) -> u32
pub const fn format_major(&self) -> u32
Sourcepub const fn format_minor(&self) -> u32
pub const fn format_minor(&self) -> u32
Trait Implementations§
Source§impl<'view> Clone for HeaderOnlySnapshot<'view>
impl<'view> Clone for HeaderOnlySnapshot<'view>
Source§fn clone(&self) -> HeaderOnlySnapshot<'view>
fn clone(&self) -> HeaderOnlySnapshot<'view>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more