pub struct AsyncTasks { /* private fields */ }Expand description
The registry of background work of one app. Clones share the same registry.
Implementations§
Source§impl AsyncTasks
impl AsyncTasks
Sourcepub fn complete(&self, id: TaskId) -> bool
pub fn complete(&self, id: TaskId) -> bool
Marks a task as finished. Returns false when the task is not active, for
example because it was completed before.
Sourcepub fn track(&self, name: impl Into<String>) -> TaskGuard
pub fn track(&self, name: impl Into<String>) -> TaskGuard
Registers a task that stays active until the returned guard is dropped.
Sourcepub fn tracked<N, F>(
&self,
name: N,
future: F,
) -> impl Future<Output = F::Output> + use<N, F>
pub fn tracked<N, F>( &self, name: N, future: F, ) -> impl Future<Output = F::Output> + use<N, F>
Registers a task now and returns future with the task tied to it. The task
stays active until the returned future completes, panics or is dropped.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
The number of active tasks.
Trait Implementations§
Source§impl Clone for AsyncTasks
impl Clone for AsyncTasks
Source§impl Debug for AsyncTasks
impl Debug for AsyncTasks
Auto Trait Implementations§
impl Forget for AsyncTasks
impl Freeze for AsyncTasks
impl Move for AsyncTasks
impl RefUnwindSafe for AsyncTaskswhere
Atomic<usize>: RefUnwindSafe,
Atomic<u64>: RefUnwindSafe,
Mutex<HashMap<TaskId, Entry>>: RefUnwindSafe,
impl Send for AsyncTasks
impl Sync for AsyncTasks
impl Unpin for AsyncTasks
impl UnsafeUnpin for AsyncTasks
impl UnwindSafe for AsyncTaskswhere
Arc<Inner>: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.