Struct tokio::runtime::task::harness::Harness

source ·
pub(super) struct Harness<T: Future, S: 'static> {
    cell: NonNull<Cell<T, S>>,
}
Expand description

Typed raw task handle.

Fields§

§cell: NonNull<Cell<T, S>>

Implementations§

source§

impl<T, S> Harness<T, S>
where T: Future, S: 'static,

source

pub(super) unsafe fn from_raw(ptr: NonNull<Header>) -> Harness<T, S>

source

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

source

fn header(&self) -> &Header

source

fn state(&self) -> &State

source

fn trailer(&self) -> &Trailer

source

fn core(&self) -> &Core<T, S>

source§

impl<T, S> Harness<T, S>
where T: Future, S: Schedule,

source

pub(super) fn drop_reference(self)

source

pub(super) fn poll(self)

Polls the inner future. A ref-count is consumed.

All necessary state checks and transitions are performed. Panics raised while polling the future are handled.

source

fn poll_inner(&self) -> PollFuture

Polls the task and cancel it if necessary. This takes ownership of a ref-count.

If the return value is Notified, the caller is given ownership of two ref-counts.

If the return value is Complete, the caller is given ownership of a single ref-count, which should be passed on to complete.

If the return value is Dealloc, then this call consumed the last ref-count and the caller should call dealloc.

Otherwise the ref-count is consumed and the caller should not access self again.

source

pub(super) fn shutdown(self)

Forcibly shuts down the task.

Attempt to transition to Running in order to forcibly shutdown the task. If the task is currently running or in a state of completion, then there is nothing further to do. When the task completes running, it will notice the CANCELLED bit and finalize the task.

source

pub(super) fn dealloc(self)

source

pub(super) fn try_read_output( self, dst: &mut Poll<Result<T::Output, JoinError>>, waker: &Waker, )

Read the task output into dst.

source

pub(super) fn drop_join_handle_slow(self)

source

fn complete(self)

Completes the task. This method assumes that the state is RUNNING.

source

fn release(&self) -> usize

Releases the task from the scheduler. Returns the number of ref-counts that should be decremented.

source

fn get_new_task(&self) -> Task<S>

Creates a new task that holds its own ref-count.

§Safety

Any use of self after this call must ensure that a ref-count to the task holds the task alive until after the use of self. Passing the returned Task to any method on self is unsound if dropping the Task could drop self before the call on self returned.

Auto Trait Implementations§

§

impl<T, S> Freeze for Harness<T, S>

§

impl<T, S> !RefUnwindSafe for Harness<T, S>

§

impl<T, S> !Send for Harness<T, S>

§

impl<T, S> !Sync for Harness<T, S>

§

impl<T, S> Unpin for Harness<T, S>

§

impl<T, S> !UnwindSafe for Harness<T, 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>,

source§

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>,

source§

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.