pub struct BitStreamReader<'src> {
pub src: &'src [u8],
pub position: usize,
pub bits_left: u8,
pub buffer: u64,
pub over_read: usize,
}
Fields§
§src: &'src [u8]
§position: usize
§bits_left: u8
§buffer: u64
§over_read: usize
Implementations§
source§impl<'src> BitStreamReader<'src>
impl<'src> BitStreamReader<'src>
sourcepub fn new(in_buffer: &'src [u8]) -> BitStreamReader<'src>
pub fn new(in_buffer: &'src [u8]) -> BitStreamReader<'src>
Create a new BitStreamReader
instance
§Expectations
The buffer must be padded with fill bytes in the end, if not, this becomes UB in the refill phase.
pub fn refill_inner_loop(&mut self)
fn refill_slow(&mut self)
pub fn peek_bits<const LOOKAHEAD: usize>(&self) -> usize
pub fn peek_var_bits(&self, lookahead: usize) -> usize
pub fn get_bits(&mut self, num_bits: u8) -> u64
sourcepub const fn get_bits_left(&self) -> u8
pub const fn get_bits_left(&self) -> u8
Get number of bits left in the bit buffer.
sourcepub fn get_position(&self) -> usize
pub fn get_position(&self) -> usize
Get position the stream is in this buffer Or alternatively, number of bits read.
sourcepub const fn has(&self, bits: u8) -> bool
pub const fn has(&self, bits: u8) -> bool
Return true if the bit buffer can satisfy
bits
read without refilling,
pub fn drop_bits(&mut self, bits: u8)
sourcepub const fn remaining_bytes(&self) -> usize
pub const fn remaining_bytes(&self) -> usize
Return the remaining bytes in this stream.
This does not consider bits in the bit-buffer hence may not be accurate
Auto Trait Implementations§
impl<'src> Freeze for BitStreamReader<'src>
impl<'src> RefUnwindSafe for BitStreamReader<'src>
impl<'src> Send for BitStreamReader<'src>
impl<'src> Sync for BitStreamReader<'src>
impl<'src> Unpin for BitStreamReader<'src>
impl<'src> UnwindSafe for BitStreamReader<'src>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more