Skip to main content

BinaryReader

Struct BinaryReader 

Source
pub struct BinaryReader<'data> { /* private fields */ }
Expand description

The BinaryReader type.

Implementations§

Source§

impl<'data> BinaryReader<'data>

Source

pub fn new(data: &'data [u8], endian: Endian) -> BinaryReader<'data>

Performs new.

Source

pub fn at_offset( data: &'data [u8], endian: Endian, offset: usize, ) -> BinaryReader<'data>

Performs at_offset.

Source

pub fn offset(&self) -> usize

Performs offset.

Source

pub fn remaining(&self) -> usize

Performs remaining.

Source

pub fn len(&self) -> usize

Performs len.

Source

pub fn is_empty(&self) -> bool

Performs is_empty.

Source

pub fn endian(&self) -> Endian

Performs endian.

Source

pub fn seek(&mut self, offset: usize)

Performs seek.

Source

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

Performs skip.

Source

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

Performs read_u8.

Source

pub fn read_u16(&mut self) -> Result<u16, ParseError>

Performs read_u16.

Source

pub fn read_u32(&mut self) -> Result<u32, ParseError>

Performs read_u32.

Source

pub fn read_u64(&mut self) -> Result<u64, ParseError>

Performs read_u64.

Source

pub fn read_i32(&mut self) -> Result<i32, ParseError>

Performs read_i32.

Source

pub fn read_bytes(&mut self, n: usize) -> Result<&'data [u8], ParseError>

Performs read_bytes.

Source

pub fn read_fixed_array<const N: usize>( &mut self, ) -> Result<[u8; N], ParseError>

Performs read_fixed_array.

Source

pub fn read_c_string_at( &self, abs_offset: usize, max_len: usize, ) -> Result<&'data [u8], ParseError>

Read a null-terminated C string starting at abs_offset. Does not advance the cursor.

Auto Trait Implementations§

§

impl<'data> Freeze for BinaryReader<'data>

§

impl<'data> RefUnwindSafe for BinaryReader<'data>

§

impl<'data> Send for BinaryReader<'data>

§

impl<'data> Sync for BinaryReader<'data>

§

impl<'data> Unpin for BinaryReader<'data>

§

impl<'data> UnsafeUnpin for BinaryReader<'data>

§

impl<'data> UnwindSafe for BinaryReader<'data>

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.