Skip to main content

Snapshot

Struct Snapshot 

Source
pub struct Snapshot<'a> {
    pub flags: u16,
    pub created_at: u64,
    /* private fields */
}
Expand description

A parsed, validated snapshot borrowing the input buffer.

Fields§

§flags: u16

Header flags (see FLAG_VECTORS).

§created_at: u64

Creation timestamp as written (informational).

Implementations§

Source§

impl<'a> Snapshot<'a>

Source

pub fn parse(bytes: &'a [u8]) -> Result<Self, Error>

Parses and structurally validates a snapshot file (trust model in the module docs): framing, canonical layout and bounds only. The container xxh3 checksums are not verified here — that is on demand, in slices, via Snapshot::scrub. Content pools (text, vectors) are validated lazily too; see Memory::verify.

§Errors

Error::UnsupportedVersion for a foreign format version; Error::Corrupt for everything else that fails structural validation.

Source

pub fn config(&self) -> &'a [u8]

The binary config block (decode with Config::decode).

Source

pub fn section(&self, kind: u16) -> Option<&'a [u8]>

The bytes of one section, or None when the file has no section of that kind.

Source

pub fn engine_ver(&self) -> &'a str

The engine version string the file was written by (informational).

Source

pub fn scrub(&self) -> ScrubCursor<'a>

A resumable container-checksum scan of this snapshot with the default slice budget (DEFAULT_SCRUB_BUDGET). See ScrubCursor.

Source

pub fn scrub_with_budget(&self, budget: usize) -> ScrubCursor<'a>

A resumable container-checksum scan hashing at most budget bytes per Iterator::next. See ScrubCursor.

Trait Implementations§

Source§

impl<'a> Debug for Snapshot<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Snapshot<'a>

§

impl<'a> RefUnwindSafe for Snapshot<'a>

§

impl<'a> Send for Snapshot<'a>

§

impl<'a> Sync for Snapshot<'a>

§

impl<'a> Unpin for Snapshot<'a>

§

impl<'a> UnsafeUnpin for Snapshot<'a>

§

impl<'a> UnwindSafe for Snapshot<'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> 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.