pub struct BinaryReader {
    pub data: Vec<u8>,
    pub pos: usize,
    pub length: usize,
    pub endian: Endian,
}
Expand description

Binary reader.

Fields

data: Vec<u8>

The buffer data.

pos: usize

The current position.

length: usize

The length of the buffer.

endian: Endian

The endian of the buffer.

Implementations

Initialize BinaryReader from u8 slice.

Initialize BinaryReader from u8 Vector.

Initialize BinaryReader from std::fs::File.

Set endian for read method.

Jump position.

Read provided length size bytes.

Read provided length size bytes. Similar to BinaryReader::read but this returns std::io::Result instead of Option.

Read cstr strings until null(aka 0x00) using std::string::String::from_utf8.

Read cstr strings until null(aka 0x00) using std::string::String::from_utf8_lossy.

Read boolean. Note that anything other than 0x00 is considered true.

Read signed 8 bit integer.

Read signed 16 bit integer.

Read signed 24 bit integer. Stored in i32.

Read signed 32 bit integer.

Read signed 48 bit integer. Stored in i64.

Read signed 64 bit integer.

Read signed 128 bit integer.

Read unsigned 8 bit integer.

Read unsigned 16 bit integer.

Read unsigned 24 bit integer. Stored in u32.

Read unsigned 32 bit integer.

Read unsigned 48 bit integer. Stored in u64.

Read unsigned 64 bit integer.

Read unsigned 128 bit integer.

Read 32 bit floating point number.

Read 64 bit floating point number.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.