gi-gio-2.0.35: Gio bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | Safe-Inferred
Language | Haskell2010

GI.Gio.Objects.SocketAddressEnumerator

Contents

- Exported types
- Methods
  - next
  - nextAsync
  - nextFinish

Description

`GSocketAddressEnumerator` is an enumerator type for `SocketAddress` instances. It is returned by enumeration functions such as `socketConnectableEnumerate`, which returns a `GSocketAddressEnumerator` to list each `SocketAddress` which could be used to connect to that `SocketConnectable`.

Enumeration is typically a blocking operation, so the asynchronous methods `socketAddressEnumeratorNextAsync` and `socketAddressEnumeratorNextFinish` should be used where possible.

Each `GSocketAddressEnumerator` can only be enumerated once. Once `socketAddressEnumeratorNext` has returned `NULL`, further enumeration with that `GSocketAddressEnumerator` is not possible, and it can be unreffed.

Synopsis

- newtype SocketAddressEnumerator = SocketAddressEnumerator (ManagedPtr SocketAddressEnumerator)
- class (GObject o, IsDescendantOf SocketAddressEnumerator o) => IsSocketAddressEnumerator o
- toSocketAddressEnumerator :: (MonadIO m, IsSocketAddressEnumerator o) => o -> m SocketAddressEnumerator
- socketAddressEnumeratorNext :: (HasCallStack, MonadIO m, IsSocketAddressEnumerator a, IsCancellable b) => a -> Maybe b -> m (Maybe SocketAddress)
- socketAddressEnumeratorNextAsync :: (HasCallStack, MonadIO m, IsSocketAddressEnumerator a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- socketAddressEnumeratorNextFinish :: (HasCallStack, MonadIO m, IsSocketAddressEnumerator a, IsAsyncResult b) => a -> b -> m (Maybe SocketAddress)

# Exported types

newtype SocketAddressEnumerator Source #

Memory-managed wrapper type.

Constructors

SocketAddressEnumerator (ManagedPtr SocketAddressEnumerator) |

#### Instances

Instances details

Eq SocketAddressEnumerator Source # |
Instance details Defined in GI.Gio.Objects.SocketAddressEnumerator Methods (==) :: SocketAddressEnumerator -> SocketAddressEnumerator -> Bool Source # (/=) :: SocketAddressEnumerator -> SocketAddressEnumerator -> Bool Source #
GObject SocketAddressEnumerator Source # |
Instance details Defined in GI.Gio.Objects.SocketAddressEnumerator
ManagedPtrNewtype SocketAddressEnumerator Source # |
Instance details Defined in GI.Gio.Objects.SocketAddressEnumerator Methods toManagedPtr :: SocketAddressEnumerator -> ManagedPtr SocketAddressEnumerator Source #
TypedObject SocketAddressEnumerator Source # |
Instance details Defined in GI.Gio.Objects.SocketAddressEnumerator Methods glibType :: IO GType Source #
HasParentTypes SocketAddressEnumerator Source # |
Instance details Defined in GI.Gio.Objects.SocketAddressEnumerator
IsGValue (Maybe SocketAddressEnumerator) Source # | Convert `SocketAddressEnumerator` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Objects.SocketAddressEnumerator Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe SocketAddressEnumerator -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe SocketAddressEnumerator) Source #
type ParentTypes SocketAddressEnumerator Source # |
Instance details Defined in GI.Gio.Objects.SocketAddressEnumerator type ParentTypes SocketAddressEnumerator = '[Object]

class (GObject o, IsDescendantOf SocketAddressEnumerator o) => IsSocketAddressEnumerator o Source #

Type class for types which can be safely cast to `SocketAddressEnumerator`, for instance with `toSocketAddressEnumerator`.

#### Instances

Instances details

(GObject o, IsDescendantOf SocketAddressEnumerator o) => IsSocketAddressEnumerator o Source # |
Instance details Defined in GI.Gio.Objects.SocketAddressEnumerator

toSocketAddressEnumerator :: (MonadIO m, IsSocketAddressEnumerator o) => o -> m SocketAddressEnumerator Source #

Cast to `SocketAddressEnumerator`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, next, nextAsync, nextFinish, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getData, getProperty, getQdata.

#### Setters

setData, setDataFull, setProperty.

## next

socketAddressEnumeratorNext Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketAddressEnumerator a, IsCancellable b) |
=> a | `enumerator`: a `SocketAddressEnumerator`
-> Maybe b | `cancellable`: optional `Cancellable` object, `Nothing` to ignore.
-> m (Maybe SocketAddress) | Returns: a `SocketAddress` (owned by the caller), or `Nothing` on error (in which case *`error` will be set) or if there are no more addresses. (Can throw `GError`)

Retrieves the next `SocketAddress` from `enumerator`. 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 `socketAddressEnumeratorNextAsync` if you need to avoid blocking.

If `enumerator` is expected to yield addresses, but for some reason is unable to (eg, because of a DNS error), then the first call to `socketAddressEnumeratorNext` will return an appropriate error in *`error`. However, if the first call to `socketAddressEnumeratorNext` succeeds, then any further internal errors (other than `cancellable` being triggered) will be ignored.

## nextAsync

socketAddressEnumeratorNextAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketAddressEnumerator a, IsCancellable b) |
=> a | `enumerator`: a `SocketAddressEnumerator`
-> Maybe b | `cancellable`: optional `Cancellable` object, `Nothing` to ignore.
-> Maybe AsyncReadyCallback | `callback`: a `AsyncReadyCallback` to call when the request is satisfied
-> m () |

Asynchronously retrieves the next `SocketAddress` from `enumerator` and then calls `callback`, which must call `socketAddressEnumeratorNextFinish` to get the result.

It is an error to call this multiple times before the previous callback has finished.

## nextFinish

socketAddressEnumeratorNextFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketAddressEnumerator a, IsAsyncResult b) |
=> a | `enumerator`: a `SocketAddressEnumerator`
-> b | `result`: a `AsyncResult`
-> m (Maybe SocketAddress) | Returns: a `SocketAddress` (owned by the caller), or `Nothing` on error (in which case *`error` will be set) or if there are no more addresses. (Can throw `GError`)

Retrieves the result of a completed call to `socketAddressEnumeratorNextAsync`. See `socketAddressEnumeratorNext` for more information about error handling.