pub struct BitWriter { /* private fields */ }Implementations§
Source§impl BitWriter
impl BitWriter
pub fn new() -> Self
Sourcepub fn write_bits(&mut self, value: u64, count: u8)
pub fn write_bits(&mut self, value: u64, count: u8)
Write count bits from value, LSB first.
Sourcepub fn write_bool(&mut self, v: bool)
pub fn write_bool(&mut self, v: bool)
Write a single boolean as 1 bit.
Sourcepub fn flush_to_byte_boundary(&mut self)
pub fn flush_to_byte_boundary(&mut self)
Flush any partial byte to the buffer.
Special case per spec §4.1: if nothing has been written at all (bit_offset == 0 AND buf is empty), push a zero byte anyway. If bit_offset == 0 and buf is non-empty, this is a no-op.
pub fn write_u8(&mut self, v: u8)
pub fn write_u16(&mut self, v: u16)
pub fn write_u32(&mut self, v: u32)
pub fn write_u64(&mut self, v: u64)
pub fn write_i8(&mut self, v: i8)
pub fn write_i16(&mut self, v: i16)
pub fn write_i32(&mut self, v: i32)
pub fn write_i64(&mut self, v: i64)
Sourcepub fn write_leb128(&mut self, v: u64)
pub fn write_leb128(&mut self, v: u64)
Write a LEB128-encoded unsigned integer.
Sourcepub fn write_zigzag(&mut self, v: i64, type_bits: u8)
pub fn write_zigzag(&mut self, v: i64, type_bits: u8)
Write a ZigZag + LEB128 encoded signed integer.
Sourcepub fn write_string(&mut self, s: &str)
pub fn write_string(&mut self, s: &str)
Write a UTF-8 string with a LEB128 length prefix.
Sourcepub fn write_bytes(&mut self, data: &[u8])
pub fn write_bytes(&mut self, data: &[u8])
Write a byte slice with a LEB128 length prefix.
Sourcepub fn write_raw_bytes(&mut self, data: &[u8])
pub fn write_raw_bytes(&mut self, data: &[u8])
Write raw bytes with no length prefix.
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