pub struct TaskReservation<'sel, 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<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
Sourcepub fn spawn<Fut>(
self,
future: Fut,
) -> impl Future<Output = ()> + use<TASKS, TASK_SIZE, ROOT_TASK_SIZE, Fut>
pub fn spawn<Fut>( self, future: Fut, ) -> impl Future<Output = ()> + use<TASKS, TASK_SIZE, ROOT_TASK_SIZE, Fut>
Spawns a task using a reserved slot that is held by this TaskReservation.
The future must fit TASK_SIZE bytes and be aligned to at most 16 bytes, otherwise the
program doesn’t compile.
Returns a join handle, a future that resolves once the task is finished. Dropping it detaches the task, which keeps running until it finishes.
Trait Implementations§
Auto Trait Implementations§
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> !RefUnwindSafe for TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> !Send for TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> !Sync for TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> !UnwindSafe for TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Forget for TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Freeze for TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Move for TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> Unpin for TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>
impl<'sel, const TASKS: usize, const TASK_SIZE: usize, const ROOT_TASK_SIZE: usize> UnsafeUnpin for TaskReservation<'sel, TASKS, TASK_SIZE, ROOT_TASK_SIZE>where
&'static Tasks<TASKS, TASK_SIZE, ROOT_TASK_SIZE>: UnsafeUnpin,
VersionedIndex<TaskEntry<TASK_SIZE>>: UnsafeUnpin,
&'static TaskEntry<TASK_SIZE>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more