[−][src]Struct x3::bytereader::ByteReader
BitReader allows individual bits to be read from an array of bytes.
Implementations
impl<'a> ByteReader<'a>
[src]
pub fn new(array: &'a [u8]) -> ByteReader<'_>
[src]
pub fn reset(&mut self)
[src]
pub fn set_pos(&mut self, p_byte: usize)
[src]
pub fn get_pos(&self) -> usize
[src]
pub fn find_le_u16(&mut self, word: u16) -> bool
[src]
pub fn extract(
&self,
p_start: usize,
p_end: usize
) -> Result<Vec<u8>, BitPackError>
[src]
&self,
p_start: usize,
p_end: usize
) -> Result<Vec<u8>, BitPackError>
pub fn eq(&self, buf: &[u8]) -> bool
[src]
Check if buf
and ByteReader array at the current read position contain the
same information.
Note:
Arguments
buf
- The array where the bytes will be written to.
pub fn remaining_bytes(&self) -> Result<usize, BitPackError>
[src]
Get the number of bytes remaining in the ByteReader buffer.
pub fn inc_counter(&mut self, n_bytes: usize) -> Result<(), BitPackError>
[src]
This operates together with write_packed_bits
. It increments the
p_byte
value by n_bytes
.
pub fn dec_counter(&mut self, n_bytes: usize) -> Result<(), BitPackError>
[src]
This operates together with write_packed_bits
. It decrements the
p_byte
value by n_bytes
.
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize, BitPackError>
[src]
Read buf.len()
bytes and write them to buf.
Arguments
buf
- The array where the bytes will be written to.
pub fn read_u8(&mut self) -> Result<u8, BitPackError>
[src]
Read the next two bytes as big-endian u16.
pub fn read_be_u16(&mut self) -> Result<u16, BitPackError>
[src]
Read the next two bytes as big-endian u16.
pub fn read_be_i16(&mut self) -> Result<i16, BitPackError>
[src]
Read the next two bytes as big-endian i16.
pub fn read_le_i16(&mut self) -> Result<i16, BitPackError>
[src]
Read the next two bytes as little-endian i16.
pub fn crc16(&self, num_bytes: usize) -> Result<u16, BitPackError>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for ByteReader<'a>
impl<'a> Send for ByteReader<'a>
impl<'a> Sync for ByteReader<'a>
impl<'a> Unpin for ByteReader<'a>
impl<'a> UnwindSafe for ByteReader<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,