Skip to main content

LoadFileDataBlock

Struct LoadFileDataBlock 

Source
pub struct LoadFileDataBlock<'a> { /* private fields */ }
Expand description

Streaming Load File Data Block. Stateful pull reader: each call to Self::next_block writes the next chunk into the caller’s buffer, so the whole block never resides in RAM at once.

Implementations§

Source§

impl LoadFileDataBlock<'_>

Source

pub fn len(&self) -> usize

Total LFDB byte length (sum of the §C.2-ordered components, decompressed). Needed for the 'C4' tag length and to derive block_count. Total framed LFDB byte length streamed to LOAD: the 'C4' tag+length header plus the §C.2-ordered component content. This is what the LOAD loop counts for last-block detection and block_count.

Source

pub fn content_len(&self) -> usize

Content length only — the value of the 'C4' TLV (sum of the §C.2 components, decompressed), excluding the header. This is the length encoded in the 'C4' header and the input over which a Load File Data Block Hash (Lh) would be computed (GPCS v2.3.1 §11.6.2.3) — not the framed stream.

Source

pub fn is_empty(&self) -> bool

true if there is no component content (degenerate / malformed CAP).

Source

pub fn next_block( &mut self, infl: &mut InflateCtx, out: &mut [u8], ) -> Result<usize, CapError>

Write the next LFDB chunk into out (should be LOAD_BLOCK_DATA long) and return the byte count written. Returns Ok(0) once the block is exhausted. STORED components are copied from the borrowed input; DEFLATE components are inflated through infl (the 32 KiB window doubles as the wrapping dictionary). A chunk may straddle component boundaries (the LFDB is the concatenation in GPCS §C.2 order), so bytes are assembled into out.

§Errors

Returns CapError::Inflate if a DEFLATE component cannot be decompressed (corrupt stream, or the input/window bound was exceeded).

Source

pub fn reset(&mut self)

Restart from the first byte (e.g. to hash the LFDB, then re-stream it to LOAD without re-parsing the ZIP). Caller should also infl.reset().

Auto Trait Implementations§

§

impl<'a> Freeze for LoadFileDataBlock<'a>

§

impl<'a> RefUnwindSafe for LoadFileDataBlock<'a>

§

impl<'a> Send for LoadFileDataBlock<'a>

§

impl<'a> Sync for LoadFileDataBlock<'a>

§

impl<'a> Unpin for LoadFileDataBlock<'a>

§

impl<'a> UnsafeUnpin for LoadFileDataBlock<'a>

§

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