Skip to main content

AsyncBinaryReadExt

Trait AsyncBinaryReadExt 

Source
pub trait AsyncBinaryReadExt: AsyncInput<Item = u8> {
Show 32 methods // Provided methods fn read_u8_async(&mut self) -> impl Future<Output = Result<u8>> + '_ where Self: Unpin { ... } fn read_i8_async(&mut self) -> impl Future<Output = Result<i8>> + '_ where Self: Unpin { ... } fn read_u16_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<u16>> + '_ where Self: Unpin { ... } fn read_u16_be_async(&mut self) -> impl Future<Output = Result<u16>> + '_ where Self: Unpin { ... } fn read_u16_le_async(&mut self) -> impl Future<Output = Result<u16>> + '_ where Self: Unpin { ... } fn read_u32_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<u32>> + '_ where Self: Unpin { ... } fn read_u32_be_async(&mut self) -> impl Future<Output = Result<u32>> + '_ where Self: Unpin { ... } fn read_u32_le_async(&mut self) -> impl Future<Output = Result<u32>> + '_ where Self: Unpin { ... } fn read_u64_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<u64>> + '_ where Self: Unpin { ... } fn read_u64_be_async(&mut self) -> impl Future<Output = Result<u64>> + '_ where Self: Unpin { ... } fn read_u64_le_async(&mut self) -> impl Future<Output = Result<u64>> + '_ where Self: Unpin { ... } fn read_u128_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<u128>> + '_ where Self: Unpin { ... } fn read_u128_be_async(&mut self) -> impl Future<Output = Result<u128>> + '_ where Self: Unpin { ... } fn read_u128_le_async(&mut self) -> impl Future<Output = Result<u128>> + '_ where Self: Unpin { ... } fn read_i16_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<i16>> + '_ where Self: Unpin { ... } fn read_i16_be_async(&mut self) -> impl Future<Output = Result<i16>> + '_ where Self: Unpin { ... } fn read_i16_le_async(&mut self) -> impl Future<Output = Result<i16>> + '_ where Self: Unpin { ... } fn read_i32_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<i32>> + '_ where Self: Unpin { ... } fn read_i32_be_async(&mut self) -> impl Future<Output = Result<i32>> + '_ where Self: Unpin { ... } fn read_i32_le_async(&mut self) -> impl Future<Output = Result<i32>> + '_ where Self: Unpin { ... } fn read_i64_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<i64>> + '_ where Self: Unpin { ... } fn read_i64_be_async(&mut self) -> impl Future<Output = Result<i64>> + '_ where Self: Unpin { ... } fn read_i64_le_async(&mut self) -> impl Future<Output = Result<i64>> + '_ where Self: Unpin { ... } fn read_i128_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<i128>> + '_ where Self: Unpin { ... } fn read_i128_be_async(&mut self) -> impl Future<Output = Result<i128>> + '_ where Self: Unpin { ... } fn read_i128_le_async(&mut self) -> impl Future<Output = Result<i128>> + '_ where Self: Unpin { ... } fn read_f32_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<f32>> + '_ where Self: Unpin { ... } fn read_f32_be_async(&mut self) -> impl Future<Output = Result<f32>> + '_ where Self: Unpin { ... } fn read_f32_le_async(&mut self) -> impl Future<Output = Result<f32>> + '_ where Self: Unpin { ... } fn read_f64_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<f64>> + '_ where Self: Unpin { ... } fn read_f64_be_async(&mut self) -> impl Future<Output = Result<f64>> + '_ where Self: Unpin { ... } fn read_f64_le_async(&mut self) -> impl Future<Output = Result<f64>> + '_ where Self: Unpin { ... }
}
Expand description

Future-based fixed-width binary reads from runtime-neutral async inputs.

§Cancellation safety

These reads are not cancellation safe. Dropping a pending future leaves bytes already consumed from the input consumed; retrying starts at the input’s new position.

§Examples

use qubit_io_binary::AsyncBinaryReadExt;

async fn read_u16<R>(input: &mut R) -> std::io::Result<u16>
where
    R: AsyncBinaryReadExt + Unpin,
{
    input.read_u16_be_async().await
}

Provided Methods§

Source

fn read_u8_async(&mut self) -> impl Future<Output = Result<u8>> + '_
where Self: Unpin,

Asynchronously reads an unsigned 8-bit integer.

§Returns

Returns the decoded u8.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i8_async(&mut self) -> impl Future<Output = Result<i8>> + '_
where Self: Unpin,

Asynchronously reads a signed 8-bit integer.

§Returns

Returns the decoded i8.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u16_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<u16>> + '_
where Self: Unpin,

Asynchronously reads a u16 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded u16.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u16_be_async(&mut self) -> impl Future<Output = Result<u16>> + '_
where Self: Unpin,

Asynchronously reads a big-endian u16.

§Returns

Returns the decoded u16.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u16_le_async(&mut self) -> impl Future<Output = Result<u16>> + '_
where Self: Unpin,

Asynchronously reads a little-endian u16.

§Returns

Returns the decoded u16.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u32_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<u32>> + '_
where Self: Unpin,

Asynchronously reads a u32 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded u32.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u32_be_async(&mut self) -> impl Future<Output = Result<u32>> + '_
where Self: Unpin,

Asynchronously reads a big-endian u32.

§Returns

Returns the decoded u32.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u32_le_async(&mut self) -> impl Future<Output = Result<u32>> + '_
where Self: Unpin,

Asynchronously reads a little-endian u32.

§Returns

Returns the decoded u32.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u64_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<u64>> + '_
where Self: Unpin,

Asynchronously reads a u64 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded u64.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u64_be_async(&mut self) -> impl Future<Output = Result<u64>> + '_
where Self: Unpin,

Asynchronously reads a big-endian u64.

§Returns

Returns the decoded u64.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u64_le_async(&mut self) -> impl Future<Output = Result<u64>> + '_
where Self: Unpin,

Asynchronously reads a little-endian u64.

§Returns

Returns the decoded u64.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u128_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<u128>> + '_
where Self: Unpin,

Asynchronously reads a u128 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded u128.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u128_be_async(&mut self) -> impl Future<Output = Result<u128>> + '_
where Self: Unpin,

Asynchronously reads a big-endian u128.

§Returns

Returns the decoded u128.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_u128_le_async(&mut self) -> impl Future<Output = Result<u128>> + '_
where Self: Unpin,

Asynchronously reads a little-endian u128.

§Returns

Returns the decoded u128.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i16_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<i16>> + '_
where Self: Unpin,

Asynchronously reads an i16 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded i16.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i16_be_async(&mut self) -> impl Future<Output = Result<i16>> + '_
where Self: Unpin,

Asynchronously reads a big-endian i16.

§Returns

Returns the decoded i16.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i16_le_async(&mut self) -> impl Future<Output = Result<i16>> + '_
where Self: Unpin,

Asynchronously reads a little-endian i16.

§Returns

Returns the decoded i16.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i32_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<i32>> + '_
where Self: Unpin,

Asynchronously reads an i32 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded i32.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i32_be_async(&mut self) -> impl Future<Output = Result<i32>> + '_
where Self: Unpin,

Asynchronously reads a big-endian i32.

§Returns

Returns the decoded i32.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i32_le_async(&mut self) -> impl Future<Output = Result<i32>> + '_
where Self: Unpin,

Asynchronously reads a little-endian i32.

§Returns

Returns the decoded i32.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i64_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<i64>> + '_
where Self: Unpin,

Asynchronously reads an i64 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded i64.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i64_be_async(&mut self) -> impl Future<Output = Result<i64>> + '_
where Self: Unpin,

Asynchronously reads a big-endian i64.

§Returns

Returns the decoded i64.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i64_le_async(&mut self) -> impl Future<Output = Result<i64>> + '_
where Self: Unpin,

Asynchronously reads a little-endian i64.

§Returns

Returns the decoded i64.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i128_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<i128>> + '_
where Self: Unpin,

Asynchronously reads an i128 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded i128.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i128_be_async(&mut self) -> impl Future<Output = Result<i128>> + '_
where Self: Unpin,

Asynchronously reads a big-endian i128.

§Returns

Returns the decoded i128.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_i128_le_async(&mut self) -> impl Future<Output = Result<i128>> + '_
where Self: Unpin,

Asynchronously reads a little-endian i128.

§Returns

Returns the decoded i128.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_f32_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<f32>> + '_
where Self: Unpin,

Asynchronously reads an f32 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded f32.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_f32_be_async(&mut self) -> impl Future<Output = Result<f32>> + '_
where Self: Unpin,

Asynchronously reads a big-endian f32.

§Returns

Returns the decoded f32.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_f32_le_async(&mut self) -> impl Future<Output = Result<f32>> + '_
where Self: Unpin,

Asynchronously reads a little-endian f32.

§Returns

Returns the decoded f32.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_f64_async( &mut self, byte_order: ByteOrder, ) -> impl Future<Output = Result<f64>> + '_
where Self: Unpin,

Asynchronously reads an f64 using a runtime byte order.

§Parameters
  • byte_order: Byte order used to decode the value.
§Returns

Returns the decoded f64.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_f64_be_async(&mut self) -> impl Future<Output = Result<f64>> + '_
where Self: Unpin,

Asynchronously reads a big-endian f64.

§Returns

Returns the decoded f64.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Source

fn read_f64_le_async(&mut self) -> impl Future<Output = Result<f64>> + '_
where Self: Unpin,

Asynchronously reads a little-endian f64.

§Returns

Returns the decoded f64.

§Errors

Returns an input error, including an unexpected-end-of-input error when a complete value is unavailable.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already consumed from the input.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<R> AsyncBinaryReadExt for R
where R: AsyncInput<Item = u8> + ?Sized,