Skip to main content

RansByteDecoder

Struct RansByteDecoder 

Source
pub struct RansByteDecoder<Sr>
where Sr: Source<u8>,
{ /* private fields */ }
Expand description

Re-export the core rANS primitives. Raw rANS decoder.

Implementations§

Source§

impl<Sr> RansByteDecoder<Sr>
where Sr: Source<u8>,

Source

pub fn new(source: Sr) -> RansByteDecoder<Sr>

Source

pub fn source(&self) -> &Sr

Source

pub fn source_mut(&mut self) -> &mut Sr

Source

pub fn into_source(self) -> Sr

Source

pub fn state(&self) -> u32

Source

pub fn check_eof(&self) -> bool

Source

pub fn init(&mut self) -> bool

Initialize the decoder by reading the initial state from the source.

Source

pub fn get(&self, scale_bits: u32) -> u32

Get the next symbol frequency (low scale_bits of state).

Source

pub fn advance(&mut self, start: u32, freq: u32, scale_bits: u32) -> bool

Advance the decoder past a symbol.

Uses transactional state: computes into a local variable and only assigns to self.state after renormalization succeeds.

Equivalent to: RansDecoder::Advance(start, freq, scale_bits).

Source

pub fn advance_symbol( &mut self, symbol: &RansByteDecSymbol, scale_bits: u32, ) -> bool

Advance using a prepared decoder symbol.

Trait Implementations§

Source§

impl<Sr> Debug for RansByteDecoder<Sr>
where Sr: Debug + Source<u8>,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Sr> Freeze for RansByteDecoder<Sr>
where Sr: Freeze,

§

impl<Sr> RefUnwindSafe for RansByteDecoder<Sr>
where Sr: RefUnwindSafe,

§

impl<Sr> Send for RansByteDecoder<Sr>
where Sr: Send,

§

impl<Sr> Sync for RansByteDecoder<Sr>
where Sr: Sync,

§

impl<Sr> Unpin for RansByteDecoder<Sr>
where Sr: Unpin,

§

impl<Sr> UnsafeUnpin for RansByteDecoder<Sr>
where Sr: UnsafeUnpin,

§

impl<Sr> UnwindSafe for RansByteDecoder<Sr>
where Sr: UnwindSafe,

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.