efl/src/lib/ecore/efl_promise.eo

81 lines
2.8 KiB
Plaintext

import eina_types;
class Efl.Promise (Efl.Loop.Consumer)
{
[[Efl promise class]]
methods {
progress_set {
[[Updates progress and sends it immediately to all connected Efl_Future.
The progress is not stored and when the function returns it will not be accessed
anymore. The pointer is owned by the caller and will remain so after the return
of the function call.
]]
params {
@in p: const(void_ptr); [[Progress to be set]]
}
}
@property future {
[[Requests a new future linked to this promise.
Efl_Future are optional and will be automatically deleted if no callbacks have
been set before the next iteration of the main loop.
]]
get {
[[The returned new future.]]
}
values {
f: future<void_ptr, void_ptr>; [[Returns a future where the value will be set by calling value_set whilst the progress is
updated by progress_set.]]
}
}
@property value {
[[The value expected by all connected future.]]
set {
[[
This function can be called only once. You cannot call #failed.set after doing so.
The value will be owned by the promise until it's destroyed. It will be cleaned
when the promise and all futures depending on it are destroyed.
]]
}
values {
v: void_ptr; [[The pointer to the value.]]
free_cb: __builtin_free_cb; [[The function to call to free the value.]]
}
}
@property failed {
[[Defines the failure state of this promise.]]
set {
[[
This function can be called only once and you cannot call #value.set after doing so.
]]
}
values {
err: Eina.Error; [[The reason for failure of this promise.]]
}
}
connect {
[[Connects a future output to this promise.
This helper will automatically trigger #value.set or #failed.set when the future
succeeds or fails respectively, with the value provided by the future.
]]
params {
@in f: future<void_ptr, void_ptr>; [[The future to connect to this promise.]]
}
return: bool; [[Returns $false if unable to set up the connection.]]
}
}
events {
future,set: future<void_ptr>; [[This event is triggered whenever a future is fully set to receive all events and the user
holds no more references to it.]]
future,progress,set: future<void_ptr>; [[This event is triggered whenever a future has a progress callback registered and the user holds no more reference to it.]]
future,none; [[This event is triggered whenever there are no more futures connected to the promise.]]
}
implements {
Efl.Object.destructor;
Efl.Object.constructor;
Efl.Object.parent { set; }
}
}