jetstream_wireformat::wire_format_extensions::tokio

Trait AsyncWireFormatExt

pub trait AsyncWireFormatExtwhere
    Self: WireFormat + Send,{
    // Provided methods
    fn encode_async<W>(self, writer: W) -> impl Future<Output = Result<()>>
       where Self: Sync,
             W: AsyncWrite + Unpin + Send { ... }
    fn decode_async<R>(reader: R) -> impl Future<Output = Result<Self>> + Send
       where Self: Sync,
             R: AsyncRead + Unpin + Send { ... }
}

Extension trait for asynchronous wire format encoding and decoding.

Provided Methods

fn encode_async(self, writer: W) -> impl Future<Output = Result<()>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer.

Arguments
  • writer - The writer to encode the object into.n
Returns

A future that resolves to an io::Result<()> indicating the success or failure of the encoding operation.

fn decode_async(reader: R) -> impl Future<Output = Result> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader.

Arguments
  • reader - The reader to decode the object from.
Returns

A future that resolves to an io::Result<Self> indicating the success or failure of the decoding operation.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

impl<T: WireFormat + Send> AsyncWireFormatExt for T

Implements the AsyncWireFormatExt trait for types that implement the WireFormat trait and can be sent across threads.