pub(crate) struct Header<M> {
pub(crate) state: AtomicUsize,
pub(crate) awaiter: UnsafeCell<Option<Waker>>,
pub(crate) vtable: &'static TaskVTable,
pub(crate) metadata: M,
pub(crate) propagate_panic: bool,
}Expand description
The header of a task.
This header is stored in memory at the beginning of the heap-allocated task.
Fields§
§state: AtomicUsizeCurrent state of the task.
Contains flags representing the current state and the reference count.
awaiter: UnsafeCell<Option<Waker>>The task that is blocked on the Task handle.
This waker needs to be woken up once the task completes or is closed.
vtable: &'static TaskVTableThe virtual table.
In addition to the actual waker virtual table, it also contains pointers to several other methods necessary for bookkeeping the heap-allocated task.
metadata: MMetadata associated with the task.
This metadata may be provided to the user.
propagate_panic: boolWhether or not a panic that occurs in the task should be propagated.
Implementations§
Source§impl<M> Header<M>
impl<M> Header<M>
Sourcepub(crate) fn notify(&self, current: Option<&Waker>)
pub(crate) fn notify(&self, current: Option<&Waker>)
Notifies the awaiter blocked on this task.
If the awaiter is the same as the current waker, it will not be notified.
Trait Implementations§
Auto Trait Implementations§
impl<M> !Freeze for Header<M>
impl<M> !RefUnwindSafe for Header<M>
impl<M> Send for Header<M>where
M: Send,
impl<M> !Sync for Header<M>
impl<M> Unpin for Header<M>where
M: Unpin,
impl<M> UnwindSafe for Header<M>where
M: 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