pub struct TaskHandle<T: 'static> { /* private fields */ }Expand description
A task of the dispatcher of the user interface, held as an untyped value (Task<T>).
Clones refer to the same task and compare equal; the result of the task can be taken once (awaiting it takes it).
Implementations§
Source§impl<T: 'static> TaskHandle<T>
impl<T: 'static> TaskHandle<T>
Sourcepub fn spawn<Fut>(future: Fut) -> Selfwhere
Fut: Future<Output = T> + 'static,
pub fn spawn<Fut>(future: Fut) -> Selfwhere
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.
§Panics
Panics when called from a thread other than the thread of the user interface.
Sourcepub fn from_task(task: DispatcherTask<T>) -> Self
pub fn from_task(task: DispatcherTask<T>) -> Self
The handle of an existing dispatcher task.
Sourcepub fn task(&self) -> &DispatcherTask<T> ⓘ
pub fn task(&self) -> &DispatcherTask<T> ⓘ
The dispatcher task.
Sourcepub fn is_completed(&self) -> bool
pub fn is_completed(&self) -> bool
Whether the task has finished: completed, failed or canceled (IsCompleted).
Sourcepub fn is_completed_successfully(&self) -> bool
pub fn is_completed_successfully(&self) -> bool
Whether the task ran to the end (IsCompletedSuccessfully).
Sourcepub fn is_faulted(&self) -> bool
pub fn is_faulted(&self) -> bool
Whether the future of the task panicked (IsFaulted).
Sourcepub fn is_canceled(&self) -> bool
pub fn is_canceled(&self) -> bool
Whether the task was canceled (IsCanceled).
Trait Implementations§
Source§impl<T: 'static> Clone for TaskHandle<T>
impl<T: 'static> Clone for TaskHandle<T>
Source§impl<T: 'static> Debug for TaskHandle<T>
impl<T: 'static> Debug for TaskHandle<T>
Source§impl<T: 'static> Future for TaskHandle<T>
impl<T: 'static> Future for TaskHandle<T>
Source§type Output = Result<T, OperationCanceledError>
type Output = Result<T, OperationCanceledError>
The type of value produced on completion.
Auto Trait Implementations§
impl<T> !Send for TaskHandle<T>
impl<T> !Sync for TaskHandle<T>
impl<T> Freeze for TaskHandle<T>where
DispatcherTask<T>: Freeze,
impl<T> RefUnwindSafe for TaskHandle<T>where
DispatcherTask<T>: RefUnwindSafe,
impl<T> Unpin for TaskHandle<T>where
DispatcherTask<T>: Unpin,
impl<T> UnsafeUnpin for TaskHandle<T>where
DispatcherTask<T>: UnsafeUnpin,
impl<T> UnwindSafe for TaskHandle<T>where
DispatcherTask<T>: UnwindSafe,
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read moreSource§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more