Trait gjio::AsyncRead
[−]
[src]
pub trait AsyncRead { fn try_read<T>(&mut self, buf: T, min_bytes: usize) -> Promise<(T, usize), Error> where T: AsMut<[u8]>; fn read<T>(&mut self, buf: T, min_bytes: usize) -> Promise<(T, usize), Error> where T: AsMut<[u8]> { ... } }
A nonblocking input bytestream.
Required Methods
fn try_read<T>(&mut self, buf: T, min_bytes: usize) -> Promise<(T, usize), Error> where T: AsMut<[u8]>
Attempts to read buf.len()
bytes from the stream, writing them into buf
.
Returns 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>(&mut self, buf: T, min_bytes: usize) -> Promise<(T, usize), Error> where T: AsMut<[u8]>
Like try_read()
, but returns an error if EOF is encountered before min_bytes
can be read.
Implementors
impl AsyncRead for SocketStream