Trait gj::io::AsyncRead
[−]
[src]
pub trait AsyncRead: 'static { fn try_read<T>(self, buf: T, min_bytes: usize) -> Promise<(Self, T, usize), Error<(Self, T)>> where T: AsMut<[u8]>, Self: Sized; fn read<T>(self, buf: T, min_bytes: usize) -> Promise<(Self, T, usize), Error<(Self, T)>> where T: AsMut<[u8]>, Self: Sized { ... } }
A nonblocking input bytestream.
Required Methods
fn try_read<T>(self, buf: T, min_bytes: usize) -> Promise<(Self, T, usize), Error<(Self, T)>> where T: AsMut<[u8]>, Self: Sized
Attempts to read buf.len()
bytes from the stream, writing them into buf
.
Returns self
, the modified buf
, and the number of bytes actually read.
Returns as soon as min_bytes
are read or EOF is encountered.
Provided Methods
fn read<T>(self, buf: T, min_bytes: usize) -> Promise<(Self, T, usize), Error<(Self, T)>> where T: AsMut<[u8]>, Self: Sized
Like try_read()
, but returns an error if EOF is encountered before min_bytes
can be read.
Implementors
impl AsyncRead for Stream