Struct tokio::runtime::task::Task

source ·
#[repr(transparent)]
pub(crate) struct Task<S: 'static> { raw: RawTask, _p: PhantomData<S>, }
Expand description

An owned handle to the task, tracked by ref count.

Fields§

§raw: RawTask§_p: PhantomData<S>

Implementations§

source§

impl<S: 'static> Task<S>

source

unsafe fn new(raw: RawTask) -> Task<S>

source

unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S>

source

fn header(&self) -> &Header

source

fn header_ptr(&self) -> NonNull<Header>

source§

impl<S: Schedule> Task<S>

source

pub(crate) fn shutdown(self)

Preemptively cancels the task as part of the shutdown process.

Trait Implementations§

source§

impl<S> Debug for Task<S>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S: 'static> Drop for Task<S>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

§Safety

Tasks are pinned.

§

type Handle = Task<S>

Handle to the list entry. Read more
§

type Target = Header

Node type.
source§

fn as_raw(handle: &Task<S>) -> NonNull<Header>

Convert the handle to a raw pointer without consuming the handle.
source§

unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S>

Convert the raw pointer to a handle
source§

unsafe fn pointers(target: NonNull<Header>) -> NonNull<Pointers<Header>>

Return the pointers for a node Read more
source§

impl<S> ShardedListItem for Task<S>

§Safety

The id of a task is never changed after creation of the task, so the return value of get_shard_id will not change. (The cast may throw away the upper 32 bits of the task id, but the shard id still won’t change from call to call.)

source§

unsafe fn get_shard_id(target: NonNull<Self::Target>) -> usize

Safety Read more
source§

impl<S> Send for Task<S>

source§

impl<S> Sync for Task<S>

Auto Trait Implementations§

§

impl<S> Freeze for Task<S>

§

impl<S> !RefUnwindSafe for Task<S>

§

impl<S> Unpin for Task<S>
where S: Unpin,

§

impl<S> !UnwindSafe for Task<S>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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.