Skip to main content

AsyncZigZagWriteExt

Trait AsyncZigZagWriteExt 

Source
pub trait AsyncZigZagWriteExt: AsyncOutput<Item = u8> {
    // Provided methods
    fn write_zig_zag_i8_async(
        &mut self,
        value: i8,
    ) -> impl Future<Output = Result<()>> + '_
       where Self: Unpin { ... }
    fn write_zig_zag_i16_async(
        &mut self,
        value: i16,
    ) -> impl Future<Output = Result<()>> + '_
       where Self: Unpin { ... }
    fn write_zig_zag_i32_async(
        &mut self,
        value: i32,
    ) -> impl Future<Output = Result<()>> + '_
       where Self: Unpin { ... }
    fn write_zig_zag_i64_async(
        &mut self,
        value: i64,
    ) -> impl Future<Output = Result<()>> + '_
       where Self: Unpin { ... }
    fn write_zig_zag_i128_async(
        &mut self,
        value: i128,
    ) -> impl Future<Output = Result<()>> + '_
       where Self: Unpin { ... }
    fn write_zig_zag_isize_async(
        &mut self,
        value: isize,
    ) -> impl Future<Output = Result<()>> + '_
       where Self: Unpin { ... }
}
Expand description

Future-based ZigZag plus unsigned-LEB128 writes.

§Cancellation safety

These writes are not cancellation safe. Dropping a pending future leaves an already-written prefix in the output.

§Examples

use qubit_io::AsyncOutput;
use qubit_io_binary::AsyncZigZagWriteExt;

async fn write_value<O>(output: &mut O) -> std::io::Result<()>
where
    O: AsyncOutput<Item = u8> + Unpin,
{
    output.write_zig_zag_i32_async(-150).await
}

Provided Methods§

Source

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

Asynchronously writes ZigZag i8.

§Parameters
  • value: Signed integer to encode and write.
§Returns

Returns a future that completes after the encoded payload has 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_zig_zag_i16_async( &mut self, value: i16, ) -> impl Future<Output = Result<()>> + '_
where Self: Unpin,

Asynchronously writes ZigZag i16.

§Parameters
  • value: Signed integer to encode and write.
§Returns

Returns a future that completes after the encoded payload has 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_zig_zag_i32_async( &mut self, value: i32, ) -> impl Future<Output = Result<()>> + '_
where Self: Unpin,

Asynchronously writes ZigZag i32.

§Parameters
  • value: Signed integer to encode and write.
§Returns

Returns a future that completes after the encoded payload has 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_zig_zag_i64_async( &mut self, value: i64, ) -> impl Future<Output = Result<()>> + '_
where Self: Unpin,

Asynchronously writes ZigZag i64.

§Parameters
  • value: Signed integer to encode and write.
§Returns

Returns a future that completes after the encoded payload has 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_zig_zag_i128_async( &mut self, value: i128, ) -> impl Future<Output = Result<()>> + '_
where Self: Unpin,

Asynchronously writes ZigZag i128.

§Parameters
  • value: Signed integer to encode and write.
§Returns

Returns a future that completes after the encoded payload has 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_zig_zag_isize_async( &mut self, value: isize, ) -> impl Future<Output = Result<()>> + '_
where Self: Unpin,

Asynchronously writes ZigZag isize.

§Parameters
  • value: Signed integer to encode and write.
§Returns

Returns a future that completes after the encoded payload has 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> AsyncZigZagWriteExt for W
where W: AsyncOutput<Item = u8> + ?Sized,