Skip to main content

behavior/
lib.rs

1//! Pure actor algebra. A [`Behavior`] folds its associated event protocol into
2//! exactly [`Actions`]: sends, creates, and become. Timing, observation,
3//! supervision, stashing, and finite-state behavior are derived compositions.
4
5// The `workers!` macro emits `::behavior::…` paths; this alias lets
6// those expansions resolve inside this crate too (macro hygiene).
7extern crate self as behavior;
8
9#[path = "behavior.rs"]
10mod algebra;
11mod deadlined;
12mod stashing;
13mod supervising;
14mod verdict;
15mod watching;
16
17// `Fsm` is a thin state-machine helper built from the core stashing primitive.
18mod fsm;
19mod protocol;
20mod shutdown;
21mod spec;
22
23pub use algebra::{
24    Acted, Actions, Address, Base, Become, Behavior, BehaviorActed, BirthMode, Births, Create,
25    CreationKind, Delivery, FnState, MailAddr, NoBirths, Recipient, Route, SendAlgebra,
26    SendProduct, ServiceSends, State, Transcript, User, UserEvent, run,
27};
28pub use deadlined::{At, AtEvent, AtReaction};
29pub use fsm::{Fsm, Move};
30pub use protocol::{
31    AtGeneration, AtId, ChildEvent, ChildStopped, ObserveChild, ObservePeer, PeerEvent,
32    PeerStopped, ReportWorkerStopped, ScheduleAt, ShutdownEvent, ShutdownRequested, TimeEvent,
33    TimeReached, WorkerEvent, WorkerStopped,
34};
35pub use shutdown::{FinalizeOnShutdown, ShutdownProtocol, ShutdownReaction, StopOnShutdown};
36pub use spec::Spec;
37pub use stashing::{StashRoute, Stashing};
38pub use supervising::{
39    Proxy, ProxyCommand, RestartPolicy, Strategy, Supervising, SupervisionEvent,
40    SupervisionFailure, SupervisionFailureReaction, restart_all, restart_one, restart_rest,
41    retire_on_supervision_failure, stop_on_supervision_failure,
42};
43pub use verdict::{Never, Step};
44pub use watching::{LinkReaction, WatchEvent, Watching, stop_on_abnormal_death};
45
46mod exit;
47
48pub use exit::{Crash, Exit, RestartDenial, SupervisionFailureReason};
49
50pub use behavior_macros::workers;