pub struct BitStreamReader<'a> { /* private fields */ }Implementations§
Source§impl<'a> BitStreamReader<'a>
impl<'a> BitStreamReader<'a>
Sourcepub fn slice(&self, from_start: bool) -> &[u8] ⓘ
pub fn slice(&self, from_start: bool) -> &[u8] ⓘ
Return slice from reading position (or start, if from_start is true) to offset-end
Sourcepub fn set_marker(&mut self)
pub fn set_marker(&mut self)
Set marker at current byte
Sourcepub fn reset_marker(&mut self)
pub fn reset_marker(&mut self)
Unset marker
Sourcepub fn slice_marker(&self, to: Option<usize>) -> &[u8] ⓘ
pub fn slice_marker(&self, to: Option<usize>) -> &[u8] ⓘ
Return slice from marker (or start if marker is unset) to specific position or current byte
If crypto is set, it will return the decrypted slice. This is different from other slice methods which always returns the raw buffer slice.
Sourcepub fn slice_end(&mut self) -> &[u8] ⓘ
pub fn slice_end(&mut self) -> &[u8] ⓘ
Return slice from offset-end to end of buffer
If crypto is set, it will apply the keystream to the slice before returning.
This is different from other slice methods which always returns the raw buffer slice.
Sourcepub fn slice_start(&self) -> &[u8] ⓘ
pub fn slice_start(&self) -> &[u8] ⓘ
Return slice from start of buffer to current byte position
Sourcepub fn set_crypto(&mut self, crypto: Option<Box<dyn CryptoStream>>)
pub fn set_crypto(&mut self, crypto: Option<Box<dyn CryptoStream>>)
Set crypto stream
Sourcepub fn reset_crypto(&mut self)
pub fn reset_crypto(&mut self)
Remove crypto stream
Sourcepub fn set_offset_end(&mut self, len: usize)
pub fn set_offset_end(&mut self, len: usize)
Set integrity offset to ignore when reading
Sourcepub fn read_bit(&mut self) -> Result<bool, DeserializationError>
pub fn read_bit(&mut self) -> Result<bool, DeserializationError>
Read a single bit
Sourcepub fn read_small(&mut self, bits: u8) -> Result<u8, DeserializationError>
pub fn read_small(&mut self, bits: u8) -> Result<u8, DeserializationError>
Read 1-8 bits as u8 (LSB-first)
Sourcepub fn read_byte(&mut self) -> Result<u8, DeserializationError>
pub fn read_byte(&mut self) -> Result<u8, DeserializationError>
Read a full byte, aligning to the next byte boundary
Sourcepub fn read_bytes(
&mut self,
count: usize,
) -> Result<&[u8], DeserializationError>
pub fn read_bytes( &mut self, count: usize, ) -> Result<&[u8], DeserializationError>
Read a slice of bytes, aligning first
Sourcepub fn read_dyn_int(&mut self) -> Result<u128, DeserializationError>
pub fn read_dyn_int(&mut self) -> Result<u128, DeserializationError>
Read a dynamic int, starting at the next byte bounary The last bit is used as a continuation flag for the next byte
Sourcepub fn read_fixed_int<const S: usize, T: FixedInt<S>>(
&mut self,
) -> Result<T, DeserializationError>
pub fn read_fixed_int<const S: usize, T: FixedInt<S>>( &mut self, ) -> Result<T, DeserializationError>
Read a integer of fixed size from the buffer
Sourcepub fn align_byte(&mut self)
pub fn align_byte(&mut self)
Align the reader to the next byte boundary
Sourcepub fn bytes_left(&self) -> usize
pub fn bytes_left(&self) -> usize
Get bytes left