pub struct BitWriter<W: Write> {
pub pad_zero: bool,
/* private fields */
}
Expand description
Writer to bitwise writing to Write
Fields§
§pad_zero: bool
Implementations§
Source§impl<W: Write> BitWriter<W>
impl<W: Write> BitWriter<W>
Sourcepub fn new(inner: W, pad_zero: bool) -> Self
pub fn new(inner: W, pad_zero: bool) -> Self
Create a new BitWriter from a Write Trait with default capacity of 1024 Bytes
Sourcepub fn with_capacity(capacity: usize, inner: W, pad_zero: bool) -> Self
pub fn with_capacity(capacity: usize, inner: W, pad_zero: bool) -> Self
Create a new BitWriter with a capacity (in Bytes)
Sourcepub fn write(&mut self, bit: Bit) -> Result<()>
pub fn write(&mut self, bit: Bit) -> Result<()>
Writes a single Bit into the internal Buffer If internal buffer is full -> Call internal write
Sourcepub fn write_bits(&mut self, bits: &Vec<Bit>) -> Result<()>
pub fn write_bits(&mut self, bits: &Vec<Bit>) -> Result<()>
Writes a vector of Bits into the internal Buffer If internal buffer is full -> Call internal write
Sourcepub fn write_buf(&mut self) -> Result<()>
pub fn write_buf(&mut self) -> Result<()>
Write the internal Buffer and Pad with Zero? If needed
Sourcepub fn discard_non_byte(&mut self)
pub fn discard_non_byte(&mut self)
Removes excess bits that do not form a byte
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for BitWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for BitWriter<W>where
W: RefUnwindSafe,
impl<W> Send for BitWriter<W>where
W: Send,
impl<W> Sync for BitWriter<W>where
W: Sync,
impl<W> Unpin for BitWriter<W>where
W: Unpin,
impl<W> UnwindSafe for BitWriter<W>where
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