FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    TaskHandle

    struct · ferroui-xaml-interactions · v0.5.0

    struct TaskHandle<T: 'static>
    

    A task of the dispatcher of the user interface, held as an untyped value (Task<T>): its JoinHandle, shared.

    Clones refer to the same task and compare equal. Awaiting a handle gives the outcome of the task: its output, or a JoinError (Panicked when the future panicked, a value, not raised again; Canceled when the task was aborted or the dispatcher shut down). Any number of clones may await it; the output is taken by the first, the others get the failure or the cancellation again, and () again for a task without a value.

    View source

    Members

    spawn

    fn spawn<Fut>(future: Fut) -> Self
    where Fut: Future<Output = T> + 'static
    

    Runs future on the dispatcher of the user interface and returns its task (Dispatcher.UIThread.InvokeAsync(async () => ..)). The future starts in a job of the dispatcher at DispatcherPriority::DEFAULT.

    Panics

    Panics when called from a thread other than the thread of the user interface.

    Source

    from_handle

    fn from_handle(handle: JoinHandle<T>) -> Self
    

    The task of the handle of a task of the dispatcher.

    Source

    from_task

    fn from_task(task: DispatcherTask<T>) -> Self
    

    The task of an existing dispatcher task.

    Deprecated: the task of the handle of a task of the dispatcher is from_handle (From); the DispatcherTask converts into a JoinHandle (on the dispatcher thread).

    Deprecated since 0.5.0. use TaskHandle::from_handle with a JoinHandle (DispatcherTask converts into one)

    Source

    is_completed

    fn is_completed(self: &Self) -> bool
    

    Whether the task has finished: completed, failed or canceled (IsCompleted).

    Source

    is_completed_successfully

    fn is_completed_successfully(self: &Self) -> bool
    

    Whether the task ran to the end (IsCompletedSuccessfully).

    Source

    is_faulted

    fn is_faulted(self: &Self) -> bool
    

    Whether the future of the task panicked (IsFaulted).

    Source

    is_canceled

    fn is_canceled(self: &Self) -> bool
    

    Whether the task was canceled (IsCanceled).

    Source

    abort

    fn abort(self: &Self)
    

    Aborts the task, unless it has ended: its future is dropped, and it ends canceled.

    Source

    completed

    fn completed() -> Self
    

    A task that has already completed (Task.CompletedTask).

    Source

    Trait implementations

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

    Availability

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