Skip to main content

dope_core/executor/task/batch/
mod.rs

1use crate::driver::schedule::ready::task::{self, pool::RootId};
2
3use crate::executor::task::storage::slots;
4use core::pin;
5use o3::depot::array;
6
7mod error;
8mod join;
9mod pool;
10mod state;
11
12pub use error::Error;
13pub use join::Join;
14pub use pool::Pool;
15
16#[derive(Clone, Copy, Debug, Eq, PartialEq)]
17pub enum RootError {
18    Invalid(task::Error),
19    Changed { active: RootId, observed: RootId },
20}
21
22/// The first vacant entry after this unpinned batch's live prefix.
23#[repr(transparent)]
24pub(in crate::executor::task) struct Vacant<'a, F, O>(&'a mut slots::raw::Entry<F, O>);
25
26pub(in crate::executor::task) struct Running<'a, F, O>(pin::Pin<&'a mut slots::raw::Entry<F, O>>);
27
28pub(in crate::executor::task) struct Completed<'a, F, O, const N: usize> {
29    entries: pin::Pin<&'a mut [slots::raw::Entry<F, O>; N]>,
30    len: array::Len<N>,
31}
32
33impl<'a, F, O> Vacant<'a, F, O> {
34    pub(in crate::executor::task) fn into_slot(self) -> &'a mut slots::raw::Entry<F, O> {
35        self.0
36    }
37}
38
39impl<'a, F, O> Running<'a, F, O> {
40    pub(in crate::executor::task) fn into_slot(self) -> pin::Pin<&'a mut slots::raw::Entry<F, O>> {
41        self.0
42    }
43}
44
45impl<'a, F, O, const N: usize> Completed<'a, F, O, N> {
46    pub(in crate::executor::task) fn into_parts(
47        self,
48    ) -> (
49        pin::Pin<&'a mut [slots::raw::Entry<F, O>; N]>,
50        array::Len<N>,
51    ) {
52        (self.entries, self.len)
53    }
54}