Trait gio::prelude::SocketAddressEnumeratorExt [−][src]
pub trait SocketAddressEnumeratorExt: 'static { fn next<P: IsA<Cancellable>>(
&self,
cancellable: Option<&P>
) -> Result<SocketAddress, Error>; fn next_async<P: IsA<Cancellable>, Q: FnOnce(Result<SocketAddress, Error>) + Send + 'static>(
&self,
cancellable: Option<&P>,
callback: Q
); fn next_async_future(
&self
) -> Pin<Box_<dyn Future<Output = Result<SocketAddress, Error>> + 'static>>; }
Expand description
Required methods
fn next<P: IsA<Cancellable>>(
&self,
cancellable: Option<&P>
) -> Result<SocketAddress, Error>
fn next<P: IsA<Cancellable>>(
&self,
cancellable: Option<&P>
) -> Result<SocketAddress, Error>
Retrieves the next SocketAddress
from self
. Note that this
may block for some amount of time. (Eg, a NetworkAddress
may need
to do a DNS lookup before it can return an address.) Use
next_async()
if you need to avoid
blocking.
If self
is expected to yield addresses, but for some reason
is unable to (eg, because of a DNS error), then the first call to
next()
will return an appropriate error
in *error
. However, if the first call to
next()
succeeds, then any further
internal errors (other than cancellable
being triggered) will be
ignored.
cancellable
optional Cancellable
object, None
to ignore.
Returns
a SocketAddress
(owned by the caller), or None
on
error (in which case *error
will be set) or if there are no
more addresses.
fn next_async<P: IsA<Cancellable>, Q: FnOnce(Result<SocketAddress, Error>) + Send + 'static>(
&self,
cancellable: Option<&P>,
callback: Q
)
fn next_async<P: IsA<Cancellable>, Q: FnOnce(Result<SocketAddress, Error>) + Send + 'static>(
&self,
cancellable: Option<&P>,
callback: Q
)
Asynchronously retrieves the next SocketAddress
from self
and then calls callback
, which must call
g_socket_address_enumerator_next_finish()
to get the result.
It is an error to call this multiple times before the previous callback has finished.
cancellable
optional Cancellable
object, None
to ignore.
callback
a GAsyncReadyCallback
to call when the request
is satisfied
fn next_async_future(
&self
) -> Pin<Box_<dyn Future<Output = Result<SocketAddress, Error>> + 'static>>