RandomAccessBinReader

Struct RandomAccessBinReader 

Source
pub struct RandomAccessBinReader { /* private fields */ }

Trait Implementations§

Source§

impl AsRef<[u8]> for RandomAccessBinReader

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'r> BinReader<'r> for RandomAccessBinReader

Source§

fn from_slice_with_offset( slice: &[u8], initial_offset: usize, endidness: Endidness, ) -> Result<Self>

Generates a new BinReader using the provided slice, initial offset, and endidness. While the exact implementation of this varies from implementation to implementation, OwnableBinReaders will, more than likely, copy the data in the slice.
Source§

fn initial_offset(&self) -> usize

The initial offset of the BinReader. For more information, see the Offsets section of the BinReader documentation.
Source§

fn is_empty(&self) -> bool

Checks whether or not there is any data left, based off of the BinReader::current_offset.
Source§

fn size(&self) -> usize

The amount of data in the reader. If the reader’s size changes (which none of the implementations currently do), then this should return how much data was initially in the reader.
Source§

fn remaining(&self) -> usize

The amount of data left, based off of the BinReader::current_offset.
Source§

fn current_offset(&self) -> usize

The current offset of the reader’s cursor.
Source§

fn endidness(&self) -> Endidness

The endidness of the reader.
Source§

fn change_endidness(&mut self, endidness: Endidness)

Changes the default endidness.
Source§

fn advance_to(&self, offset: usize) -> Result<()>

Sets the reader’s BinReader::current_offset.
Source§

fn advance_by(&self, bytes: isize) -> Result<()>

Alters the BinReader::current_offset by the given amount.
Source§

fn next_u8(&self) -> Result<u8>

Gets the current byte and then advances the cursor.
Source§

fn next_n_bytes(&self, num_bytes: usize) -> Result<Bytes>

Returns a Bytes object of the requested size containing the next n bytes (where n is the num_bytes parameter) and then advances the cursor by that much.
Source§

fn from_slice(slice: &'r [u8], endidness: Endidness) -> Result<Self>

Functions the same as the BinReader::from_slice_with_offset, except the initial offset is always 0.
Source§

fn lower_offset_limit(&self) -> usize

The lowest valid offset that can be requested. By default, this is the same as BinReader::initial_offset.
Source§

fn upper_offset_limit(&self) -> usize

The highest valid offset that can be requested. By default, this is the reader’s BinReader::size plus its BinReader::initial_offset.
Source§

fn validate_offset(&self, offset: usize, size: usize) -> Result<()>

A helper method that validates an offset (mostly used by reader implementations). Read more
Source§

fn relative_offset(&self, abs_offset: usize) -> Result<usize>

Takes an absolute offset and converts it to a relative offset, based off of the BinReader::current_offset.
Source§

fn next_bytes_are(&self, prefix: &[u8]) -> Result<bool>

Returns true if the next bytes are the same as the ones provided.
Source§

fn bytes_at(&self, offset: usize, buf: &mut [u8]) -> Result<()>

Fills the provided buffer with bytes, starting at the provided offset. This does not alter the BinReader::current_offset.
Source§

fn subseq(&self, offset: usize, num_bytes: usize) -> Result<&[u8]>

Returns a subsequence (i.e. a &[u8]) of data of the requested size beginning at the provided offset.
Source§

fn range(&self, start: usize, end: usize) -> Result<&[u8]>

Returns a slice of the data between the provided starting and ending offsets.
Source§

fn next_bytes(&self, buf: &mut [u8]) -> Result<()>

Fills the provided buffer with the next n bytes, where n is the length of the buffer. This then advances the BinReader::current_offset by n.
Source§

fn current_u8(&self) -> Result<u8>

Gets the u8 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_i8_ne(&self) -> Result<i8>

Gets the nelong endian i8 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_u16_be(&self) -> Result<u16>

Gets the belong endian u16 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_u16_le(&self) -> Result<u16>

Gets the lelong endian u16 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_i16_be(&self) -> Result<i16>

Gets the belong endian i16 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_i16_le(&self) -> Result<i16>

Gets the lelong endian i16 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_u32_be(&self) -> Result<u32>

Gets the belong endian u32 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_u32_le(&self) -> Result<u32>

Gets the lelong endian u32 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_i32_be(&self) -> Result<i32>

Gets the belong endian i32 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_i32_le(&self) -> Result<i32>

Gets the lelong endian i32 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_u64_be(&self) -> Result<u64>

Gets the belong endian u64 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_u64_le(&self) -> Result<u64>

Gets the lelong endian u64 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_i64_be(&self) -> Result<i64>

Gets the belong endian i64 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_i64_le(&self) -> Result<i64>

Gets the lelong endian i64 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_u128_be(&self) -> Result<u128>

Gets the belong endian u128 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_u128_le(&self) -> Result<u128>

Gets the lelong endian u128 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_i128_be(&self) -> Result<i128>

Gets the belong endian i128 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn current_i128_le(&self) -> Result<i128>

Gets the lelong endian i128 at the BinReader::current_offset without altering the BinReader::current_offset.
Source§

fn u8_at(&self, offset: usize) -> Result<u8>

Gets the u8 at the provided offset without altering the BinReader::current_offset.
Source§

fn i8_ne_at(&self, offset: usize) -> Result<i8>

Gets the nelong endian i8 at the provided offset without altering the BinReader::current_offset.
Source§

fn u16_be_at(&self, offset: usize) -> Result<u16>

Gets the belong endian u16 at the provided offset without altering the BinReader::current_offset.
Source§

fn u16_le_at(&self, offset: usize) -> Result<u16>

Gets the lelong endian u16 at the provided offset without altering the BinReader::current_offset.
Source§

fn i16_be_at(&self, offset: usize) -> Result<i16>

Gets the belong endian i16 at the provided offset without altering the BinReader::current_offset.
Source§

fn i16_le_at(&self, offset: usize) -> Result<i16>

Gets the lelong endian i16 at the provided offset without altering the BinReader::current_offset.
Source§

fn u32_be_at(&self, offset: usize) -> Result<u32>

Gets the belong endian u32 at the provided offset without altering the BinReader::current_offset.
Source§

fn u32_le_at(&self, offset: usize) -> Result<u32>

Gets the lelong endian u32 at the provided offset without altering the BinReader::current_offset.
Source§

fn i32_be_at(&self, offset: usize) -> Result<i32>

Gets the belong endian i32 at the provided offset without altering the BinReader::current_offset.
Source§

fn i32_le_at(&self, offset: usize) -> Result<i32>

Gets the lelong endian i32 at the provided offset without altering the BinReader::current_offset.
Source§

fn u64_be_at(&self, offset: usize) -> Result<u64>

Gets the belong endian u64 at the provided offset without altering the BinReader::current_offset.
Source§

fn u64_le_at(&self, offset: usize) -> Result<u64>

Gets the lelong endian u64 at the provided offset without altering the BinReader::current_offset.
Source§

fn i64_be_at(&self, offset: usize) -> Result<i64>

Gets the belong endian i64 at the provided offset without altering the BinReader::current_offset.
Source§

fn i64_le_at(&self, offset: usize) -> Result<i64>

Gets the lelong endian i64 at the provided offset without altering the BinReader::current_offset.
Source§

fn u128_be_at(&self, offset: usize) -> Result<u128>

Gets the belong endian u128 at the provided offset without altering the BinReader::current_offset.
Source§

fn u128_le_at(&self, offset: usize) -> Result<u128>

Gets the lelong endian u128 at the provided offset without altering the BinReader::current_offset.
Source§

fn i128_be_at(&self, offset: usize) -> Result<i128>

Gets the belong endian i128 at the provided offset without altering the BinReader::current_offset.
Source§

fn i128_le_at(&self, offset: usize) -> Result<i128>

Gets the lelong endian i128 at the provided offset without altering the BinReader::current_offset.
Source§

fn u16_at(&self, offset: usize) -> Result<u16>

Gets the u16 using the default endidness at the provided offset without altering the BinReader::current_offset. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn u32_at(&self, offset: usize) -> Result<u32>

Gets the u32 using the default endidness at the provided offset without altering the BinReader::current_offset. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn u64_at(&self, offset: usize) -> Result<u64>

Gets the u64 using the default endidness at the provided offset without altering the BinReader::current_offset. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn u128_at(&self, offset: usize) -> Result<u128>

Gets the u128 using the default endidness at the provided offset without altering the BinReader::current_offset. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn i16_at(&self, offset: usize) -> Result<i16>

Gets the i16 using the default endidness at the provided offset without altering the BinReader::current_offset. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn i32_at(&self, offset: usize) -> Result<i32>

Gets the i32 using the default endidness at the provided offset without altering the BinReader::current_offset. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn i64_at(&self, offset: usize) -> Result<i64>

Gets the i64 using the default endidness at the provided offset without altering the BinReader::current_offset. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn i128_at(&self, offset: usize) -> Result<i128>

Gets the i128 using the default endidness at the provided offset without altering the BinReader::current_offset. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn next_i8_ne(&self) -> Result<i8>

Gets the nelong endian i8 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_u16_be(&self) -> Result<u16>

Gets the belong endian u16 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_u16_le(&self) -> Result<u16>

Gets the lelong endian u16 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_i16_be(&self) -> Result<i16>

Gets the belong endian i16 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_i16_le(&self) -> Result<i16>

Gets the lelong endian i16 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_u32_be(&self) -> Result<u32>

Gets the belong endian u32 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_u32_le(&self) -> Result<u32>

Gets the lelong endian u32 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_i32_be(&self) -> Result<i32>

Gets the belong endian i32 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_i32_le(&self) -> Result<i32>

Gets the lelong endian i32 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_u64_be(&self) -> Result<u64>

Gets the belong endian u64 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_u64_le(&self) -> Result<u64>

Gets the lelong endian u64 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_i64_be(&self) -> Result<i64>

Gets the belong endian i64 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_i64_le(&self) -> Result<i64>

Gets the lelong endian i64 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_u128_be(&self) -> Result<u128>

Gets the belong endian u128 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_u128_le(&self) -> Result<u128>

Gets the lelong endian u128 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_i128_be(&self) -> Result<i128>

Gets the belong endian i128 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_i128_le(&self) -> Result<i128>

Gets the lelong endian i128 at the BinReader::current_offset and then advances it by 1.
Source§

fn next_u16(&self) -> Result<u16>

Gets the u16 using the default endidness at the BinReader::current_offset and then advances it by 1. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn next_u32(&self) -> Result<u32>

Gets the u16 using the default endidness at the BinReader::current_offset and then advances it by 1. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn next_u64(&self) -> Result<u64>

Gets the u16 using the default endidness at the BinReader::current_offset and then advances it by 1. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn next_u128(&self) -> Result<u128>

Gets the u16 using the default endidness at the BinReader::current_offset and then advances it by 1. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn next_i8(&self) -> Result<i8>

Gets the i8 at the BinReader::current_offset and then advances it by 1. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn next_i16(&self) -> Result<i16>

Gets the i16 using the default endidness at the BinReader::current_offset and then advances it by 1. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn next_i32(&self) -> Result<i32>

Gets the i32 using the default endidness at the BinReader::current_offset and then advances it by 1. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn next_i64(&self) -> Result<i64>

Gets the i64 using the default endidness at the BinReader::current_offset and then advances it by 1. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

fn next_i128(&self) -> Result<i128>

Gets the i128 using the default endidness at the BinReader::current_offset and then advances it by 1. If the current endidness is Endidness::Unknown, then an error is returned.
Source§

impl Borrow<[u8]> for RandomAccessBinReader

Source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
Source§

impl BufRead for RandomAccessBinReader

Source§

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

Returns the contents of the internal buffer, filling it with more data, via Read methods, if empty. Read more
Source§

fn consume(&mut self, amt: usize)

Marks the given amount of additional bytes from the internal buffer as having been read. Subsequent calls to read only return bytes that have not been marked as read. Read more
Source§

fn has_data_left(&mut self) -> Result<bool, Error>

🔬This is a nightly-only experimental API. (buf_read_has_data_left)
Checks if there is any data left to be read. Read more
1.0.0 · Source§

fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes into buf until the delimiter byte or EOF is reached. Read more
1.83.0 · Source§

fn skip_until(&mut self, byte: u8) -> Result<usize, Error>

Skips all bytes until the delimiter byte or EOF is reached. Read more
1.0.0 · Source§

fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until a newline (the 0xA byte) is reached, and append them to the provided String buffer. Read more
1.0.0 · Source§

fn split(self, byte: u8) -> Split<Self>
where Self: Sized,

Returns an iterator over the contents of this reader split on the byte byte. Read more
1.0.0 · Source§

fn lines(self) -> Lines<Self>
where Self: Sized,

Returns an iterator over the lines of this reader. Read more
Source§

impl<'r> OwnableBinReader<'r> for RandomAccessBinReader

Source§

fn from_file_with_offset<P: AsRef<Path>>( path: P, initial_offset: usize, endidness: Endidness, ) -> Result<Self>

Source§

fn from_bytes_with_offset( bytes: Bytes, initial_offset: usize, endidness: Endidness, ) -> Result<Self>

Source§

fn from_file<P: AsRef<Path>>(path: P, endidness: Endidness) -> Result<Self>

Source§

fn from_bytes(bytes: Bytes, endidness: Endidness) -> Result<Self>

Source§

impl Read for RandomAccessBinReader

Source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
1.36.0 · Source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored implementation. Read more
1.0.0 · Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more
1.0.0 · Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more
1.6.0 · Source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Reads the exact number of bytes required to fill buf. Read more
Source§

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more
1.0.0 · Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

impl Seek for RandomAccessBinReader

Source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64>

Seek to an offset, in bytes, in a stream. Read more
1.55.0 · Source§

fn rewind(&mut self) -> Result<(), Error>

Rewind to the beginning of a stream. Read more
Source§

fn stream_len(&mut self) -> Result<u64, Error>

🔬This is a nightly-only experimental API. (seek_stream_len)
Returns the length of this stream (in bytes). Read more
1.51.0 · Source§

fn stream_position(&mut self) -> Result<u64, Error>

Returns the current seek position from the start of the stream. Read more
1.80.0 · Source§

fn seek_relative(&mut self, offset: i64) -> Result<(), Error>

Seeks relative to the current position. Read more
Source§

impl<'r> SliceableBinReader<'r> for RandomAccessBinReader

Auto Trait Implementations§

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.