Struct dsi_bitstream::impls::MemWordWriterVec
source · pub struct MemWordWriterVec<W: UnsignedInt, B: AsMut<Vec<W>>> { /* private fields */ }
Expand description
An implementation of WordRead
, WordWrite
, and WordSeek
for a mutable vector.
The vector will be extended as new data is written.
Example
use dsi_bitstream::prelude::*;
let mut words: Vec<u64> = vec![
0x0043b59fcdf16077,
];
let mut word_writer = MemWordWriterVec::new(&mut words);
// the stream is read sequentially
assert_eq!(word_writer.get_word_pos().unwrap(), 0);
assert!(word_writer.write_word(0).is_ok());
assert_eq!(word_writer.get_word_pos().unwrap(), 1);
assert!(word_writer.write_word(1).is_ok());
assert_eq!(word_writer.get_word_pos().unwrap(), 2);
Implementations§
Trait Implementations§
source§impl<W: Debug + UnsignedInt, B: Debug + AsMut<Vec<W>>> Debug for MemWordWriterVec<W, B>
impl<W: Debug + UnsignedInt, B: Debug + AsMut<Vec<W>>> Debug for MemWordWriterVec<W, B>
source§impl<W: PartialEq + UnsignedInt, B: PartialEq + AsMut<Vec<W>>> PartialEq for MemWordWriterVec<W, B>
impl<W: PartialEq + UnsignedInt, B: PartialEq + AsMut<Vec<W>>> PartialEq for MemWordWriterVec<W, B>
source§fn eq(&self, other: &MemWordWriterVec<W, B>) -> bool
fn eq(&self, other: &MemWordWriterVec<W, B>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<W: UnsignedInt, B: AsMut<Vec<W>>> WordRead for MemWordWriterVec<W, B>
impl<W: UnsignedInt, B: AsMut<Vec<W>>> WordRead for MemWordWriterVec<W, B>
source§impl<W: UnsignedInt, B: AsMut<Vec<W>> + AsRef<Vec<W>>> WordSeek for MemWordWriterVec<W, B>
impl<W: UnsignedInt, B: AsMut<Vec<W>> + AsRef<Vec<W>>> WordSeek for MemWordWriterVec<W, B>
source§impl<W: UnsignedInt, B: AsMut<Vec<W>>> WordWrite for MemWordWriterVec<W, B>
impl<W: UnsignedInt, B: AsMut<Vec<W>>> WordWrite for MemWordWriterVec<W, B>
type Error = Infallible
§type Word = W
type Word = W
The word type (the type of the argument of
WordWrite::write_word
).source§fn write_word(&mut self, word: W) -> Result<(), Infallible>
fn write_word(&mut self, word: W) -> Result<(), Infallible>
Write a word and advance the current position.
impl<W: UnsignedInt, B: AsMut<Vec<W>>> StructuralPartialEq for MemWordWriterVec<W, B>
Auto Trait Implementations§
impl<W, B> RefUnwindSafe for MemWordWriterVec<W, B>where
B: RefUnwindSafe,
W: RefUnwindSafe,
impl<W, B> Send for MemWordWriterVec<W, B>where
B: Send,
impl<W, B> Sync for MemWordWriterVec<W, B>where
B: Sync,
impl<W, B> Unpin for MemWordWriterVec<W, B>
impl<W, B> UnwindSafe for MemWordWriterVec<W, B>where
B: UnwindSafe,
W: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Truncate the current UnsignedInt to a possibly smaller size
source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
source§impl<T> UpcastableFrom<T> for T
impl<T> UpcastableFrom<T> for T
source§fn upcast_from(value: T) -> T
fn upcast_from(value: T) -> T
Extend the current UnsignedInt to a possibly bigger size.