Skip to main content

TaskSlot

Struct TaskSlot 

Source
pub struct TaskSlot<R, E> { /* private fields */ }
Expand description

Runner-side slot for one task submission.

This low-level endpoint is exposed so custom executor services built on top of qubit-executor can wire their own scheduling while still returning the standard crate::TaskHandle. Executor implementations should call Self::accept only after submission succeeds; this arms lifecycle hook reporting for later start and finish events. Normal callers should use crate::TaskHandle and executor/service submission methods instead.

Implementations§

Source§

impl<R, E> TaskSlot<R, E>

Source

pub fn accept(&self)

Marks this runner endpoint as accepted and arms lifecycle hook reporting.

Calling this method emits on_accepted before any later on_started or on_finished event for the same task. Executor implementations must call it only after submission has succeeded. Dropping a slot before acceptance still releases result waiters with Dropped, but does not emit lifecycle hook events for a task that was rejected before acceptance.

Source

pub fn run<C>(self, task: C) -> bool
where C: Callable<R, E>,

Starts this slot and runs a callable to completion.

§Parameters
  • task - Callable to run if the task has not been cancelled.
§Returns

true if the callable ran and published a result, or false if the task had already been cancelled.

Trait Implementations§

Source§

impl<R, E> Drop for TaskSlot<R, E>

Source§

fn drop(&mut self)

Publishes a dropped-result error when the runner endpoint is abandoned.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<R, E> Freeze for TaskSlot<R, E>

§

impl<R, E> !RefUnwindSafe for TaskSlot<R, E>

§

impl<R, E> Send for TaskSlot<R, E>
where R: Send, E: Send,

§

impl<R, E> Sync for TaskSlot<R, E>
where R: Send, E: Send,

§

impl<R, E> Unpin for TaskSlot<R, E>

§

impl<R, E> UnsafeUnpin for TaskSlot<R, E>

§

impl<R, E> !UnwindSafe for TaskSlot<R, E>

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> DropFlavorWrapper<T> for T

Source§

type Flavor = MayDrop

The DropFlavor that wraps T into Self
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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> IntoResult<T> for T

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.