pub trait PollableInputStreamExt: IsA<PollableInputStream> + 'static {
// Provided methods
fn can_poll(&self) -> bool { ... }
fn is_readable(&self) -> bool { ... }
}
Expand description
Trait containing all PollableInputStream
methods.
§Implementors
ConverterInputStream
, MemoryInputStream
, PollableInputStream
, UnixInputStream
Provided Methods§
Sourcefn can_poll(&self) -> bool
fn can_poll(&self) -> bool
Checks if @self is actually pollable. Some classes may implement
#GPollableInputStream but have only certain instances of that class
be pollable. If this method returns false
, then the behavior of
other #GPollableInputStream 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
Sourcefn is_readable(&self) -> bool
fn is_readable(&self) -> bool
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 g_input_stream_read()
after this returns true
would still block. To guarantee
non-blocking behavior, you should always use
g_pollable_input_stream_read_nonblocking(), which will return a
IOErrorEnum::WouldBlock
error rather than blocking.
The behaviour of this method is undefined if
g_pollable_input_stream_can_poll() returns false
for @self.
§Returns
true
if @self is readable, false
if not. If an error
has occurred on @self, this will result in
g_pollable_input_stream_is_readable() returning true
, and the
next attempt to read will return the error.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.