Trait ReadReady
pub trait ReadReady: ErrorType {
// Required method
fn read_ready(&mut self) -> Result<bool, Self::Error>;
}Expand description
Get whether a reader is ready.
This allows using a [Read] or [BufRead] in a nonblocking fashion, i.e. trying to read
only when it is ready.
Required Methods§
fn read_ready(&mut self) -> Result<bool, Self::Error>
fn read_ready(&mut self) -> Result<bool, Self::Error>
Get whether the reader is ready for immediately reading.
This usually means that there is either some bytes have been received and are buffered and ready to be read, or that the reader is at EOF.
If this returns true, it’s guaranteed that the next call to [Read::read] or [BufRead::fill_buf] will not block.