Skip to main content

behavior/
next.rs

1//! The host sum used to represent the behavior algebra's `become` seat.
2
3/// The uninhabited type with two structural jobs. As a phase menu,
4/// `Step<Never>` has no constructible `Goto` — a plain actor is a one-phase
5/// machine. As an outbound/offspring menu, it proves a layer sends or creates
6/// nothing. The law is the type, not a convention.
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub enum Never {}
9
10/// The behavior has designated termination as its next state.
11///
12/// This marker deliberately carries no lifecycle, supervision, collection, or
13/// runtime-failure provenance. Those facts are typed observations owned by
14/// actor compositions and the Bombay runtime, not part of the behavior
15/// algebra's termination decision.
16#[derive(Debug, Clone, Copy, PartialEq, Eq)]
17pub struct Stopped;
18
19/// A generic next-state verdict. Bombay Behavior pins `R` to [`Stopped`], so
20/// actor-specific lifecycle data cannot enter the `become` seat.
21#[derive(Debug, Clone, Copy, PartialEq, Eq)]
22pub enum Step<Ph = Never, R = Never> {
23    /// Keep the current behavior; poll for the next event.
24    Continue,
25    /// Transition to another phase from the menu (no-op when already there).
26    Goto(Ph),
27    /// Select a terminal result. In [`crate::Become`] this is the payload-free
28    /// [`Stopped`] marker.
29    Stop(R),
30}