Dex.Promise¶
- Subclasses:
 None
Methods¶
- Inherited:
 
class  | 
  | 
class  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
None
Fields¶
None
Class Details¶
- class Dex.Promise¶
 - Bases:
 - Abstract:
 No
Dex.Promiseis a convenientDex.Futurefor prpoagating a result or rejection in appliction and library code.Use this when there is not a more specialized
Dex.Futurefor 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.Promisethat can propagate cancellation if the promise is discarded.This can be used to plumb cancellation between promises and
Gio.AsyncReadyCallbackbased APIs.
- get_cancellable()¶
 - Returns:
 a
Gio.CancellableorNone- Return type:
 
Gets a
Gio.Cancellablethat will cancel when the promise has been discarded (and therefore result no longer necessary).This is useful when manually implementing wrappers around various
Gio.AsyncReadyCallbackbased API.If self was created with
Dex.Promise.new(), thenNoneis returned.
- reject(error)¶
 - Parameters:
 error (
GLib.Error) – aGLib.Error
Marks the promise as rejected, indicating a failure.
- resolve(value)¶
 - Parameters:
 value (
GObject.Value) – aGObject.Valuecontaining the resolved value
Sets the result for a
Dex.Promise.
- resolve_boxed(boxed_type, instance)¶
 - Parameters:
 boxed_type (
GObject.GType) – aGObject.GTypeofGObject.TYPE_BOXED
New in version 0.10.
- resolve_fd(fd)¶
 - Parameters:
 fd (
int) – a file-descriptor for the resolve to resolve to
Resolves the promise to fd.
The file-descriptor may be dup()’d by this function and fd closed immediately.
Use
Dex.Future.await_fd() or similar to retrieve the resolved FD.
- resolve_object(object)¶
 - Parameters:
 object (
GObject.ObjectorNone) – aGObject.Object
- resolve_variant(variant)¶
 - Parameters:
 variant (
GLib.VariantorNone) – aGLib.Variant
If variant is floating, its reference is consumed.
New in version 0.8.