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 + Sized,
             W: AsyncWrite + Unpin + Send { ... }
    fn decode_async<R>(reader: R) -> impl Future<Output = Result<Self>> + Send
       where Self: Sync + Sized,
             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 + Sized, 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 + Sized, 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.

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.