pub struct WeakTask(/* private fields */);Expand description
A weak reference to a Task, obtained via Task::downgrade.
Does not prevent the task from being deallocated. Use upgrade
to attempt to obtain a strong Task reference.
A WeakTask points at a worker’s identity (TaskInner), not at the shared
progress cursor — so strong_count and
is_alive report whether that worker is still around.
Implementations§
Source§impl WeakTask
impl WeakTask
Sourcepub fn upgrade(&self) -> Option<Task>
pub fn upgrade(&self) -> Option<Task>
Attempts to upgrade to a strong Task.
Returns None if all strong references to the underlying task identity
have already been dropped (i.e. the worker that owned it has exited).
Sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
Sourcepub fn weak_count(&self) -> usize
pub fn weak_count(&self) -> usize
Returns the number of weak WeakTask references to the underlying task
identity.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WeakTask
impl RefUnwindSafe for WeakTask
impl Send for WeakTask
impl Sync for WeakTask
impl Unpin for WeakTask
impl UnsafeUnpin for WeakTask
impl UnwindSafe for WeakTask
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