pub struct MemWordWriterVec<W: Word, 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.word_pos()?, 0);
assert!(word_writer.write_word(0).is_ok());
assert_eq!(word_writer.word_pos()?, 1);
assert!(word_writer.write_word(1).is_ok());
assert_eq!(word_writer.word_pos()?, 2);
Implementations§
Trait Implementations§
Source§impl<W: Word, B> CopyType for MemWordWriterVec<W, B>
impl<W: Word, B> CopyType for MemWordWriterVec<W, B>
Source§impl<W: Word, B> MemDbgImpl for MemWordWriterVec<W, B>
impl<W: Word, B> MemDbgImpl for MemWordWriterVec<W, B>
fn _mem_dbg_rec_on( &self, _memdbg_writer: &mut impl Write, _memdbg_total_size: usize, _memdbg_max_depth: usize, _memdbg_prefix: &mut String, _memdbg_is_last: bool, _memdbg_flags: DbgFlags, ) -> Result
fn _mem_dbg_depth_on( &self, writer: &mut impl Write, total_size: usize, max_depth: usize, prefix: &mut String, field_name: Option<&str>, is_last: bool, padded_size: usize, flags: DbgFlags, ) -> Result<(), Error>
Source§impl<W: Word, B> MemSize for MemWordWriterVec<W, B>
impl<W: Word, B> MemSize for MemWordWriterVec<W, B>
Source§impl<W: Word, B: AsMut<Vec<W>>> WordWrite for MemWordWriterVec<W, B>
impl<W: Word, B: AsMut<Vec<W>>> WordWrite for MemWordWriterVec<W, B>
type Error = Infallible
Source§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: Word, B: AsMut<Vec<W>>> StructuralPartialEq for MemWordWriterVec<W, B>
Auto Trait Implementations§
impl<W, B> Freeze for MemWordWriterVec<W, B>where
B: Freeze,
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> MemDbg for Twhere
T: MemDbgImpl,
impl<T> MemDbg for Twhere
T: MemDbgImpl,
Source§fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
Writes to stderr debug infos about the structure memory usage, expanding
all levels of nested structures.
Source§fn mem_dbg_on(
&self,
writer: &mut impl Write,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags, ) -> Result<(), Error>
Writes to a
core::fmt::Write
debug infos about the structure memory
usage, expanding all levels of nested structures.Source§fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
Writes to stderr debug infos about the structure memory usage as
mem_dbg
, but expanding only up to max_depth
levels of nested structures.Source§fn mem_dbg_depth_on(
&self,
writer: &mut impl Write,
max_depth: usize,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_depth_on( &self, writer: &mut impl Write, max_depth: usize, flags: DbgFlags, ) -> Result<(), Error>
Writes to a
core::fmt::Write
debug infos about the structure memory
usage as mem_dbg_on
, but expanding only up to
max_depth
levels of nested structures.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.