Trait binary_utils::DataReader

source ·
pub trait DataReader: Sized {
    // Required method
    fn read(
        reader: &mut (impl AsyncRead + Unpin)
    ) -> impl Future<Output = Result<Self>>;
}
Expand description

A trait for types that need to be read from a binary stream

Implementations of this trait provide a way to write their data asyncronously to a type that implements AsyncRead and Unpin

§Notes

This trait is intended to be implemented for types that represent structured data and provide a method to asynchronously read that data from an input source. Implementations should handle error conditions appropriately and return a Result indicating success or failure.

Required Methods§

source

fn read( reader: &mut (impl AsyncRead + Unpin) ) -> impl Future<Output = Result<Self>>

§Arguments
  • reader - A mutable reference to a type implementing AsyncRead and Unpin traits, from which the data will be read.
§Returns

Returns a future representing the asynchronous reading operation. The future resolves to a Result containing an instance of Self if the operation is successful, or an error indicating failure.

Object Safety§

This trait is not object safe.

Implementors§