pub trait AsyncRead<Err: Into<Error>> {
// Required method
fn read_exact<'a>(
&'a mut self,
buf: &'a mut [u8],
) -> impl Future<Output = Result<(), Err>>;
}Expand description
Generic asynchronous read trait similar to std::io::Read.
The instances of AsyncRead are required to construct AsyncReceiver that can read
MavLink frames.
Instead of relying on a particular definition of read trait, we allow users to use any library with I/O capabilities.
Wrappers are available for specific I/O implementations:
Required Methods§
Sourcefn read_exact<'a>(
&'a mut self,
buf: &'a mut [u8],
) -> impl Future<Output = Result<(), Err>>
fn read_exact<'a>( &'a mut self, buf: &'a mut [u8], ) -> impl Future<Output = Result<(), Err>>
Reads asynchronously the exact number of bytes required to fill the buffer.
Mimics the corresponding method from std::io::Read.
§Errors
Returns generic error in case of I/O failure.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.