pub fn read_bit(&mut self) -> bool {
        assert!(self.rpos <= self.data.len());
        let bit = self.data[self.rpos] & (1 << 7 - self.rbit) != 0;
        self.rbit += 1;
        if self.rbit > 7 {
            self.rbit = 0;
            self.rpos += 1;
        }
        bit
    }
/// Read 1 bit. Return true if the bit is set to 1, otherwhise, return false.
///
/// **Note** Bits are read from left to right
///
/// #Example
///
/// ```
/// #  use databuffer::*;
/// let mut buffer = DataBuffer::from_bytes(&vec![128]); // 10000000b
/// let value1 = buffer.read_bit(); //value1 contains true (eg: bit is 1)
/// let value2 = buffer.read_bit(); //value2 contains false (eg: bit is 0)
/// ```
Read 1 bit. Return true if the bit is set to 1, otherwhise, return false.
Note** Bits are read from left to right
Read 1 bit . Return true if the bit is set to 1 otherwhise return false . Note ** Bits are read from left to right
pub fn read_bit(&mut self) -> bool {
        assert!(self.rpos <= self.data.len());
        let bit = self.data[self.rpos] & (1 << 7 - self.rbit) != 0;
        self.rbit += 1;
        if self.rbit > 7 {
            self.rbit = 0;
            self.rpos += 1;
        }
        bit
    }
pub fn read_bit ( & mut self ) -> bool { assert ! ( self rpos self data len ( ) ) ; let bit = self . data [ self . rpos ] & ( 1 << 7 - self . rbit ) != 0 ; self . rbit += 1 ; if self . rbit > 7 { self . rbit = 0 ; self . rpos += 1 ; } bit }
Read 1 bit.
Read 1 bit .
&mut self
example
None
use databuffer::*;
let mut buffer = DataBuffer::from_bytes(&vec![128]); // 10000000b
let value1 = buffer.read_bit(); //value1 contains true
let value2 = buffer.read_bit(); //value2 contains false
```
let mut buffer = DataBuffer :: from_bytes ( &vec! [ 128 ] ) ; // 10000000b let value1 = buffer . read_bit () ; // value1 contains true let value2 = buffer . read_bit () ; // value2 contains false ` ` `