Skip to main content

dope_runtime/executor/boot/
mod.rs

1use std::mem;
2
3mod context;
4
5pub use context::Context;
6
7/// Exact reason a startup root owns the current poll.
8#[derive(Clone, Copy, Eq, PartialEq)]
9#[repr(u8)]
10pub enum Cause {
11    Start,
12    Wake,
13}
14
15/// Consuming startup transition that cannot be polled after completion.
16#[must_use]
17pub enum Poll<R, T> {
18    Pending(R),
19    Ready(T),
20}
21
22/// Startup control flow with no I/O submission or arbitrary ready-slot authority.
23pub trait Root<'d>: Sized {
24    type Output;
25    fn poll(self, context: Context<'_, 'd>) -> Poll<Self, Self::Output>;
26    /// Releases this root when startup admission or execution fails.
27    fn cancel(self);
28}
29
30const _: () = assert!(mem::size_of::<Cause>() == mem::size_of::<u8>());