dope-core 0.77.0

Owned native I/O and completion driver for dope
Documentation
use crate::driver::schedule::ready::task::{self, pool::RootId};

use crate::executor::task::storage::slots;
use core::pin;
use o3::depot::array;

mod error;
mod join;
mod pool;
mod state;

pub use error::Error;
pub use join::Join;
pub use pool::Pool;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum RootError {
    Invalid(task::Error),
    Changed { active: RootId, observed: RootId },
}

/// The first vacant entry after this unpinned batch's live prefix.
#[repr(transparent)]
pub(in crate::executor::task) struct Vacant<'a, F, O>(&'a mut slots::raw::Entry<F, O>);

pub(in crate::executor::task) struct Running<'a, F, O>(pin::Pin<&'a mut slots::raw::Entry<F, O>>);

pub(in crate::executor::task) struct Completed<'a, F, O, const N: usize> {
    entries: pin::Pin<&'a mut [slots::raw::Entry<F, O>; N]>,
    len: array::Len<N>,
}

impl<'a, F, O> Vacant<'a, F, O> {
    pub(in crate::executor::task) fn into_slot(self) -> &'a mut slots::raw::Entry<F, O> {
        self.0
    }
}

impl<'a, F, O> Running<'a, F, O> {
    pub(in crate::executor::task) fn into_slot(self) -> pin::Pin<&'a mut slots::raw::Entry<F, O>> {
        self.0
    }
}

impl<'a, F, O, const N: usize> Completed<'a, F, O, N> {
    pub(in crate::executor::task) fn into_parts(
        self,
    ) -> (
        pin::Pin<&'a mut [slots::raw::Entry<F, O>; N]>,
        array::Len<N>,
    ) {
        (self.entries, self.len)
    }
}