Trait binary_utils::ListDataReader

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

A trait for types that need to be read from a binary stream but have an context based size

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_list( reader: &mut (impl AsyncRead + Unpin), length: usize ) -> 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.
  • length - A length, how much data is contained, because the size is context based
§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§