FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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).

    View source

    Members

    from_result

    fn from_result<T: PropertyValue>(value: T) -> Self
    

    A task that has completed with value.

    Source

    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.

    Source

    from_exception

    fn from_exception(error: BindingError) -> Self
    

    A task that has failed with error.

    Source

    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.

    Source

    is_completed

    fn is_completed(self: &Self) -> bool
    

    Whether the task has finished: completed or failed.

    Source

    is_completed_successfully

    fn is_completed_successfully(self: &Self) -> bool
    

    Whether the task ran to completion.

    Source

    is_faulted

    fn is_faulted(self: &Self) -> bool
    

    Whether the task failed.

    Source

    result

    fn result(self: &Self) -> Option<Result<Option<BoxedValue>, BindingError>>
    

    The outcome of the task, if it has finished.

    Source

    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.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone
    • PartialEq

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.