Class Eina.Future
Futures are the structures holding the callbacks to be notified of a promise fullfillment or cancellation.
Constructors
Future(Promise, Future.ResolvedCb)
Creates a Future attached to the given Promise.
Optionally a resolved callback may be provided. If so, it will be chained before the returned future.
Declaration
public Future(Promise promise, Future.ResolvedCb cb = null)
Parameters
Type | Name | Description |
---|---|---|
Eina.Promise | promise | |
Eina.Future.ResolvedCb | cb |
Future(IntPtr)
Creates a Future from a native pointer.
Declaration
public Future(IntPtr handle)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | handle |
Methods
Cancel()
Cancels this future and the chain it belongs to, along with the promise linked against it.
The callbacks will still be called with Eina.Error.ECANCELED as payload. The promise cancellation callback will also be called if present.
Declaration
public void Cancel()
Chain(IEnumerable<Future.ResolvedCb>)
Helper method for chaining a group of callbacks in a single go.
It is just syntatic sugar for sequential Then() calls, without creating intermediate futures explicitly.
Declaration
public Future Chain(IEnumerable<Future.ResolvedCb> cbs)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Eina.Future.ResolvedCb> | cbs |
Returns
Type | Description |
---|---|
Eina.Future |
Then(Future.ResolvedCb)
Creates a new future to be called after this one.
Once the promise this future is attached to resolves, the callbacks on the chain are called in the order they were chained.
CAUTION: Calling Then() on a future that had it called before will replace the previous chain from this point on.
Declaration
public Future Then(Future.ResolvedCb cb)
Parameters
Type | Name | Description |
---|---|---|
Eina.Future.ResolvedCb | cb |
Returns
Type | Description |
---|---|
Eina.Future |