ByteReader

Struct ByteReader 

Source
pub struct ByteReader<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> ByteReader<'a>

Source

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

Source

pub fn read_c_str(&mut self) -> Result<String>

Source

pub fn read_u8(&mut self) -> Result<u8>

Source

pub fn read_u16_be(&mut self) -> Result<u16>

Source

pub fn read_u16_le(&mut self) -> Result<u16>

Source

pub fn read_u32_be(&mut self) -> Result<u32>

Source

pub fn read_u32_le(&mut self) -> Result<u32>

Source

pub fn read_u64_be(&mut self) -> Result<u64>

Source

pub fn read_u64_le(&mut self) -> Result<u64>

Source

pub fn advance(&mut self, n: usize) -> Result<()>

Source

pub fn align(&mut self, n: usize)

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_finished(&self) -> bool

Done reading all the bytes and cursor is corrently pointing out of bound of the array

Source

pub fn read_block(&mut self, n: usize) -> Result<&[u8]>

Source

pub fn read_block_to_end(&mut self) -> Result<&[u8]>

Source

pub fn get_block_at(&self, position: usize, length: usize) -> Result<&[u8]>

Does not advance the cursor

Source

pub fn rewind(&mut self, n: usize) -> Result<()>

Source

pub fn reset(&mut self)

Source

pub fn get_position(&self) -> usize

Source

pub fn set_position(&mut self, n: usize) -> Result<()>

Auto Trait Implementations§

§

impl<'a> Freeze for ByteReader<'a>

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.