[][src]Struct bitrw::BitRead

pub struct BitRead<'t> { /* fields omitted */ }

Provides BitRead from a Read.

use bitrw::UseBitRead;
let mut c = std::io::Cursor::new(&[0b00_11_10_1_0, 0b1_110_101_1, 0b1101000]);
let mut r = c.use_bit_read();
assert_eq!(r.read::<u8>(0).unwrap(), 0);
assert_eq!(r.read::<u16>(1).unwrap(), 0);
assert_eq!(r.read::<u32>(1).unwrap(), 1);
assert_eq!(r.read::<u64>(2).unwrap(), 2);
assert_eq!(r.read::<u128>(2).unwrap(), 3);
assert_eq!(r.read::<usize>(3).unwrap(), 4);
assert_eq!(r.read::<u8>(3).unwrap(), 5);
assert_eq!(r.read::<u16>(3).unwrap(), 6);
assert_eq!(r.read::<u32>(8).unwrap(), 0b11010001);

Methods

impl<'_> BitRead<'_>[src]

pub fn read<T: UInt>(&mut self, size: u8) -> Result<T>[src]

Little-endian bit read.

Auto Trait Implementations

impl<'t> !Send for BitRead<'t>

impl<'t> !Sync for BitRead<'t>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.