Skip to main content

ResumeState

Struct ResumeState 

Source
pub struct ResumeState { /* private fields */ }
Available on crate feature lsm only.
Expand description

Cross-block decode state needed to resume a cold partial decode at an inner block boundary, emitted by FrameDecoder::decode_blocks_partial when its emit_resume argument is true (returned in PartialDecode::resume_state) and fed back via that same method’s resume argument (ResumeInput).

A zstd block does not carry all the state required to decode it in isolation: besides the shared match window (the decompressed output history), a Compressed block may reuse the previous block’s entropy tables via Repeat_Mode (literals Huffman + the LL/OF/ML FSE distributions) and always continues the running repeat-offset history. This snapshot carries exactly that carry-over state plus the resume coordinates, so resuming is byte-identical to a contiguous decode even across a dropped decoder. The window itself is NOT stored here — the caller supplies it back through ResumeInput::window_prime from the decompressed output it already persists. Neither is the dictionary: for a dictionary frame the caller re-attaches it to the resuming decoder via FrameDecoder::reset / FrameDecoder::reset_with_dict_handle (it already holds the dictionary from encode time), and the snapshot records only the dictionary’s identity so a resume under a different dictionary is rejected.

Behind the lsm Cargo feature.

Implementations§

Source§

impl ResumeState

Source

pub fn block_index(&self) -> u32

Inner block index this state resumes at (the first block not yet decoded). Pass it as the end_block lower bound (and as start_block) of the resuming decode_blocks_partial call.

Source

pub fn output_offset(&self) -> u64

Cumulative decompressed byte count produced before block_index — i.e. the decompressed offset at which the resumed output begins. Equals FrameEmitInfo::decompressed_byte_range(block_index).start. Use it to slice the window_prime tail the resumed call needs.

Trait Implementations§

Source§

impl Debug for ResumeState

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.