Struct weezl::decode::DecodeState

source ·
struct DecodeState<CodeBuffer> {
    min_size: u8,
    table: Table,
    buffer: Buffer,
    last: Option<(u16, Link)>,
    next_code: u16,
    clear_code: u16,
    end_code: u16,
    has_ended: bool,
    is_tiff: bool,
    implicit_reset: bool,
    code_buffer: CodeBuffer,
}

Fields§

§min_size: u8

The original minimum code size.

§table: Table

The table of decoded codes.

§buffer: Buffer

The buffer of decoded data.

§last: Option<(u16, Link)>

The link which we are still decoding and its original code.

§next_code: u16

The next code entry.

§clear_code: u16

Code to reset all tables.

§end_code: u16

Code to signal the end of the stream.

§has_ended: bool

A stored flag if the end code has already appeared.

§is_tiff: bool

If tiff then bumps are a single code sooner.

§implicit_reset: bool

Do we allow stream to start without an explicit reset code?

§code_buffer: CodeBuffer

The buffer for decoded words.

Implementations§

source§

impl<C: CodeBuffer> DecodeState<C>

source

fn new(min_size: u8) -> Self

source

fn init_tables(&mut self)

source

fn reset_tables(&mut self)

source§

impl<C: CodeBuffer> DecodeState<C>

source

fn next_symbol(&mut self, inp: &mut &[u8]) -> Option<u16>

source

fn bump_code_size(&mut self)

source

fn refill_bits(&mut self, inp: &mut &[u8])

source

fn get_bits(&mut self) -> Option<u16>

Trait Implementations§

source§

impl<C: CodeBuffer> Stateful for DecodeState<C>

source§

fn has_ended(&self) -> bool

source§

fn restart(&mut self)

Ignore an end code and continue decoding (no implied reset).
source§

fn reset(&mut self)

Reset the decoder to the beginning, dropping all buffers etc.
source§

fn advance(&mut self, inp: &[u8], out: &mut [u8]) -> BufferResult

Auto Trait Implementations§

§

impl<CodeBuffer> RefUnwindSafe for DecodeState<CodeBuffer>where CodeBuffer: RefUnwindSafe,

§

impl<CodeBuffer> Send for DecodeState<CodeBuffer>where CodeBuffer: Send,

§

impl<CodeBuffer> Sync for DecodeState<CodeBuffer>where CodeBuffer: Sync,

§

impl<CodeBuffer> Unpin for DecodeState<CodeBuffer>where CodeBuffer: Unpin,

§

impl<CodeBuffer> UnwindSafe for DecodeState<CodeBuffer>where CodeBuffer: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.