Struct dsi_bitstream::impls::WordAdapter
source · pub struct WordAdapter<W: UnsignedInt + FromBytes + ToBytes, B> { /* private fields */ }Expand description
An adapter from Read, Write, and Seek, to WordRead,
WordWrite, and WordSeek, respectively.
Instances of this struct can be created using WordAdapter::new. They
turn every standard (possibly seekable) source or destination of bytes (such
as std::fs::File, std::io::BufReader, sockets, etc.) into a source
or destination of words.
Due to the necessity of managing files whose length is not a multiple of the
word length, read_word will return a partially
read word extended with zeros at the end of such files.
To provide a sensible value after such a read,
word_pos will always return the position
of the underlying Seek rounded up to the next multiple of W::Bytes.
This approach, however, requires that if you adapt a Seek, its current position must be
a multiple of W::Bytes, or the results of word_pos
will be shifted by the rounding.
Implementations§
source§impl<W: UnsignedInt + FromBytes + ToBytes, B> WordAdapter<W, B>
impl<W: UnsignedInt + FromBytes + ToBytes, B> WordAdapter<W, B>
pub fn into_inner(self) -> B
Trait Implementations§
source§impl<W: Clone + UnsignedInt + FromBytes + ToBytes, B: Clone> Clone for WordAdapter<W, B>
impl<W: Clone + UnsignedInt + FromBytes + ToBytes, B: Clone> Clone for WordAdapter<W, B>
source§fn clone(&self) -> WordAdapter<W, B>
fn clone(&self) -> WordAdapter<W, B>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more