Dex.Promise

g Dex.Future Dex.Future Dex.Promise Dex.Promise Dex.Future->Dex.Promise Dex.Object Dex.Object Dex.Object->Dex.Future

Subclasses:

None

Methods

Inherited:

Dex.Future (48), Dex.Object (2)

class

new ()

class

new_cancellable ()

get_cancellable ()

reject (error)

resolve (value)

resolve_boolean (value)

resolve_double (value)

resolve_float (value)

resolve_int (value)

resolve_int64 (value)

resolve_long (value)

resolve_object (object)

resolve_string (value)

resolve_uint (value)

resolve_uint64 (value)

resolve_ulong (value)

Virtual Methods

None

Fields

None

Class Details

class Dex.Promise
Bases:

Dex.Future

Abstract:

No

Dex.Promise is a convenient Dex.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:

Dex.Promise

classmethod new_cancellable()
Returns:

a Dex.Promise

Return type:

Dex.Promise

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 or None

Return type:

Gio.Cancellable or None

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(), then None is returned.

reject(error)
Parameters:

error (GLib.Error) – a GLib.Error

Marks the promise as rejected, indicating a failure.

resolve(value)
Parameters:

value (GObject.Value) – a GObject.Value containing the resolved value

Sets the result for a Dex.Promise.

resolve_boolean(value)
Parameters:

value (bool) –

resolve_double(value)
Parameters:

value (float) –

resolve_float(value)
Parameters:

value (float) –

resolve_int(value)
Parameters:

value (int) –

resolve_int64(value)
Parameters:

value (int) –

resolve_long(value)
Parameters:

value (int) –

resolve_object(object)
Parameters:

object (object or None) – a GObject.Object

resolve_string(value)
Parameters:

value (str) – a string to use to resolve the promise

resolve_uint(value)
Parameters:

value (int) –

resolve_uint64(value)
Parameters:

value (int) –

resolve_ulong(value)
Parameters:

value (int) –