Struct constriction::Stack

source ·
pub struct Stack {}
Expand description

Zero sized marker struct for last-in-first-out read/write Semantics

This type typically only comes up in advanced use cases that are generic over read/write semantics. If you are looking for an entropy coder that operates as a stack, check out the module stream::stack.

Trait Implementations§

source§

impl<'a, Word: Clone + 'a, Buf: SafeBuf<Word> + 'a> AsReadWords<'a, Word, Stack> for Buf

§

type AsReadWords = Cursor<Word, &'a [Word]>

The type of the data source as which the original type can be used.
source§

fn as_read_words(&'a self) -> Self::AsReadWords

Performs the (temporary) conversion.
source§

impl<Array> BoundedReadWords<<Array as Array>::Item, Stack> for SmallVec<Array>
where Array: Array,

source§

fn remaining(&self) -> usize

Returns the number of Words that are left for reading. Read more
source§

fn is_exhausted(&self) -> bool

Whether or not there is no data left to read. Read more
source§

impl<Word: Clone, Buf: SafeBuf<Word>> BoundedReadWords<Word, Stack> for Cursor<Word, Buf>

source§

fn remaining(&self) -> usize

Returns the number of Words that are left for reading. Read more
source§

fn is_exhausted(&self) -> bool

Whether or not there is no data left to read. Read more
source§

impl<Word, B: BoundedReadWords<Word, Queue>> BoundedReadWords<Word, Stack> for Reverse<B>

source§

fn remaining(&self) -> usize

Returns the number of Words that are left for reading. Read more
source§

fn is_exhausted(&self) -> bool

Whether or not there is no data left to read. Read more
source§

impl<Word> BoundedReadWords<Word, Stack> for Vec<Word>

source§

fn remaining(&self) -> usize

Returns the number of Words that are left for reading. Read more
source§

fn is_exhausted(&self) -> bool

Whether or not there is no data left to read. Read more
source§

impl Debug for Stack

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Stack

source§

fn default() -> Stack

Returns the “default value” for a type. Read more
source§

impl<Word: Clone, Buf: SafeBuf<Word>> IntoReadWords<Word, Stack> for Buf

§

type IntoReadWords = Cursor<Word, Buf>

The type of the data source that will result from the conversion.
source§

fn into_read_words(self) -> Self::IntoReadWords

Performs the conversion.
source§

impl<Word: BitArray, B: ReadWords<Word, Stack>> ReadBitStream<Stack> for StackCoder<Word, B>

§

type ReadError = <B as ReadWords<Word, Stack>>::ReadError

source§

fn decode_symbol<C: DecoderCodebook>( &mut self, codebook: C ) -> Result<C::Symbol, CoderError<SymbolCodeError<C::InvalidCodeword>, Self::ReadError>>

source§

fn read_bit(&mut self) -> Result<Option<bool>, Self::ReadError>

source§

fn decode_symbols<'s, I, C>( &'s mut self, codebooks: I ) -> DecodeSymbols<'s, Self, I, S>
where I: IntoIterator<Item = C> + 's, C: DecoderCodebook,

source§

fn decode_iid_symbols<'a, C>( &'a mut self, amt: usize, codebook: &'a C ) -> DecodeSymbols<'a, Self, Take<Repeat<&'a C>>, S>
where C: DecoderCodebook,

source§

impl<Array> ReadWords<<Array as Array>::Item, Stack> for SmallVec<Array>
where Array: Array,

§

type ReadError = Infallible

The only way how reading from a vector can fail is if the vector is empty, but that’s not considered an error (it returns Ok(None) instead).

source§

fn read(&mut self) -> Result<Option<Array::Item>, Self::ReadError>

Pops the word off the end of the vector (= top of the stack). If you instead want to keep the data unchanged (e.g., because you want to reuse it later) then wrap either the vector v or or the slice &v[..] in a Cursor.

source§

fn maybe_exhausted(&self) -> bool

Returns true if the data source could be out of data. Read more
source§

impl<Word: Clone, Buf: SafeBuf<Word>> ReadWords<Word, Stack> for Cursor<Word, Buf>

§

type ReadError = Infallible

The error type that can occur when reading from the data source, or Infallible. Read more
source§

fn read(&mut self) -> Result<Option<Word>, Self::ReadError>

Reads a single Word from the data source and advances the state of the data source accordingly (i.e., so that the next read won’t read the same Word again). Read more
source§

fn maybe_exhausted(&self) -> bool

Returns true if the data source could be out of data. Read more
source§

impl<Word, B: ReadWords<Word, Queue>> ReadWords<Word, Stack> for Reverse<B>

§

type ReadError = <B as ReadWords<Word, Queue>>::ReadError

The error type that can occur when reading from the data source, or Infallible. Read more
source§

fn read(&mut self) -> Result<Option<Word>, Self::ReadError>

Reads a single Word from the data source and advances the state of the data source accordingly (i.e., so that the next read won’t read the same Word again). Read more
source§

fn maybe_exhausted(&self) -> bool

Returns true if the data source could be out of data. Read more
source§

impl<Word> ReadWords<Word, Stack> for Vec<Word>

§

type ReadError = Infallible

The only way how reading from a vector can fail is if the vector is empty, but that’s not considered an error (it returns Ok(None) instead).

source§

fn read(&mut self) -> Result<Option<Word>, Self::ReadError>

Pops the word off the end of the vector (= top of the stack). If you instead want to keep the data unchanged (e.g., because you want to reuse it later) then wrap either the vector v or or the slice &v[..] in a Cursor.

source§

fn maybe_exhausted(&self) -> bool

Returns true if the data source could be out of data. Read more
source§

impl<Word: BitArray, B: WriteWords<Word>> WriteBitStream<Stack> for StackCoder<Word, B>

§

type WriteError = <B as WriteWords<Word>>::WriteError

source§

fn write_bit(&mut self, bit: bool) -> Result<(), Self::WriteError>

source§

fn encode_symbol<Symbol, C>( &mut self, symbol: Symbol, codebook: C ) -> Result<(), CoderError<DefaultEncoderFrontendError, Self::WriteError>>
where Symbol: Borrow<C::Symbol>, C: EncoderCodebook,

source§

fn encode_symbols<Symbol, C>( &mut self, symbols_and_codebooks: impl IntoIterator<Item = (Symbol, C)> ) -> Result<(), CoderError<DefaultEncoderFrontendError, Self::WriteError>>
where C: EncoderCodebook, Symbol: Borrow<C::Symbol>,

source§

fn encode_iid_symbols<Symbol, C>( &mut self, symbols: impl IntoIterator<Item = Symbol>, codebook: &C ) -> Result<(), CoderError<DefaultEncoderFrontendError, Self::WriteError>>
where C: EncoderCodebook, Symbol: Borrow<C::Symbol>,

source§

impl Semantics for Stack

Auto Trait Implementations§

§

impl RefUnwindSafe for Stack

§

impl Send for Stack

§

impl Sync for Stack

§

impl Unpin for Stack

§

impl UnwindSafe for Stack

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>,

§

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>,

§

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.