pub fn read_bits(&mut self, n: u8) -> u64 {
        // TODO : Assert that n <= 64
        if n > 0 {
            ((if self.read_bit() { 1 } else { 0 }) << n - 1) | self.read_bits(n - 1)
        } else {
            0
        }
    }
/// Read n bits. an return the corresponding value an u64.
///
/// **Note 1** : We cannot read more than 64 bits
///
/// **Note 2** Bits are read from left to right
///
/// #Example
///
/// ```
/// #  use databuffer::*;
/// let mut buffer = DataBuffer::from_bytes(&vec![128]); // 10000000b
/// let value = buffer.read_bits(3); // value contains 4 (eg: 100b)
/// ```
Read n bits. an return the corresponding value an u64.
Note 1** : We cannot read more than 64 bits

Note 2** Bits are read from left to right
Read n bits . an return the corresponding value an u64 . Note 1 ** : We cannot read more than 64 bits Note 2 ** Bits are read from left to right
pub fn read_bits(&mut self, n: u8) -> u64 {
        // TODO : Assert that n <= 64
        if n > 0 {
            ((if self.read_bit() { 1 } else { 0 }) << n - 1) | self.read_bits(n - 1)
        } else {
            0
        }
    }
pub fn read_bits ( & mut self , n : u8 ) -> u64 { // TODO : Assert that n <= 64 if n > 0 { ( ( if self . read_bit ( ) { 1 } else { 0 } ) << n - 1 ) | self . read_bits ( n - 1 ) } else { 0 } }
Read n bits.
Read n bits .
&mut self
n
u8
example
None
use databuffer::*;
let mut buffer = DataBuffer::from_bytes(&vec![128]); // 10000000b
let value = buffer.read_bits(3); // value contains 4
```
let mut buffer = DataBuffer :: from_bytes ( &vec! [ 128 ] ) ; // 10000000b let value = buffer . read_bits ( 3 ) ; // value contains 4 ` ` `