Struct bit_manager::BitBuffer
[−]
[src]
pub struct BitBuffer { /* fields omitted */ }
A buffer that stores up to 64 bits and remembers how many are being stored
Methods
impl BitBuffer
[src]
fn new() -> BitBuffer
[src]
Creates an empty buffer.
fn push_right(&mut self, value: u8) -> Result<()>
[src]
Pushes all current bits left and adds a byte to the right.
fn pop_right(&mut self) -> Result<u8>
[src]
Pushes all current bits right and pops a byte from the right.
fn push_left(&mut self, value: u8) -> Result<()>
[src]
Adds a byte to the left.
fn pop_left(&mut self) -> Result<u8>
[src]
Pops a byte from the left.
fn push_bit_right(&mut self, value: bool) -> Result<()>
[src]
Pushes all current bits left and adds a bit to the right.
fn pop_bit_right(&mut self) -> Result<bool>
[src]
Pushes all current bits right and pops a bit from the right.
fn push_bit_left(&mut self, value: bool) -> Result<()>
[src]
Adds a bit to the left.
fn pop_bit_left(&mut self) -> Result<bool>
[src]
Pops a bit from the left.
fn bits(&self) -> u8
[src]
Returns the number of bits in the buffer.
fn bytes(&self) -> u8
[src]
Returns the number of whole bytes in the buffer.
fn is_empty(&self) -> bool
[src]
Returns true
if the buffer is empty and false
otherwise.
fn has_byte(&self) -> bool
[src]
Returns true
if the buffer has a whole byte and false
otherwise.
fn has_bit(&self) -> bool
[src]
Returns true
if the buffer has a bit and false
otherwise.
fn can_take_byte(&self) -> bool
[src]
Returns true
if the buffer has room for a whole byte and false
otherwise.
fn can_take_bit(&self) -> bool
[src]
Returns true
if the buffer has room for a bit and false
otherwise.
fn byte_space(&self) -> u8
[src]
Returns the number of whole bytes that can be added.
fn bit_space(&self) -> u8
[src]
Returns the number of whole bits that can be added.
Trait Implementations
impl Debug for BitBuffer
[src]
impl Clone for BitBuffer
[src]
fn clone(&self) -> BitBuffer
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more