behavior/exit.rs
1//! `Exit` — the trace-exit vocabulary: the `R` corner of the verdict family
2//! (`Step<Ph, Exit>`, ADR-0029) that a stopped fold rides out on. Moved
3//! in-crate when the `behavior-reference` crate was retired; it is the
4//! core's own vocabulary now, not a shared one.
5
6use crate::behavior::Address;
7
8/// How a fold ends. The `R` parameter of the become verdict (`Step<Ph, Exit>`):
9/// a `Stop` carries one of these; the driver also mints `Collected` when the
10/// mailbox drains with no self-stop.
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub enum Exit<A: Address> {
13 /// Clean self-stop (`Flow::Stop(Normal)`'s image).
14 Normal,
15 /// Sources exhausted — the mailbox-closed / ref-count-collection image.
16 Collected,
17 /// A watch layer propagated a linked peer's death, carrying its address.
18 LinkDied(A),
19}
20
21/// Why actor execution terminated abnormally.
22///
23/// The reason value stays with the interpreter: heterogeneous behavior and
24/// environment errors, panic payloads, and executor cancellation details are
25/// runtime plumbing. Observation carries only the statically known terminal
26/// domain. Every variant is abnormal; the distinction is preserved for
27/// supervision policy and truthful traces.
28///
29/// This classification is Bombay policy layered over the actor algebra. It
30/// does not add an effect to a behavior transition: interpreters mint a
31/// `Crash` only when execution terminates without an [`Exit`].
32#[derive(Debug, Clone, Copy, PartialEq, Eq)]
33pub enum Crash {
34 /// `Behavior::init` or `Behavior::step` returned its declared error.
35 Failed,
36 /// The interpreter could not execute an emitted effect and terminated the
37 /// actor.
38 EnvironmentFailed,
39 /// Actor execution unwound through a panic.
40 Panicked,
41 /// The executor cancelled actor execution before normal completion.
42 Cancelled,
43}