pub struct BitWriter {
pub buffer: Vec<u8>,
pub bit_pos: usize,
}Expand description
Bit-level writer: packs bits into a Vec<u8>.
Fields§
§buffer: Vec<u8>§bit_pos: usizeImplementations§
Source§impl BitWriter
impl BitWriter
Sourcepub fn with_capacity(bytes: usize) -> Self
pub fn with_capacity(bytes: usize) -> Self
Create a new writer with pre-allocated capacity (in bytes).
Sourcepub fn write_bits(&mut self, value: u32, num_bits: u8)
pub fn write_bits(&mut self, value: u32, num_bits: u8)
Write num_bits least-significant bits of value to the stream,
MSB first (big-endian bit order within each code word).
Sourcepub fn total_bits(&self) -> usize
pub fn total_bits(&self) -> usize
Total number of bits written so far.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BitWriter
impl RefUnwindSafe for BitWriter
impl Send for BitWriter
impl Sync for BitWriter
impl Unpin for BitWriter
impl UnsafeUnpin for BitWriter
impl UnwindSafe for BitWriter
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