Skip to main content

FseDecoder

Struct FseDecoder 

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

FSE bitstream decoder.

Reads symbols from a backward bitstream using an FSE table. Zstd uses backward bitstreams - bits are read from high to low.

Implementations§

Source§

impl<'a> FseDecoder<'a>

Source

pub fn new(table: &'a FseTable) -> Self

Create a new FSE decoder with the given table.

Source

pub fn init_state(&mut self, bits: &mut BitReader<'_>) -> Result<()>

Initialize the decoder state from the bitstream.

Reads accuracy_log bits to set the initial state.

Source

pub fn decode_symbol(&mut self, bits: &mut BitReader<'_>) -> Result<u8>

Decode the current symbol and update state.

Returns the decoded symbol.

Source

pub fn peek_symbol(&self) -> u8

Peek at the current symbol without advancing state.

Source

pub fn peek_num_bits(&self) -> u8

Peek at how many bits the next decode operation needs.

Source

pub fn peek_seq_base(&self) -> u32

Peek at the direct sequence base value for the current state. Used by predefined sequence tables that store baseValue directly.

Source

pub fn peek_seq_extra_bits(&self) -> u8

Peek at the number of extra bits for sequence decoding. Used by predefined sequence tables.

Source

pub fn update_state(&mut self, bits: &mut BitReader<'_>) -> Result<()>

Update state by reading FSE transition bits (without returning symbol).

Call this AFTER reading extra bits, to update state for next symbol. For the last sequence, skip this call (no state update needed).

Source

pub fn state(&self) -> usize

Get the current state (for debugging/testing).

Trait Implementations§

Source§

impl<'a> Debug for FseDecoder<'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 FseDecoder<'a>

§

impl<'a> RefUnwindSafe for FseDecoder<'a>

§

impl<'a> Send for FseDecoder<'a>

§

impl<'a> Sync for FseDecoder<'a>

§

impl<'a> Unpin for FseDecoder<'a>

§

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