pub struct DispatcherTask<T = ()> { /* private fields */ }Expand description
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(OperationCanceledError) 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.
Implementations§
Source§impl<T: 'static> DispatcherTask<T>
impl<T: 'static> DispatcherTask<T>
Sourcepub fn dispatcher(&self) -> &Arc<Dispatcher> ⓘ
pub fn dispatcher(&self) -> &Arc<Dispatcher> ⓘ
The dispatcher the future runs on.
Sourcepub fn is_completed(&self) -> bool
pub fn is_completed(&self) -> bool
Whether the task has finished: completed, failed or canceled.
Sourcepub fn is_completed_successfully(&self) -> bool
pub fn is_completed_successfully(&self) -> bool
Whether the task ran to the end without panicking.
Sourcepub fn is_faulted(&self) -> bool
pub fn is_faulted(&self) -> bool
Whether the future panicked.
Sourcepub fn is_canceled(&self) -> bool
pub fn is_canceled(&self) -> bool
Whether the future was dropped before it completed.
Sourcepub fn wait(&self) -> Result<(), OperationCanceledError>
pub fn wait(&self) -> Result<(), OperationCanceledError>
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.
Trait Implementations§
Source§impl<T> Clone for DispatcherTask<T>
impl<T> Clone for DispatcherTask<T>
Source§impl<T> Debug for DispatcherTask<T>
impl<T> Debug for DispatcherTask<T>
Source§impl<T: 'static> Future for DispatcherTask<T>
impl<T: 'static> Future for DispatcherTask<T>
Source§type Output = Result<T, OperationCanceledError>
type Output = Result<T, OperationCanceledError>
Auto Trait Implementations§
impl<T> Freeze for DispatcherTask<T>
impl<T> RefUnwindSafe for DispatcherTask<T>
impl<T> Send for DispatcherTask<T>
impl<T> Sync for DispatcherTask<T>
impl<T> Unpin for DispatcherTask<T>
impl<T> UnsafeUnpin for DispatcherTask<T>
impl<T> UnwindSafe for DispatcherTask<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more