ByteReader
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader
pub trait ByteReader<T>
Trait functions
reader
Wraps the array of bytes in a ByteReader for sequential consumption of integers and/or bytes
Returns
ByteReader- The reader struct wrapping a read-only snapshot of this ByteArray
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::reader
fn reader(self: @T) -> ByteReaderState<T>
remaining
Checks that there are enough remaining bytes available
Arguments
at- the start index position of the byte datacount- the number of bytes required
Returns
bool-truewhen there arecountbytes remaining,falseotherwise.
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::remaining
fn remaining(self: @T, at: u32, count: u32) -> bool
word_u16
Reads consecutive bytes from a specified offset as an unsigned integer in big endian
Arguments
offset- the start location of the consecutive bytes to read
Returns
Option<u16>- Returns an integer if there are enough consecutive bytes available in the ByteArray
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::word_u16
fn word_u16(self: @T, offset: u32) -> Option<u16>
word_u16_le
Reads consecutive bytes from a specified offset as an unsigned integer in little endian
Arguments
offset- the start location of the consecutive bytes to read
Returns
Option<u16>- Returns an integer if there are enough consecutive bytes available in the ByteArray
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::word_u16_le
fn word_u16_le(self: @T, offset: u32) -> Option<u16>
word_u32
Reads consecutive bytes from a specified offset as an unsigned integer in big endian
Arguments
offset- the start location of the consecutive bytes to read
Returns
Option<u32>- Returns an integer if there are enough consecutive bytes available in the ByteArray
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::word_u32
fn word_u32(self: @T, offset: u32) -> Option<u32>
word_u32_le
Reads consecutive bytes from a specified offset as an unsigned integer in little endian
Arguments
offset- the start location of the consecutive bytes to read
Returns
Option<u32>- Returns an integer if there are enough consecutive bytes available in the ByteArray
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::word_u32_le
fn word_u32_le(self: @T, offset: u32) -> Option<u32>
word_u64
Reads consecutive bytes from a specified offset as an unsigned integer in big endian
Arguments
offset- the start location of the consecutive bytes to read
Returns
Option<u64>- Returns an integer if there are enough consecutive bytes available in the ByteArray
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::word_u64
fn word_u64(self: @T, offset: u32) -> Option<u64>
word_u64_le
Reads consecutive bytes from a specified offset as an unsigned integer in little endian
Arguments
offset- the start location of the consecutive bytes to read
Returns
Option<u64>- Returns an integer if there are enough consecutive bytes available in the ByteArray
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::word_u64_le
fn word_u64_le(self: @T, offset: u32) -> Option<u64>
word_u128
Reads consecutive bytes from a specified offset as an unsigned integer in big endian
Arguments
offset- the start location of the consecutive bytes to read
Returns
Option<u128>- Returns an integer if there are enough consecutive bytes available in the ByteArray
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::word_u128
fn word_u128(self: @T, offset: u32) -> Option<u128>
word_u128_le
Reads consecutive bytes from a specified offset as an unsigned integer in little endian
Arguments
offset- the start location of the consecutive bytes to read
Returns
Option<u128>- Returns an integer if there are enough consecutive bytes available in the ByteArray
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::word_u128_le
fn word_u128_le(self: @T, offset: u32) -> Option<u128>
read_u8
Reads a u8 unsigned integer
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u8
fn read_u8(ref self: ByteReaderState<T>) -> Option<u8>
read_u16
Reads a u16 unsigned integer in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u16
fn read_u16(ref self: ByteReaderState<T>) -> Option<u16>
read_u16_le
Reads a u16 unsigned integer in little endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u16_le
fn read_u16_le(ref self: ByteReaderState<T>) -> Option<u16>
read_u32
Reads a u32 unsigned integer in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u32
fn read_u32(ref self: ByteReaderState<T>) -> Option<u32>
read_u32_le
Reads a u32 unsigned integer in little endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u32_le
fn read_u32_le(ref self: ByteReaderState<T>) -> Option<u32>
read_u64
Reads a u64 unsigned integer in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u64
fn read_u64(ref self: ByteReaderState<T>) -> Option<u64>
read_u64_le
Reads a u64 unsigned integer in little endian byte order
Returns
Option<u64> - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u64_le
fn read_u64_le(ref self: ByteReaderState<T>) -> Option<u64>
read_u128
Reads a u128 unsigned integer in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u128
fn read_u128(ref self: ByteReaderState<T>) -> Option<u128>
read_u128_le
Reads a u128 unsigned integer in little endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u128_le
fn read_u128_le(ref self: ByteReaderState<T>) -> Option<u128>
read_u256
Reads a u256 unsigned integer in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u256
fn read_u256(ref self: ByteReaderState<T>) -> Option<u256>
read_u256_le
Reads a u256 unsigned integer in little endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u256_le
fn read_u256_le(ref self: ByteReaderState<T>) -> Option<u256>
read_u512
Reads a u512 unsigned integer in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u512
fn read_u512(ref self: ByteReaderState<T>) -> Option<u512>
read_u512_le
Reads a u512 unsigned integer in little endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_u512_le
fn read_u512_le(ref self: ByteReaderState<T>) -> Option<u512>
read_i8
Reads an i8 signed integer in two’s complement encoding from the ByteArray
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_i8
fn read_i8(ref self: ByteReaderState<T>) -> Option<i8>
read_i16
Reads an i16 signed integer in two’s complement encoding from the ByteArray in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_i16
fn read_i16(ref self: ByteReaderState<T>) -> Option<i16>
read_i16_le
Reads an i16 signed integer in two’s complement encoding from the ByteArray in little endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_i16_le
fn read_i16_le(ref self: ByteReaderState<T>) -> Option<i16>
read_i32
Reads an i32 signed integer in two’s complement encoding from the ByteArray in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_i32
fn read_i32(ref self: ByteReaderState<T>) -> Option<i32>
read_i32_le
Reads an i32 signed integer in two’s complement encoding from the ByteArray in little endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_i32_le
fn read_i32_le(ref self: ByteReaderState<T>) -> Option<i32>
read_i64
Reads an i64 signed integer in two’s complement encoding from the ByteArray in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_i64
fn read_i64(ref self: ByteReaderState<T>) -> Option<i64>
read_i64_le
Reads an i64 signed integer in two’s complement encoding from the ByteArray in little endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_i64_le
fn read_i64_le(ref self: ByteReaderState<T>) -> Option<i64>
read_i128
Reads an i128 signed integer in two’s complement encoding from the ByteArray in big endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_i128
fn read_i128(ref self: ByteReaderState<T>) -> Option<i128>
read_i128_le
Reads an i128 signed integer in two’s complement encoding from the ByteArray in little endian byte order
Returns
*Option` - If there are enough bytes remaining an optional integer is returned
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::read_i128_le
fn read_i128_le(ref self: ByteReaderState<T>) -> Option<i128>
len
Remaining length count relative to what has already been consume/read
Returns
*usize` - count number of bytes remaining
Fully qualified path: alexandria_data_structures::byte_reader::ByteReader::len
fn len(self: @ByteReaderState<T>) -> u32