Dex.Promise¶
- Subclasses:
None
Methods¶
- Inherited:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
None
Fields¶
None
Class Details¶
- class Dex.Promise¶
- Bases:
- Abstract:
No
Dex.Promise
is a convenientDex.Future
for prpoagating a result or rejection in appliction and library code.Use this when there is not a more specialized
Dex.Future
for your needs to propagate a result or rejection to the caller in an asynchronous fashion.- classmethod new()¶
- Return type:
- classmethod new_cancellable()¶
- Returns:
- Return type:
Creates a new
Dex.Promise
that can propagate cancellation if the promise is discarded.This can be used to plumb cancellation between promises and
Gio.AsyncReadyCallback
based APIs.
- get_cancellable()¶
- Returns:
a
Gio.Cancellable
orNone
- Return type:
Gets a
Gio.Cancellable
that will cancel when the promise has been discarded (and therefore result no longer necessary).This is useful when manually implementing wrappers around various
Gio.AsyncReadyCallback
based API.If self was created with
Dex.Promise.new
(), thenNone
is returned.
- reject(error)¶
- Parameters:
error (
GLib.Error
) – aGLib.Error
Marks the promise as rejected, indicating a failure.
- resolve(value)¶
- Parameters:
value (
GObject.Value
) – aGObject.Value
containing the resolved value
Sets the result for a
Dex.Promise
.
- resolve_object(object)¶
- Parameters:
object (
object
orNone
) – aGObject.Object