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/// How the fold crashed. The reason VALUE stays with the driver in both
22/// cases (heterogeneous error types and panic payloads are runtime
23/// plumbing — typed reasons are the homogeneous-fleet door, deferred);
24/// the fold receives the DOMAIN. Both variants classify as abnormal; the
25/// distinction is preserved for future policy (e.g. poison-message
26/// handling) and for trace truth — the death site knows which one
27/// happened, and the report must not collapse it.
28#[derive(Debug, Clone, Copy, PartialEq, Eq)]
29pub enum Crash {
30 /// `step` returned `Err` — the behavior's declared controlled crash.
31 Failed,
32 /// The fold panicked — an undeclared programmer bug.
33 Panicked,
34}