Struct constriction::stream::queue::RangeDecoder [−][src]
pub struct RangeDecoder<Word, State, Backend> where
Word: BitArray,
State: BitArray,
Backend: ReadWords<Word, Queue>, { /* fields omitted */ }Implementations
impl<Word, State, Backend> RangeDecoder<Word, State, Backend> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: ReadWords<Word, Queue>, [src]
impl<Word, State, Backend> RangeDecoder<Word, State, Backend> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: ReadWords<Word, Queue>, [src]pub fn from_compressed<Buf>(compressed: Buf) -> Result<Self, Backend::ReadError> where
Buf: IntoReadWords<Word, Queue, IntoReadWords = Backend>, [src]
Buf: IntoReadWords<Word, Queue, IntoReadWords = Backend>,
pub fn with_backend(backend: Backend) -> Result<Self, Backend::ReadError>[src]
pub fn for_compressed<'a, Buf>(
compressed: &'a Buf
) -> Result<Self, Backend::ReadError> where
Buf: AsReadWords<'a, Word, Queue, AsReadWords = Backend>, [src]
compressed: &'a Buf
) -> Result<Self, Backend::ReadError> where
Buf: AsReadWords<'a, Word, Queue, AsReadWords = Backend>,
pub fn from_raw_parts(
_bulk: Backend,
_state: State
) -> Result<Self, (Backend, RangeCoderState<Word, State>)>[src]
_bulk: Backend,
_state: State
) -> Result<Self, (Backend, RangeCoderState<Word, State>)>
pub fn into_raw_parts(self) -> (Backend, RangeCoderState<Word, State>)[src]
pub fn maybe_exhausted(&self) -> bool[src]
pub fn maybe_exhausted(&self) -> bool[src]Same as Decoder::maybe_exhausted, but can be called on a concrete type without
type annotations.
Trait Implementations
impl<Word, State, Backend> Code for RangeDecoder<Word, State, Backend> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: ReadWords<Word, Queue>, [src]
impl<Word, State, Backend> Code for RangeDecoder<Word, State, Backend> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: ReadWords<Word, Queue>, [src]type State = RangeCoderState<Word, State>
type State = RangeCoderState<Word, State>type Word = Word
type Word = WordThe smallest unit of compressed data that this coder can emit or read at once. Most
coders guarantee that encoding emits at most one Word per symbol (plus a constant
overhead). Read more
impl<Word: Debug, State: Debug, Backend: Debug> Debug for RangeDecoder<Word, State, Backend> where
Word: BitArray,
State: BitArray,
Backend: ReadWords<Word, Queue>, [src]
impl<Word: Debug, State: Debug, Backend: Debug> Debug for RangeDecoder<Word, State, Backend> where
Word: BitArray,
State: BitArray,
Backend: ReadWords<Word, Queue>, [src]impl<Word, State, Backend, const PRECISION: usize> Decode<PRECISION> for RangeDecoder<Word, State, Backend> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: ReadWords<Word, Queue>, [src]
impl<Word, State, Backend, const PRECISION: usize> Decode<PRECISION> for RangeDecoder<Word, State, Backend> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: ReadWords<Word, Queue>, [src]fn decode_symbol<D>(
&mut self,
model: D
) -> Result<D::Symbol, CoderError<Self::FrontendError, Self::BackendError>> where
D: DecoderModel<PRECISION>,
D::Probability: Into<Self::Word>,
Self::Word: AsPrimitive<D::Probability>, [src]
fn decode_symbol<D>(
&mut self,
model: D
) -> Result<D::Symbol, CoderError<Self::FrontendError, Self::BackendError>> where
D: DecoderModel<PRECISION>,
D::Probability: Into<Self::Word>,
Self::Word: AsPrimitive<D::Probability>, [src]Decodes a single symbol and pops it off the compressed data.
This is a low level method. You usually probably want to call a batch method
like decode_symbols or
decode_iid_symbols instead.
This method is called decode_symbol rather than decode_symbol to stress the
fact that the Coder is a stack: decode_symbol will return the last symbol
that was previously encoded via encode_symbol.
Note that this method cannot fail. It will still produce symbols in a deterministic way even if the coder is empty, but such symbols will not recover any previously encoded data and will generally have low entropy. Still, being able to pop off an arbitrary number of symbols can sometimes be useful in edge cases of, e.g., the bits-back algorithm.
type FrontendError = DecoderFrontendError
type FrontendError = DecoderFrontendErrorThe error type for logical decoding errors. Read more
type BackendError = Backend::ReadError
type BackendError = Backend::ReadErrorThe error type for reading in encoded data. Read more
fn maybe_exhausted(&self) -> bool[src]
fn maybe_exhausted(&self) -> bool[src]Checks if there might be no compressed data left for decoding. Read more
fn decode_symbols<'s, I, M>(
&'s mut self,
models: I
) -> DecodeSymbols<'s, Self, I::IntoIter, PRECISION>ⓘNotable traits for DecodeSymbols<'a, Decoder, I, PRECISION>
impl<'a, Decoder, I, D, const PRECISION: usize> Iterator for DecodeSymbols<'a, Decoder, I, PRECISION> where
Decoder: Decode<PRECISION>,
I: Iterator<Item = D>,
D: DecoderModel<PRECISION>,
Decoder::Word: AsPrimitive<D::Probability>,
D::Probability: Into<Decoder::Word>, type Item = Result<<I::Item as EntropyModel<PRECISION>>::Symbol, CoderError<Decoder::FrontendError, Decoder::BackendError>>; where
I: IntoIterator<Item = M> + 's,
M: DecoderModel<PRECISION>,
M::Probability: Into<Self::Word>,
Self::Word: AsPrimitive<M::Probability>, [src]
fn decode_symbols<'s, I, M>(
&'s mut self,
models: I
) -> DecodeSymbols<'s, Self, I::IntoIter, PRECISION>ⓘNotable traits for DecodeSymbols<'a, Decoder, I, PRECISION>
impl<'a, Decoder, I, D, const PRECISION: usize> Iterator for DecodeSymbols<'a, Decoder, I, PRECISION> where
Decoder: Decode<PRECISION>,
I: Iterator<Item = D>,
D: DecoderModel<PRECISION>,
Decoder::Word: AsPrimitive<D::Probability>,
D::Probability: Into<Decoder::Word>, type Item = Result<<I::Item as EntropyModel<PRECISION>>::Symbol, CoderError<Decoder::FrontendError, Decoder::BackendError>>; where
I: IntoIterator<Item = M> + 's,
M: DecoderModel<PRECISION>,
M::Probability: Into<Self::Word>,
Self::Word: AsPrimitive<M::Probability>, [src]Decodes a sequence of symbols, using an individual entropy model for each symbol. Read more
fn try_decode_symbols<'s, I, M, E>(
&'s mut self,
models: I
) -> TryDecodeSymbols<'s, Self, I::IntoIter, PRECISION>ⓘNotable traits for TryDecodeSymbols<'a, Decoder, I, PRECISION>
impl<'a, Decoder, I, D, E, const PRECISION: usize> Iterator for TryDecodeSymbols<'a, Decoder, I, PRECISION> where
Decoder: Decode<PRECISION>,
I: Iterator<Item = Result<D, E>>,
D: DecoderModel<PRECISION>,
Decoder::Word: AsPrimitive<D::Probability>,
D::Probability: Into<Decoder::Word>, type Item = Result<D::Symbol, TryCodingError<CoderError<Decoder::FrontendError, Decoder::BackendError>, E>>; where
I: IntoIterator<Item = Result<M, E>> + 's,
M: DecoderModel<PRECISION>,
M::Probability: Into<Self::Word>,
Self::Word: AsPrimitive<M::Probability>, [src]
fn try_decode_symbols<'s, I, M, E>(
&'s mut self,
models: I
) -> TryDecodeSymbols<'s, Self, I::IntoIter, PRECISION>ⓘNotable traits for TryDecodeSymbols<'a, Decoder, I, PRECISION>
impl<'a, Decoder, I, D, E, const PRECISION: usize> Iterator for TryDecodeSymbols<'a, Decoder, I, PRECISION> where
Decoder: Decode<PRECISION>,
I: Iterator<Item = Result<D, E>>,
D: DecoderModel<PRECISION>,
Decoder::Word: AsPrimitive<D::Probability>,
D::Probability: Into<Decoder::Word>, type Item = Result<D::Symbol, TryCodingError<CoderError<Decoder::FrontendError, Decoder::BackendError>, E>>; where
I: IntoIterator<Item = Result<M, E>> + 's,
M: DecoderModel<PRECISION>,
M::Probability: Into<Self::Word>,
Self::Word: AsPrimitive<M::Probability>, [src]Decodes a sequence of symbols from a fallible iterator over entropy models. Read more
fn decode_iid_symbols<M>(
&mut self,
amt: usize,
model: M
) -> DecodeIidSymbols<'_, Self, M, PRECISION>ⓘNotable traits for DecodeIidSymbols<'a, Decoder, M, PRECISION>
impl<'a, Decoder, M, const PRECISION: usize> Iterator for DecodeIidSymbols<'a, Decoder, M, PRECISION> where
Decoder: Decode<PRECISION>,
M: DecoderModel<PRECISION> + Copy,
Decoder::Word: AsPrimitive<M::Probability>,
M::Probability: Into<Decoder::Word>, type Item = Result<M::Symbol, CoderError<Decoder::FrontendError, Decoder::BackendError>>; where
M: DecoderModel<PRECISION> + Copy,
M::Probability: Into<Self::Word>,
Self::Word: AsPrimitive<M::Probability>, [src]
fn decode_iid_symbols<M>(
&mut self,
amt: usize,
model: M
) -> DecodeIidSymbols<'_, Self, M, PRECISION>ⓘNotable traits for DecodeIidSymbols<'a, Decoder, M, PRECISION>
impl<'a, Decoder, M, const PRECISION: usize> Iterator for DecodeIidSymbols<'a, Decoder, M, PRECISION> where
Decoder: Decode<PRECISION>,
M: DecoderModel<PRECISION> + Copy,
Decoder::Word: AsPrimitive<M::Probability>,
M::Probability: Into<Decoder::Word>, type Item = Result<M::Symbol, CoderError<Decoder::FrontendError, Decoder::BackendError>>; where
M: DecoderModel<PRECISION> + Copy,
M::Probability: Into<Self::Word>,
Self::Word: AsPrimitive<M::Probability>, [src]Decodes amt symbols using the same entropy model for all symbols. Read more
impl<Word, State, Backend> From<RangeEncoder<Word, State, Backend>> for RangeDecoder<Word, State, Backend::IntoReadWords> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: WriteWords<Word> + IntoReadWords<Word, Queue>, [src]
impl<Word, State, Backend> From<RangeEncoder<Word, State, Backend>> for RangeDecoder<Word, State, Backend::IntoReadWords> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: WriteWords<Word> + IntoReadWords<Word, Queue>, [src]fn from(encoder: RangeEncoder<Word, State, Backend>) -> Self[src]
fn from(encoder: RangeEncoder<Word, State, Backend>) -> Self[src]Performs the conversion.
impl<Word, State, Backend> PosSeek for RangeDecoder<Word, State, Backend> where
Word: BitArray,
State: BitArray,
Backend: ReadWords<Word, Queue>,
Backend: PosSeek,
Self: Code, [src]
impl<Word, State, Backend> PosSeek for RangeDecoder<Word, State, Backend> where
Word: BitArray,
State: BitArray,
Backend: ReadWords<Word, Queue>,
Backend: PosSeek,
Self: Code, [src]impl<Word, State, Backend> Seek for RangeDecoder<Word, State, Backend> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: ReadWords<Word, Queue> + Seek, [src]
impl<Word, State, Backend> Seek for RangeDecoder<Word, State, Backend> where
Word: BitArray + Into<State>,
State: BitArray + AsPrimitive<Word>,
Backend: ReadWords<Word, Queue> + Seek, [src]Auto Trait Implementations
impl<Word, State, Backend> RefUnwindSafe for RangeDecoder<Word, State, Backend> where
Backend: RefUnwindSafe,
State: RefUnwindSafe,
Word: RefUnwindSafe,
<State as BitArray>::NonZero: RefUnwindSafe,
Backend: RefUnwindSafe,
State: RefUnwindSafe,
Word: RefUnwindSafe,
<State as BitArray>::NonZero: RefUnwindSafe,
impl<Word, State, Backend> Send for RangeDecoder<Word, State, Backend> where
Backend: Send,
State: Send,
Word: Send,
<State as BitArray>::NonZero: Send,
Backend: Send,
State: Send,
Word: Send,
<State as BitArray>::NonZero: Send,
impl<Word, State, Backend> Sync for RangeDecoder<Word, State, Backend> where
Backend: Sync,
State: Sync,
Word: Sync,
<State as BitArray>::NonZero: Sync,
Backend: Sync,
State: Sync,
Word: Sync,
<State as BitArray>::NonZero: Sync,
impl<Word, State, Backend> Unpin for RangeDecoder<Word, State, Backend> where
Backend: Unpin,
State: Unpin,
Word: Unpin,
<State as BitArray>::NonZero: Unpin,
Backend: Unpin,
State: Unpin,
Word: Unpin,
<State as BitArray>::NonZero: Unpin,
impl<Word, State, Backend> UnwindSafe for RangeDecoder<Word, State, Backend> where
Backend: UnwindSafe,
State: UnwindSafe,
Word: UnwindSafe,
<State as BitArray>::NonZero: UnwindSafe,
Backend: UnwindSafe,
State: UnwindSafe,
Word: UnwindSafe,
<State as BitArray>::NonZero: UnwindSafe,