Trait constriction::Pos

source ·
pub trait Pos: PosSeek {
    // Required method
    fn pos(&self) -> Self::Position;
}
Expand description

A trait for entropy coders that keep track of their current position within the compressed data.

This is the counterpart of Seek. Call Pos::pos to record “snapshots” of an entropy coder, and then call Seek::seek at a later time to jump back to these snapshots. See examples in the documentations of Seek and Seek::seek.

Required Methods§

source

fn pos(&self) -> Self::Position

Returns the position in the compressed data, in units of Words.

It is up to the entropy coder to define what constitutes the beginning and end positions within the compressed data (for example, a AnsCoder begins encoding at position zero but it begins decoding at position ans.buf().len()).

Implementations on Foreign Types§

source§

impl<Array> Pos for SmallVec<Array>
where Array: Array,

source§

fn pos(&self) -> usize

Returns the length of the SmallVec since that’s the current read and write position (SmallVecs, like Vecs, have Stack semantics).

If you have a Vec or SmallVec with name v and your intention is to read to or write from it at arbitrary positions rather than just at the end then you probably want to wrap either v or the slice &v[..] in a Cursor.

source§

impl<Word> Pos for Vec<Word>

source§

fn pos(&self) -> usize

Returns the length of the vector since that’s the current read and write position (vectors have Stack semantics).

If you have a Vec with name v and your intention is to read to or write from it at arbitrary positions rather than just at the end then you probably want to wrap either v or the slice &v[..] in a Cursor.

Implementors§

source§

impl<B: Pos> Pos for Reverse<B>

source§

impl<Word, Buf: AsRef<[Word]>> Pos for Cursor<Word, Buf>

source§

impl<Word, State, Backend> Pos for RangeEncoder<Word, State, Backend>
where Word: BitArray + Into<State>, State: BitArray + AsPrimitive<Word>, Backend: WriteWords<Word> + Pos<Position = usize>,

source§

impl<Word, State, Backend> Pos for AnsCoder<Word, State, Backend>
where Word: BitArray + Into<State>, State: BitArray + AsPrimitive<Word>, Backend: Pos,

source§

impl<Word, State, CompressedBackend, RemaindersBackend, const PRECISION: usize> Pos for ChainCoder<Word, State, CompressedBackend, RemaindersBackend, PRECISION>
where Word: BitArray + Into<State>, State: BitArray + AsPrimitive<Word>, CompressedBackend: Pos, RemaindersBackend: Pos,