Trait ReadAsync

Source
pub trait ReadAsync<'a, T, FRead, FReadExact>
where FRead: Future<Output = Result<usize, Error>> + 'a,
{ // Required methods fn read(&'a mut self, bytes: &'a mut [u8]) -> FRead; fn read_exact(&'a mut self, bytes: &'a mut [u8]) -> FReadExact; }
Expand description

Trait that adds async variants of some std::io::Read functions.

Required Methods§

Source

fn read(&'a mut self, bytes: &'a mut [u8]) -> FRead

Async equivalent to std::io::Read::read.

Source

fn read_exact(&'a mut self, bytes: &'a mut [u8]) -> FReadExact

Async equivalent to std::io::Read::read_exact. This MAY read more bytes than the length of the array if needed (namely, when using UdpSockets), but will avoid doing so to the best of its ability.

Implementors§

Source§

impl<'a, T> ReadAsync<'a, usize, ReadFuture<'a, T>, ReadExactFuture<'a, T>> for T
where ReadFuture<'a, T>: Future<Output = Result<usize, Error>> + 'a, ReadExactFuture<'a, T>: Future<Output = Result<(), Error>> + 'a,