AsyncWireFormatExt

Trait AsyncWireFormatExt 

Source
pub trait AsyncWireFormatExt
where 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 { ... } }
Expand description

Extension trait for asynchronous wire format encoding and decoding.

Provided Methods§

Source

fn encode_async<W>(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.

Source

fn decode_async<R>(reader: R) -> impl Future<Output = Result<Self>> + Send
where 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§

Source§

impl<T: WireFormat + Send> AsyncWireFormatExt for T

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