Skip to main content

Source

Trait Source 

Source
pub trait Source<Unit>: Sized {
    // Required methods
    fn read(&mut self, unit: &mut Unit) -> bool;
    fn is_exhausted(&self) -> bool;
}
Expand description

Trait for a source that provides rANS units to the decoder.

Equivalent to the operator(unit_t&) call on the C++ source type, simplified to a bool return since the decoder uses boolean outcomes.

Required Methods§

Source

fn read(&mut self, unit: &mut Unit) -> bool

Read the next unit from the source. Returns true if a unit was available, false if exhausted.

Source

fn is_exhausted(&self) -> bool

Check whether the source has been fully consumed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, Unit> Source<Unit> for SliceSource<'a, Unit>
where Unit: Copy,