FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    DispatcherTask

    struct · ferroui-base · v0.5.0

    struct DispatcherTask<T = ()>
    

    The outcome of a future running on a Dispatcher; what the reference implementation returns as a task object.

    The handle can be cloned and sent to other threads. It is a Future that resolves to Ok(result) when the future has completed and to Err(Canceled) when it was dropped before completing (the dispatcher shut down, or the operation that was going to start it was aborted). A panic raised by the future is re-raised to whoever observes the outcome.

    Deprecated: the dispatcher gives a JoinHandle (Dispatcher::spawn_local, spawn, start_local and their _with_priority forms), a future of Result<T, JoinError> with one owner: a panic of the future is JoinError::Panicked, a value, where this handle raises it again; JoinHandle::shared gives several observers. From converts a DispatcherTask into a JoinHandle and back.

    View source

    Deprecated since 0.5.0. use the JoinHandle of Dispatcher::spawn_local, spawn or start_local (a panic of the future is JoinError::Panicked, a value); From converts

    Members

    dispatcher

    fn dispatcher(self: &Self) -> &Arc<Dispatcher>
    

    The dispatcher the future runs on.

    Source

    is_completed

    fn is_completed(self: &Self) -> bool
    

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

    Source

    is_completed_successfully

    fn is_completed_successfully(self: &Self) -> bool
    

    Whether the task ran to the end without panicking.

    Source

    is_faulted

    fn is_faulted(self: &Self) -> bool
    

    Whether the future panicked.

    Source

    is_canceled

    fn is_canceled(self: &Self) -> bool
    

    Whether the future was dropped before it completed.

    Source

    wait

    fn wait(self: &Self) -> Result<(), Canceled>
    

    Blocks until the task has finished. Only supported on threads other than the dispatcher thread, unless the task has already finished.

    Panics

    Re-raises the panic of the future. Panics when the task is still running and the calling thread is the dispatcher thread.

    Source

    result

    fn result(self: &Self) -> Result<T, Canceled>
    

    Blocks like wait and takes the result.

    Panics

    See wait. Also panics when the result has already been taken, and when a result that is not Send is requested from another thread.

    Source

    Trait implementations

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

    Availability

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