Skip to main content

TaskReservation

Struct TaskReservation 

Source
pub struct TaskReservation<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> { /* private fields */ }
Expand description

A task reservation that can be used to spawn a task without waiting for a free slot.

Implementations§

Source§

impl<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>

Source

pub fn spawn<Fut>( self, future: Fut, ) -> JoinHandle<TASKS, TASK_SIZE, ROOT_TASK_SIZE> ⓘ
where Fut: Future<Output = ()> + 'a,

Spawns a task using a reserved slot that is held by this TaskReservation.

§Panics

Panics if:

  1. the future is bigger than TASK_SIZE bytes
  2. it is aligned to more than 16 bytes.

Trait Implementations§

Source§

impl<const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Debug for TaskReservation<'_, TASKS, TASK_SIZE, ROOT_TASK_SIZE>

Source§

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

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

impl<const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Drop for TaskReservation<'_, TASKS, TASK_SIZE, ROOT_TASK_SIZE>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
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<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> !RefUnwindSafe for TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>

§

impl<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> !Send for TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>

§

impl<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> !Sync for TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>

§

impl<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> !UnwindSafe for TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>

§

impl<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Forget for TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>

§

impl<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Freeze for TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
where &'static Tasks<TASKS, TASK_SIZE, ROOT_TASK_SIZE>: Freeze, Index<TaskEntry<TASK_SIZE>>: Freeze, &'static TaskEntry<TASK_SIZE>: Freeze,

§

impl<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Move for TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>

§

impl<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Unpin for TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
where &'static Tasks<TASKS, TASK_SIZE, ROOT_TASK_SIZE>: Unpin, Index<TaskEntry<TASK_SIZE>>: Unpin, &'static TaskEntry<TASK_SIZE>: Unpin,

§

impl<'a, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> UnsafeUnpin for TaskReservation<'a, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
where &'static Tasks<TASKS, TASK_SIZE, ROOT_TASK_SIZE>: UnsafeUnpin, Index<TaskEntry<TASK_SIZE>>: UnsafeUnpin, &'static TaskEntry<TASK_SIZE>: UnsafeUnpin,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.