[−][src]Trait gio::prelude::PollableInputStreamExtManual
Required methods
fn create_source<F, C>(
&self,
cancellable: Option<&C>,
name: Option<&str>,
priority: Priority,
func: F
) -> Source where
F: FnMut(&Self) -> Continue + 'static,
C: IsA<Cancellable>,
&self,
cancellable: Option<&C>,
name: Option<&str>,
priority: Priority,
func: F
) -> Source where
F: FnMut(&Self) -> Continue + 'static,
C: IsA<Cancellable>,
Creates a glib::Source
that triggers when self
can be read, or
cancellable
is triggered or an error occurs. The callback on the
source is of the GPollableSourceFunc
type.
As with PollableInputStream::is_readable
, it is possible that
the stream may not actually be readable even after the source
triggers, so you should use PollableInputStream::read_nonblocking
rather than InputStream::read
from the callback.
cancellable
a Cancellable
, or None
Returns
a new glib::Source
fn create_source_future<C: IsA<Cancellable>>(
&self,
cancellable: Option<&C>,
priority: Priority
) -> Pin<Box<dyn Future<Output = ()> + 'static>>
&self,
cancellable: Option<&C>,
priority: Priority
) -> Pin<Box<dyn Future<Output = ()> + 'static>>
fn create_source_stream<C: IsA<Cancellable>>(
&self,
cancellable: Option<&C>,
priority: Priority
) -> Pin<Box<dyn Stream<Item = ()> + 'static>>
&self,
cancellable: Option<&C>,
priority: Priority
) -> Pin<Box<dyn Stream<Item = ()> + 'static>>
fn read_nonblocking<C: IsA<Cancellable>>(
&self,
buffer: &mut [u8],
cancellable: Option<&C>
) -> Result<isize, Error>
&self,
buffer: &mut [u8],
cancellable: Option<&C>
) -> Result<isize, Error>
Attempts to read up to count
bytes from self
into buffer
, as
with InputStream::read
. If self
is not currently readable,
this will immediately return IOErrorEnum::WouldBlock
, and you can
use PollableInputStream::create_source
to create a glib::Source
that will be triggered when self
is readable.
Note that since this method never blocks, you cannot actually
use cancellable
to cancel it. However, it will return an error
if cancellable
has already been cancelled when you call, which
may happen if you call this method after a source triggers due
to having been cancelled.
buffer
a buffer to
read data into (which should be at least count
bytes long).
count
the number of bytes you want to read
cancellable
a Cancellable
, or None
Returns
the number of bytes read, or -1 on error (including
IOErrorEnum::WouldBlock
).
Provided methods
fn into_async_read(self) -> Result<InputStreamAsyncRead<Self>, Self> where
Self: IsA<PollableInputStream>,
Self: IsA<PollableInputStream>,
Implementors
impl<O: IsA<PollableInputStream>> PollableInputStreamExtManual for O
[src]
fn create_source<F, C>(
&self,
cancellable: Option<&C>,
name: Option<&str>,
priority: Priority,
func: F
) -> Source where
F: FnMut(&Self) -> Continue + 'static,
C: IsA<Cancellable>,
[src]
&self,
cancellable: Option<&C>,
name: Option<&str>,
priority: Priority,
func: F
) -> Source where
F: FnMut(&Self) -> Continue + 'static,
C: IsA<Cancellable>,
fn read_nonblocking<C: IsA<Cancellable>>(
&self,
buffer: &mut [u8],
cancellable: Option<&C>
) -> Result<isize, Error>
[src]
&self,
buffer: &mut [u8],
cancellable: Option<&C>
) -> Result<isize, Error>
fn create_source_future<C: IsA<Cancellable>>(
&self,
cancellable: Option<&C>,
priority: Priority
) -> Pin<Box<dyn Future<Output = ()> + 'static>>
[src]
&self,
cancellable: Option<&C>,
priority: Priority
) -> Pin<Box<dyn Future<Output = ()> + 'static>>
fn create_source_stream<C: IsA<Cancellable>>(
&self,
cancellable: Option<&C>,
priority: Priority
) -> Pin<Box<dyn Stream<Item = ()> + 'static>>
[src]
&self,
cancellable: Option<&C>,
priority: Priority
) -> Pin<Box<dyn Stream<Item = ()> + 'static>>