Trait BinaryReadExt
Source pub trait BinaryReadExt: Input<Item = u8> {
Show 32 methods
// Provided methods
fn read_u8(&mut self) -> Result<u8> { ... }
fn read_i8(&mut self) -> Result<i8> { ... }
fn read_u16(&mut self, byte_order: ByteOrder) -> Result<u16> { ... }
fn read_u16_be(&mut self) -> Result<u16> { ... }
fn read_u16_le(&mut self) -> Result<u16> { ... }
fn read_u32(&mut self, byte_order: ByteOrder) -> Result<u32> { ... }
fn read_u32_be(&mut self) -> Result<u32> { ... }
fn read_u32_le(&mut self) -> Result<u32> { ... }
fn read_u64(&mut self, byte_order: ByteOrder) -> Result<u64> { ... }
fn read_u64_be(&mut self) -> Result<u64> { ... }
fn read_u64_le(&mut self) -> Result<u64> { ... }
fn read_u128(&mut self, byte_order: ByteOrder) -> Result<u128> { ... }
fn read_u128_be(&mut self) -> Result<u128> { ... }
fn read_u128_le(&mut self) -> Result<u128> { ... }
fn read_i16(&mut self, byte_order: ByteOrder) -> Result<i16> { ... }
fn read_i16_be(&mut self) -> Result<i16> { ... }
fn read_i16_le(&mut self) -> Result<i16> { ... }
fn read_i32(&mut self, byte_order: ByteOrder) -> Result<i32> { ... }
fn read_i32_be(&mut self) -> Result<i32> { ... }
fn read_i32_le(&mut self) -> Result<i32> { ... }
fn read_i64(&mut self, byte_order: ByteOrder) -> Result<i64> { ... }
fn read_i64_be(&mut self) -> Result<i64> { ... }
fn read_i64_le(&mut self) -> Result<i64> { ... }
fn read_i128(&mut self, byte_order: ByteOrder) -> Result<i128> { ... }
fn read_i128_be(&mut self) -> Result<i128> { ... }
fn read_i128_le(&mut self) -> Result<i128> { ... }
fn read_f32(&mut self, byte_order: ByteOrder) -> Result<f32> { ... }
fn read_f32_be(&mut self) -> Result<f32> { ... }
fn read_f32_le(&mut self) -> Result<f32> { ... }
fn read_f64(&mut self, byte_order: ByteOrder) -> Result<f64> { ... }
fn read_f64_be(&mut self) -> Result<f64> { ... }
fn read_f64_le(&mut self) -> Result<f64> { ... }
}
Expand description
Extension methods for reading fixed-width binary values from byte streams.
§Examples
use std::io::Cursor;
use qubit_io_binary::BinaryReadExt;
let mut input = Cursor::new([0x12, 0x34]);
assert_eq!(input.read_u16_be().unwrap(), 0x1234);
Reads an unsigned 8-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a signed 8-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads an unsigned 16-bit integer using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian unsigned 16-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian unsigned 16-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads an unsigned 32-bit integer using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian unsigned 32-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian unsigned 32-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads an unsigned 64-bit integer using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian unsigned 64-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian unsigned 64-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads an unsigned 128-bit integer using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian unsigned 128-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian unsigned 128-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a signed 16-bit integer using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian signed 16-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian signed 16-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a signed 32-bit integer using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian signed 32-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian signed 32-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a signed 64-bit integer using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian signed 64-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian signed 64-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a signed 128-bit integer using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian signed 128-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian signed 128-bit integer.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a 32-bit float using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian 32-bit float.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian 32-bit float.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a 64-bit float using a runtime byte order.
§Parameters
byte_order: Byte order used to decode the value.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a big-endian 64-bit float.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
Reads a little-endian 64-bit float.
§Returns
Returns the decoded scalar.
§Errors
Returns an input error, including an unexpected-end-of-input error
when a complete scalar is unavailable.
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".