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
impl<'a, Word: Clone + 'a, Buf: SafeBuf<Word> + 'a> AsReadWords<'a, Word, Stack> for Buf
§type AsReadWords = Cursor<Word, &'a [Word]>
type AsReadWords = Cursor<Word, &'a [Word]>
source§fn as_read_words(&'a self) -> Self::AsReadWords
fn as_read_words(&'a self) -> Self::AsReadWords
source§impl<Array> BoundedReadWords<<Array as Array>::Item, Stack> for SmallVec<Array>where
Array: Array,
impl<Array> BoundedReadWords<<Array as Array>::Item, Stack> for SmallVec<Array>where
Array: Array,
source§impl<Word, B: BoundedReadWords<Word, Queue>> BoundedReadWords<Word, Stack> for Reverse<B>
impl<Word, B: BoundedReadWords<Word, Queue>> BoundedReadWords<Word, Stack> for Reverse<B>
source§impl<Word> BoundedReadWords<Word, Stack> for Vec<Word>
impl<Word> BoundedReadWords<Word, Stack> for Vec<Word>
source§impl<Word: Clone, Buf: SafeBuf<Word>> IntoReadWords<Word, Stack> for Buf
impl<Word: Clone, Buf: SafeBuf<Word>> IntoReadWords<Word, Stack> for Buf
§type IntoReadWords = Cursor<Word, Buf>
type IntoReadWords = Cursor<Word, Buf>
source§fn into_read_words(self) -> Self::IntoReadWords
fn into_read_words(self) -> Self::IntoReadWords
source§impl<Word: BitArray, B: ReadWords<Word, Stack>> ReadBitStream<Stack> for StackCoder<Word, B>
impl<Word: BitArray, B: ReadWords<Word, Stack>> ReadBitStream<Stack> for StackCoder<Word, B>
type ReadError = <B as ReadWords<Word, Stack>>::ReadError
fn decode_symbol<C: DecoderCodebook>( &mut self, codebook: C ) -> Result<C::Symbol, CoderError<SymbolCodeError<C::InvalidCodeword>, Self::ReadError>>
fn read_bit(&mut self) -> Result<Option<bool>, Self::ReadError>
fn decode_symbols<'s, I, C>(
&'s mut self,
codebooks: I
) -> DecodeSymbols<'s, Self, I, S> ⓘwhere
I: IntoIterator<Item = C> + 's,
C: DecoderCodebook,
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,
impl<Array> ReadWords<<Array as Array>::Item, Stack> for SmallVec<Array>where
Array: Array,
§type ReadError = Infallible
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>
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
fn maybe_exhausted(&self) -> bool
true
if the data source could be out of data. Read moresource§impl<Word: Clone, Buf: SafeBuf<Word>> ReadWords<Word, Stack> for Cursor<Word, Buf>
impl<Word: Clone, Buf: SafeBuf<Word>> ReadWords<Word, Stack> for Cursor<Word, Buf>
§type ReadError = Infallible
type ReadError = Infallible
Infallible
. Read moresource§fn read(&mut self) -> Result<Option<Word>, Self::ReadError>
fn read(&mut self) -> Result<Option<Word>, Self::ReadError>
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 moresource§fn maybe_exhausted(&self) -> bool
fn maybe_exhausted(&self) -> bool
true
if the data source could be out of data. Read moresource§impl<Word, B: ReadWords<Word, Queue>> ReadWords<Word, Stack> for Reverse<B>
impl<Word, B: ReadWords<Word, Queue>> ReadWords<Word, Stack> for Reverse<B>
§type ReadError = <B as ReadWords<Word, Queue>>::ReadError
type ReadError = <B as ReadWords<Word, Queue>>::ReadError
Infallible
. Read moresource§fn read(&mut self) -> Result<Option<Word>, Self::ReadError>
fn read(&mut self) -> Result<Option<Word>, Self::ReadError>
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 moresource§fn maybe_exhausted(&self) -> bool
fn maybe_exhausted(&self) -> bool
true
if the data source could be out of data. Read moresource§impl<Word> ReadWords<Word, Stack> for Vec<Word>
impl<Word> ReadWords<Word, Stack> for Vec<Word>
§type ReadError = Infallible
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>
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
fn maybe_exhausted(&self) -> bool
true
if the data source could be out of data. Read more