Trait gio::prelude::SocketAddressEnumeratorExt

source ·
pub trait SocketAddressEnumeratorExt: IsA<SocketAddressEnumerator> + Sealed + 'static {
    // Provided methods
    fn next(
        &self,
        cancellable: Option<&impl IsA<Cancellable>>,
    ) -> Result<Option<SocketAddress>, Error> { ... }
    fn next_async<P: FnOnce(Result<Option<SocketAddress>, Error>) + 'static>(
        &self,
        cancellable: Option<&impl IsA<Cancellable>>,
        callback: P,
    ) { ... }
    fn next_future(
        &self,
    ) -> Pin<Box_<dyn Future<Output = Result<Option<SocketAddress>, Error>> + 'static>> { ... }
}
Expand description

Trait containing all SocketAddressEnumerator methods.

§Implementors

SocketAddressEnumerator

Provided Methods§

source

fn next( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<Option<SocketAddress>, Error>

Retrieves the next #GSocketAddress from @self. Note that this may block for some amount of time. (Eg, a #GNetworkAddress may need to do a DNS lookup before it can return an address.) Use g_socket_address_enumerator_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 g_socket_address_enumerator_next() will return an appropriate error in *@error. However, if the first call to g_socket_address_enumerator_next() succeeds, then any further internal errors (other than @cancellable being triggered) will be ignored.

§cancellable

optional #GCancellable object, None to ignore.

§Returns

a #GSocketAddress (owned by the caller), or None on error (in which case *@error will be set) or if there are no more addresses.

source

fn next_async<P: FnOnce(Result<Option<SocketAddress>, Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

Asynchronously retrieves the next #GSocketAddress 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 #GCancellable object, None to ignore.

§callback

a #GAsyncReadyCallback to call when the request is satisfied

source

fn next_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<Option<SocketAddress>, Error>> + 'static>>

Object Safety§

This trait is not object safe.

Implementors§