forked from enlightenment/efl
78 lines
2.8 KiB
Plaintext
78 lines
2.8 KiB
Plaintext
import eina_types;
|
|
|
|
class Efl.Promise (Efl.Loop_User)
|
|
{
|
|
[[Efl promise class]]
|
|
methods {
|
|
progress_set {
|
|
[[Updates the progress and send it immediately to all connected Efl_Future.
|
|
|
|
The progress is not kept and when the function return 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 then callback 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 while the progress will be updated by progress_set.]]
|
|
}
|
|
}
|
|
@property value {
|
|
[[The value expected by all connected future.]]
|
|
set {
|
|
[[
|
|
This function can be called only once and you can not call #failed.set after that.
|
|
The value will be owned by the promise until it is destroyed. The value will be cleaned
|
|
when the promise and all the future 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 can not call #value.set after that.
|
|
]]
|
|
}
|
|
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
|
|
succeed or fail respectively with the value provided by the future.
|
|
]]
|
|
params {
|
|
@in f: future<void_ptr, void_ptr>; [[The future to connect this promise to.]]
|
|
}
|
|
return: bool; [[Returns $false if unable to setup the connection.]]
|
|
}
|
|
}
|
|
events {
|
|
future,set: future<void_ptr>; [[This event is triggered whenever a future is fully set to receive all events and that the user of it do not hold any more reference on it.]]
|
|
future,progress,set: future<void_ptr>; [[This event is triggered whenever a future has a progress callback registered and the user does not hold any more reference on it.]]
|
|
future,none; [[This event is triggered whenever there is no more future connected to the promise.]]
|
|
}
|
|
implements {
|
|
Efl.Object.destructor;
|
|
Efl.Object.constructor;
|
|
}
|
|
}
|