Trait gio::prelude::PollableInputStreamExt[][src]

pub trait PollableInputStreamExt: 'static {
    fn can_poll(&self) -> bool;
fn is_readable(&self) -> bool; }
Expand description

Required methods

Checks if self is actually pollable. Some classes may implement PollableInputStream but have only certain instances of that class be pollable. If this method returns false, then the behavior of other PollableInputStream methods is undefined.

For any given stream, the value returned by this method is constant; a stream cannot switch from pollable to non-pollable or vice versa.

Returns

true if self is pollable, false if not.

Checks if self can be read.

Note that some stream types may not be able to implement this 100% reliably, and it is possible that a call to InputStreamExtManual::read() after this returns true would still block. To guarantee non-blocking behavior, you should always use PollableInputStreamExtManual::read_nonblocking(), which will return a IOErrorEnum::WouldBlock error rather than blocking.

Returns

true if self is readable, false if not. If an error has occurred on self, this will result in is_readable() returning true, and the next attempt to read will return the error.

Implementors