pub struct BigEndianReader<'a>(/* private fields */);Expand description
Reads bits in the big-endian format
use bitter::{BitReader, BigEndianReader};
let mut bebits = BigEndianReader::new(&[0b1000_0000]);
assert_eq!(bebits.read_bit(), Some(true));Implementations§
Trait Implementations§
Source§impl BitReader for BigEndianReader<'_>
impl BitReader for BigEndianReader<'_>
Source§fn read_bit(&mut self) -> Option<bool>
fn read_bit(&mut self) -> Option<bool>
Consume a bit and return if the bit was enabled Read more
Source§fn read_u16(&mut self) -> Option<u16>
fn read_u16(&mut self) -> Option<u16>
Consume 16 bits and return the deserialized short Read more
Source§fn read_i16(&mut self) -> Option<i16>
fn read_i16(&mut self) -> Option<i16>
Consume 16 bits and return the deserialized short Read more
Source§fn read_u32(&mut self) -> Option<u32>
fn read_u32(&mut self) -> Option<u32>
Consume 32 bits and return the deserialized int Read more
Source§fn read_i32(&mut self) -> Option<i32>
fn read_i32(&mut self) -> Option<i32>
Consume 32 bits and return the deserialized int Read more
Source§fn read_f32(&mut self) -> Option<f32>
fn read_f32(&mut self) -> Option<f32>
Consume 32 bits and return the deserialized floating point Read more
Source§fn read_u64(&mut self) -> Option<u64>
fn read_u64(&mut self) -> Option<u64>
Consume 64 bits and return the deserialized int Read more
Source§fn read_i64(&mut self) -> Option<i64>
fn read_i64(&mut self) -> Option<i64>
Consume 64 bits and return the deserialized int Read more
Source§fn read_f64(&mut self) -> Option<f64>
fn read_f64(&mut self) -> Option<f64>
Consume 64 bits and return the deserialized floating point Read more
Source§fn read_bits(&mut self, bits: u32) -> Option<u64>
fn read_bits(&mut self, bits: u32) -> Option<u64>
Reads an arbitrary number of bits in the range of [0, 64] and returns
the unsigned result Read more
Source§fn read_signed_bits(&mut self, bits: u32) -> Option<i64>
fn read_signed_bits(&mut self, bits: u32) -> Option<i64>
Reads an arbitrary number of bits in the range of [0, 64] and returns
the signed result. Read more
Source§fn bytes_remaining(&self) -> usize
fn bytes_remaining(&self) -> usize
Returns how many complete bytes are left in the bitstream. Read more
Source§fn unbuffered_bytes_remaining(&self) -> usize
fn unbuffered_bytes_remaining(&self) -> usize
Returns how many bytes are still left in the passed in buffer. Read more
Source§fn bits_remaining(&self) -> Option<usize>
fn bits_remaining(&self) -> Option<usize>
Returns the exact number of bits remaining in the bitstream if the
number of bits can fit within a
usize. For large byte slices,
calculating the number of bits can cause an overflow, hence an Option
is returned. See has_bits_remaining
for a more robust, performant, and ergonomic alternative. Read moreSource§fn has_bits_remaining(&self, bits: usize) -> bool
fn has_bits_remaining(&self, bits: usize) -> bool
Returns true if at least
bits number of bits are left in the stream. A
more robust, performant, and ergonomic way than
bits_remaining. Read moreSource§fn read_bytes(&mut self, buf: &mut [u8]) -> bool
fn read_bytes(&mut self, buf: &mut [u8]) -> bool
Read the number of bytes needed to fill the provided buffer. Returns whether
the read was successful and the buffer has been filled. If there aren’t enough
bytes remaining, then the bit stream and buffer remains unchanged Read more
Source§fn peek(&self, count: u32) -> u64
fn peek(&self, count: u32) -> u64
Peeks at the given number of bits in the lookahead buffer Read more
Source§fn consume(&mut self, count: u32)
fn consume(&mut self, count: u32)
Consumes the number of bits from the lookahead buffer Read more
Source§fn lookahead_bits(&self) -> u32
fn lookahead_bits(&self) -> u32
Returns the number of bits in the lookahead buffer Read more
Source§fn refill_lookahead(&mut self)
fn refill_lookahead(&mut self)
Refills the lookahead buffer. Read more
Source§unsafe fn refill_lookahead_unchecked(&mut self)
unsafe fn refill_lookahead_unchecked(&mut self)
Refills the lookahead buffer without bounds checking Read more
Source§fn byte_aligned(&self) -> bool
fn byte_aligned(&self) -> bool
Returns true if the reader is not partway through a byte Read more
Source§impl<'a> Clone for BigEndianReader<'a>
impl<'a> Clone for BigEndianReader<'a>
Source§fn clone(&self) -> BigEndianReader<'a>
fn clone(&self) -> BigEndianReader<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for BigEndianReader<'a>
impl<'a> Debug for BigEndianReader<'a>
impl<'a> Copy for BigEndianReader<'a>
Auto Trait Implementations§
impl<'a> Freeze for BigEndianReader<'a>
impl<'a> RefUnwindSafe for BigEndianReader<'a>
impl<'a> Send for BigEndianReader<'a>
impl<'a> Sync for BigEndianReader<'a>
impl<'a> Unpin for BigEndianReader<'a>
impl<'a> UnwindSafe for BigEndianReader<'a>
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