Trait constriction::Pos

source ·
pub trait Pos: PosSeek {
    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§

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§

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.

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.

Implementors§