[][src]Trait gio::SocketAddressEnumeratorExt

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>>; }

Trait containing all SocketAddressEnumerator methods.

Implementors

SocketAddressEnumerator

Required methods

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 SocketAddressEnumeratorExt::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 SocketAddressEnumeratorExt::next will return an appropriate error in *error. However, if the first call to SocketAddressEnumeratorExt::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
)

Asynchronously retrieves the next SocketAddress from self and then calls callback, which must call SocketAddressEnumeratorExt::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

user_data

the data to pass to callback function

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

Loading content...

Implementors

impl<O: IsA<SocketAddressEnumerator>> SocketAddressEnumeratorExt for O[src]

Loading content...