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 modifiedbuf,and the number of bytes actually read. Returns as soon asmin_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