pub struct BundleReader<'a> { /* private fields */ }Expand description
A parsed, integrity-checked view over a .hmc bundle’s bytes. Borrows the
input; get/segment return slices into it (zero copy).
Implementations§
Source§impl<'a> BundleReader<'a>
impl<'a> BundleReader<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self, BundleError>
pub fn parse(bytes: &'a [u8]) -> Result<Self, BundleError>
Parse and fully validate a bundle: magic, version, declared length,
whole-file CRC, and every entry’s bounds. On success the payloads are
known-good and in-bounds, so get/segment are total on valid keys.
Sourcepub fn entries(&self) -> &[BundleEntry]
pub fn entries(&self) -> &[BundleEntry]
The bundle’s entries (index order).
Sourcepub fn flags(&self) -> u16
pub fn flags(&self) -> u16
Reserved format flags from the header (0 in v1; reserved for future use such as a signed/compressed-entry variant).
Sourcepub fn entry(&self, key: &str) -> Option<&BundleEntry>
pub fn entry(&self, key: &str) -> Option<&BundleEntry>
The index record for key, if present.
Sourcepub fn get(&self, key: &str) -> Option<&'a [u8]>
pub fn get(&self, key: &str) -> Option<&'a [u8]>
A zero-copy slice of the intact embedded file for key. This slice is
a byte-identical standalone .q42 / .10d / .p64 — hand it straight to
that format’s reader.
Sourcepub fn segment(
&self,
key: &str,
seg_offset: u64,
seg_len: u64,
) -> Option<&'a [u8]>
pub fn segment( &self, key: &str, seg_offset: u64, seg_len: u64, ) -> Option<&'a [u8]>
A zero-copy slice of an interior segment of an entry
([seg_offset .. seg_offset+seg_len) within the embedded file). Returns
None if the key is unknown or the segment runs past the entry — proving
the bundle does not interfere with segment-level access into an entry.
Sourcepub fn verify_entry(&self, key: &str) -> bool
pub fn verify_entry(&self, key: &str) -> bool
Verify one entry’s payload against its recorded SHA-256.
Auto Trait Implementations§
impl<'a> Freeze for BundleReader<'a>
impl<'a> RefUnwindSafe for BundleReader<'a>
impl<'a> Send for BundleReader<'a>
impl<'a> Sync for BundleReader<'a>
impl<'a> Unpin for BundleReader<'a>
impl<'a> UnsafeUnpin for BundleReader<'a>
impl<'a> UnwindSafe for BundleReader<'a>
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more