pub trait SocketAddressEnumeratorExt: 'static {
    // Required 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

Required Methods§

source

fn next( &self, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<Option<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.

source

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

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

source

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

Implementors§