Trait constriction::backends::AsSeekReadWords
source · pub trait AsSeekReadWords<'a, Word, S: Semantics>: 'a {
type AsSeekReadWords: Seek + ReadWords<Word, S>;
// Required method
fn as_seek_read_words(&'a self) -> Self::AsSeekReadWords;
}
Expand description
A trait for types that can be temporarily used by random-access decoders as a source of compressed data.
This trait is meant for situations where you want to use some data as a source of
Word
s without consuming it. This allows you to decode the same compressed data several
times but it means that you typically won’t be allowed to return the resulting data
source or any entropy coder that wraps it from the current function because it doesn’t
take ownership of the data. If you want to take ownership of the data, use
IntoReadWords
instead.
This trait is similar to AsReadWords
but it adds the additional guarantee that the
resulting data source implements Seek
, i.e., that it can be used by decoders that
support random access. This is likely what you want if you’re going to construct several
decoders for the same compressed data because why would you want decode the whole data
several times?
§See also
- module level documentation for more information on the concept of sources and sinks of compressed data;
IntoSeekReadWords
for a simliar conversion that takes ownership of the data;
Required Associated Types§
sourcetype AsSeekReadWords: Seek + ReadWords<Word, S>
type AsSeekReadWords: Seek + ReadWords<Word, S>
The type of the random-access data source as which the original type can be used.
Required Methods§
sourcefn as_seek_read_words(&'a self) -> Self::AsSeekReadWords
fn as_seek_read_words(&'a self) -> Self::AsSeekReadWords
Performs the (temporary) conversion.