Trait binary_utils::DataWriter
source · pub trait DataWriter {
// Required method
fn write(
&self,
writer: &mut (impl AsyncWrite + Unpin)
) -> impl Future<Output = Result<()>>;
}Expand description
A trait for types that have to be writen to an asyncronous stream
§Notes
This trait is intended to be implemented for types that represent structured data and provide
a method to asynchronously write that data into an output source. Implementations should handle
error conditions appropriately and return a Result indicating success or failure.
Required Methods§
sourcefn write(
&self,
writer: &mut (impl AsyncWrite + Unpin)
) -> impl Future<Output = Result<()>>
fn write( &self, writer: &mut (impl AsyncWrite + Unpin) ) -> impl Future<Output = Result<()>>
Writes the data of the object into the defined writer
§Arguments
writer - A mutable reference to a type implementing AsyncRead and Unpin
§Returns
Returns a future representing the asynchronous writing operation. The future resolves to
a Result containing an instance of () if the operation is successful, or an error
indicating failure.
Object Safety§
This trait is not object safe.