TaskValue
struct · ferroui-base · v0.5.0
struct TaskValue
A task as a value that can be stored in a property and streamed by a
binding with the ^ operator: the handle to the eventual outcome of an
asynchronous operation, which is an untyped result or an error. It has
identity equality.
The outcome is produced by a TaskValueSource, by a future running on
the dispatcher (TaskValue::run) or is known up front
(TaskValue::from_result, TaskValue::from_exception).
Members
from_resultfrom_untyped_resultfrom_exceptionrunis_completedis_completed_successfullyis_faultedresultcontinue_with
from_result
fn from_result<T: PropertyValue>(value: T) -> Self
A task that has completed with value.
from_untyped_result
fn from_untyped_result(value: Option<BoxedValue>) -> Self
A task that has completed with an untyped value: null, a boxed value or a shared model object.
from_exception
fn from_exception(error: BindingError) -> Self
A task that has failed with error.
run
fn run<F>(future: F) -> Self
where F: Future<Output = Result<Option<BoxedValue>, BindingError>> + 'static
Runs future on the dispatcher of the calling thread and returns the
task for its outcome. A future that is dropped before it completes
(the dispatcher shut down, the future panicked) leaves the task
running forever.
is_completed
fn is_completed(self: &Self) -> bool
Whether the task has finished: completed or failed.
is_completed_successfully
fn is_completed_successfully(self: &Self) -> bool
Whether the task ran to completion.
is_faulted
fn is_faulted(self: &Self) -> bool
Whether the task failed.
result
fn result(self: &Self) -> Option<Result<Option<BoxedValue>, BindingError>>
The outcome of the task, if it has finished.
continue_with
fn continue_with(self: &Self, continuation: impl FnOnce() -> () + 'static)
Runs continuation when the task finishes; right away if it has
finished already. The continuation runs where the task is completed:
a caller that needs it on the dispatcher posts from it.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherClonePartialEq
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.