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.
Deprecated since 0.5.0. use the
JoinHandleofDispatcher::spawn_local,spawnorstart_local(a panic of the future isJoinError::Panicked, a value);Fromconverts
Members
dispatcher
fn dispatcher(self: &Self) -> &Arc<Dispatcher>
The dispatcher the future runs on.
is_completed
fn is_completed(self: &Self) -> bool
Whether the task has finished: completed, failed or canceled.
is_completed_successfully
fn is_completed_successfully(self: &Self) -> bool
Whether the task ran to the end without panicking.
is_faulted
fn is_faulted(self: &Self) -> bool
Whether the future panicked.
is_canceled
fn is_canceled(self: &Self) -> bool
Whether the future was dropped before it completed.
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.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyIntoFutureToOwnedErasedDestructorIntoEitherCloneDebugFutureFrom<JoinHandle<T>>From<DispatcherTask<T>>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.