Skip to main content

PartialDecode

Struct PartialDecode 

Source
pub struct PartialDecode {
    pub data: Vec<u8>,
    pub start_block: u32,
    pub blocks_decoded: u32,
    pub stopped_at: Option<(u32, FrameDecoderError)>,
    pub frame_finished: bool,
    pub resume_state: Option<ResumeState>,
}
Available on crate feature lsm only.
Expand description

Outcome of FrameDecoder::decode_blocks_partial: the decompressed bytes of the requested inner-block range plus where (if anywhere) decoding stopped early.

Behind the lsm Cargo feature.

Fields§

§data: Vec<u8>

Decompressed bytes of the in-range blocks actually decoded, in frame order, as one contiguous buffer. data.len() equals the sum of the decompressed sizes of blocks start_block .. start_block + blocks_decoded.

§start_block: u32

First block whose output is in data: the requested start_block on a fresh decode, or ResumeState::block_index when resuming (the caller-supplied start_block is ignored in resume mode).

§blocks_decoded: u32

Number of in-range blocks successfully decoded into data.

§stopped_at: Option<(u32, FrameDecoderError)>

Some((block_index, error)) if decoding stopped on a failing block before reaching end_block (a corrupt block inside the range, or a leading block needed for window context). None if the requested range decoded cleanly or the frame’s last block was reached first.

When the failing block is a leading context block (block_index < start_block), the in-range window could not be built so data is empty and blocks_decoded is 0.

§frame_finished: bool

true if the frame’s last block was reached during this decode.

§resume_state: Option<ResumeState>

Cross-block carry-over state for resuming the next extent. Feed it back (with the matching window_prime) via the resume argument of a later FrameDecoder::decode_blocks_partial to continue from ResumeState::block_index without re-decompressing the prefix.

None in two cases: emission was not requested (emit_resume = false), OR this decode reached the frame’s last block (frame_finished is true) — there is no following block to resume from, so no snapshot is emitted even with emit_resume = true. Callers walking a frame incrementally should therefore stop when frame_finished is set rather than treat a None here as “emission disabled”.

Trait Implementations§

Source§

impl Debug for PartialDecode

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.