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>
impl<T, S> Harness<T, S>
pub(super) fn drop_reference(self)
sourcepub(super) fn poll(self)
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.
sourcefn poll_inner(&self) -> PollFuture
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.
sourcepub(super) fn shutdown(self)
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.
pub(super) fn dealloc(self)
sourcepub(super) fn try_read_output(
self,
dst: &mut Poll<Result<T::Output, JoinError>>,
waker: &Waker,
)
pub(super) fn try_read_output( self, dst: &mut Poll<Result<T::Output, JoinError>>, waker: &Waker, )
Read the task output into dst
.
pub(super) fn drop_join_handle_slow(self)
sourcefn release(&self) -> usize
fn release(&self) -> usize
Releases the task from the scheduler. Returns the number of ref-counts that should be decremented.
sourcefn get_new_task(&self) -> Task<S>
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.