pub trait AsyncReadExt: AsyncRead + Unpin {
// Provided method
fn try_read_exact<'life0, 'async_trait, const N: usize>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<[u8; N]>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Extension trait for AsyncRead
.
Provided Methods§
Sourcefn try_read_exact<'life0, 'async_trait, const N: usize>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<[u8; N]>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn try_read_exact<'life0, 'async_trait, const N: usize>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<[u8; N]>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Reads the exact number of bytes, like read_exact
, but returns None
if it gets EOF at
the start of the read. In other words, this is the “all or nothing” version of read
.
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.