pub struct RunningTaskSlot<R, E> { /* private fields */ }Expand description
Runner-side slot for a task that has crossed into the running state.
This endpoint is returned by
TaskSlot::try_start after the
pending to running transition succeeds. It lets schedulers claim a task
under their own queue locks before removing the task from their pending
structures. Dropping a running slot before completion reports
crate::TaskExecutionError::Dropped.
Implementations§
Source§impl<R, E> RunningTaskSlot<R, E>
impl<R, E> RunningTaskSlot<R, E>
Sourcepub fn complete(self, result: TaskResult<R, E>) -> bool
pub fn complete(self, result: TaskResult<R, E>) -> bool
Completes the running task with its final result.
Cancellation is a pre-start decision and should be reported through
TaskSlot::cancel_unstarted.
Passing a cancellation or dropped result does not complete the running
task; the slot is then dropped and callers observe
crate::TaskExecutionError::Dropped.
§Parameters
result- Final task result to publish for this running task.
§Returns
true if the result was published, or false if the state was no
longer running or the result does not represent normal task completion.
Sourcepub fn run<C>(self, task: C) -> boolwhere
C: Callable<R, E>,
pub fn run<C>(self, task: C) -> boolwhere
C: Callable<R, E>,
Runs a callable and publishes its final result through this running slot.
The callable is always executed because the pending-to-running
transition has already succeeded. Task failures and panics are converted
through TaskRunner.
§Parameters
task- Callable to execute for the already-started task.
§Returns
true if the callable result was published, or false if completion
was no longer possible.