Struct tokio::runtime::task::core::Header

source ·
#[repr(C)]
pub(crate) struct Header { pub(super) state: State, pub(super) queue_next: UnsafeCell<Option<NonNull<Header>>>, pub(super) vtable: &'static Vtable, pub(super) owner_id: UnsafeCell<Option<NonZeroU64>>, }
Expand description

Crate public as this is also needed by the pool.

Fields§

§state: State

Task state.

§queue_next: UnsafeCell<Option<NonNull<Header>>>

Pointer to next task, used with the injection queue.

§vtable: &'static Vtable

Table of function pointers for executing actions on the task.

§owner_id: UnsafeCell<Option<NonZeroU64>>

This integer contains the id of the OwnedTasks or LocalOwnedTasks that this task is stored in. If the task is not in any list, should be the id of the list that it was previously in, or None if it has never been in any list.

Once a task has been bound to a list, it can never be bound to another list, even if removed from the first list.

The id is not unset when removed from a list because we want to be able to read the id without synchronization, even if it is concurrently being removed from the list.

Implementations§

source§

impl Header

source

pub(super) unsafe fn set_next(&self, next: Option<NonNull<Header>>)

source

pub(super) unsafe fn set_owner_id(&self, owner: NonZeroU64)

source

pub(super) fn get_owner_id(&self) -> Option<NonZeroU64>

source

pub(super) unsafe fn get_trailer(me: NonNull<Header>) -> NonNull<Trailer>

Gets a pointer to the Trailer of the task containing this Header.

Safety

The provided raw pointer must point at the header of a task.

source

pub(super) unsafe fn get_scheduler<S>(me: NonNull<Header>) -> NonNull<S>

Gets a pointer to the scheduler of the task containing this Header.

Safety

The provided raw pointer must point at the header of a task.

The generic type S must be set to the correct scheduler type for this task.

source

pub(super) unsafe fn get_id_ptr(me: NonNull<Header>) -> NonNull<Id>

Gets a pointer to the id of the task containing this Header.

Safety

The provided raw pointer must point at the header of a task.

source

pub(super) unsafe fn get_id(me: NonNull<Header>) -> Id

Gets the id of the task containing this Header.

Safety

The provided raw pointer must point at the header of a task.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.