pub trait AsyncRead {
// Required method
fn read(&self, buf: &mut [u8]) -> impl Future<Output = Result<usize>> + Send;
}Expand description
Async byte-stream read, implemented by every socket-like stream type in this crate on both backends.
Exists purely so BufReader/copy below can be written once
instead of duplicated per stream type per backend — not meant as a
general-purpose extension point the way tokio::io::AsyncRead is.
&self, not &mut self: matches every implementor’s own inherent
read method, which already supports concurrent calls from different
tasks via a shared reference. See this module’s parent doc for why
that means no split() is needed here.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".