Trait constriction::backends::AsReadWords
source · [−]pub trait AsReadWords<'a, Word, S: Semantics>: 'a {
type AsReadWords: ReadWords<Word, S>;
fn as_read_words(&'a self) -> Self::AsReadWords;
}Expand description
A trait for types that can be temporarily used by decoders as a source of compressed data.
This trait is meant for situations where you want to use some data as a source of
Words 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.
Note that, if you want to decode the same compressed data several times then you’ll
probably want to decode different parts of that data each time. In this case, it’s
likely you’ll rather want to use AsSeekReadWords.
See also
- module level documentation for more information on the concept of sources and sinks of compressed data;
IntoReadWordsfor a simliar conversion that takes ownership of the data;AsSeekReadWordsfor a conversion with stronger guarantees.
Required Associated Types
sourcetype AsReadWords: ReadWords<Word, S>
type AsReadWords: ReadWords<Word, S>
The type of the data source as which the original type can be used.
Required Methods
sourcefn as_read_words(&'a self) -> Self::AsReadWords
fn as_read_words(&'a self) -> Self::AsReadWords
Performs the (temporary) conversion.