BitRead

Trait BitRead 

Source
pub trait BitRead<'a>: BitReadInternal + Copy {
    // Required methods
    fn new(_: &'a [u8]) -> Self;
    fn consumed(&self) -> usize;
    fn available(&self) -> usize;
    fn skip_bits(&mut self, size: usize);

    // Provided methods
    fn get_bit(&mut self) -> bool { ... }
    fn get_bits_64(&mut self, n: usize) -> u64 { ... }
    fn get_bits_32(&mut self, n: usize) -> u32 { ... }
    fn peek_bit(&mut self) -> bool { ... }
    fn peek_bits_32(&mut self, n: usize) -> u32 { ... }
    fn peek_bits_64(&self, n: usize) -> u64 { ... }
    fn align_bits(&mut self) { ... }
}
Expand description

Used to define a bitreader.

Required Methods§

Source

fn new(_: &'a [u8]) -> Self

Creates a new bitreader with an internal buffer associated to it.

Source

fn consumed(&self) -> usize

Tells the number of bits read from the internal buffer.

Source

fn available(&self) -> usize

Tells the number of bits still available in the internal buffer.

Source

fn skip_bits(&mut self, size: usize)

Discard a certain number of bits from the internal buffer.

Provided Methods§

Source

fn get_bit(&mut self) -> bool

Returns a single bit from the internal buffer.

Source

fn get_bits_64(&mut self, n: usize) -> u64

Returns n bits from the internal buffer as a 64-bit sequence.

Source

fn get_bits_32(&mut self, n: usize) -> u32

Returns n bits from the internal buffer as a 32-bit sequence.

Source

fn peek_bit(&mut self) -> bool

Peeks the next bit present in the internal buffer.

Source

fn peek_bits_32(&mut self, n: usize) -> u32

Peeks the next 32-bit sequence present in the internal buffer.

Source

fn peek_bits_64(&self, n: usize) -> u64

Peeks the next 64-bit sequence present in the internal buffer.

Source

fn align_bits(&mut self)

Aligns the bits present in the internal buffer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a> BitRead<'a> for BitReadBE<'a>

Source§

impl<'a> BitRead<'a> for BitReadLE<'a>