Skip to main content

AsyncBinaryWriteExt

Trait AsyncBinaryWriteExt 

Source
pub trait AsyncBinaryWriteExt: AsyncOutput<Item = u8> {
Show 32 methods // Provided methods fn write_u8_async( &mut self, value: u8, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i8_async( &mut self, value: i8, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u16_async( &mut self, value: u16, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u16_be_async( &mut self, value: u16, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u16_le_async( &mut self, value: u16, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u32_async( &mut self, value: u32, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u32_be_async( &mut self, value: u32, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u32_le_async( &mut self, value: u32, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u64_async( &mut self, value: u64, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u64_be_async( &mut self, value: u64, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u64_le_async( &mut self, value: u64, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u128_async( &mut self, value: u128, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u128_be_async( &mut self, value: u128, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_u128_le_async( &mut self, value: u128, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i16_async( &mut self, value: i16, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i16_be_async( &mut self, value: i16, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i16_le_async( &mut self, value: i16, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i32_async( &mut self, value: i32, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i32_be_async( &mut self, value: i32, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i32_le_async( &mut self, value: i32, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i64_async( &mut self, value: i64, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i64_be_async( &mut self, value: i64, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i64_le_async( &mut self, value: i64, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i128_async( &mut self, value: i128, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i128_be_async( &mut self, value: i128, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_i128_le_async( &mut self, value: i128, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_f32_async( &mut self, value: f32, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_f32_be_async( &mut self, value: f32, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_f32_le_async( &mut self, value: f32, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_f64_async( &mut self, value: f64, byte_order: ByteOrder, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_f64_be_async( &mut self, value: f64, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... } fn write_f64_le_async( &mut self, value: f64, ) -> impl Future<Output = Result<()>> + '_ where Self: Unpin { ... }
}
Expand description

Future-based fixed-width binary writes to runtime-neutral async outputs.

§Cancellation safety

These writes are not cancellation safe. Dropping a pending future leaves any already-written prefix in the output; retrying can duplicate that prefix.

§Examples

Define a generic async helper that writes a big-endian marker:

use qubit_io::AsyncOutput;
use qubit_io_binary::AsyncBinaryWriteExt;

async fn write_marker<O>(output: &mut O) -> std::io::Result<()>
where
    O: AsyncOutput<Item = u8> + Unpin,
{
    output.write_u32_be_async(0x5142_4954).await
}

Provided Methods§

Source

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

Asynchronously writes an unsigned 8-bit integer.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a signed 8-bit integer.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a u16 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian u16.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian u16.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a u32 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian u32.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian u32.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a u64 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian u64.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian u64.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a u128 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian u128.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian u128.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes an i16 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian i16.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian i16.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes an i32 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian i32.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian i32.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes an i64 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian i64.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian i64.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes an i128 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian i128.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian i128.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes an f32 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian f32.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian f32.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes an f64 using a runtime byte order.

§Parameters
  • value: Value to encode and write.
  • byte_order: Byte order used to encode the value.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a big-endian f64.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Source

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

Asynchronously writes a little-endian f64.

§Parameters
  • value: Value to encode and write.
§Returns

Returns a future that completes after all encoded bytes have been written.

§Errors

Returns an output error, including a write-zero error when the output stops making progress.

§Cancellation safety

This operation is not cancellation safe. Dropping the future retains any bytes already written to the output.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<W> AsyncBinaryWriteExt for W
where W: AsyncOutput<Item = u8> + ?Sized,