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 shutdown;
20mod spec;
21
22pub use algebra::{
23    Acted, Actions, Address, Base, Become, Behavior, BirthMode, Births, Create, Delivery, FnState,
24    MailAddr, NoBirths, Recipient, Route, SendAlgebra, SendProduct, ServiceSends, State,
25    Transcript, User, UserEvent, run,
26};
27pub use deadlined::{
28    At, AtEvent, AtGeneration, AtId, AtReaction, ScheduleAt, TimeEvent, TimeReached,
29};
30pub use fsm::{Fsm, Move};
31pub use shutdown::{
32    FinalizeOnShutdown, ShutdownEvent, ShutdownProtocol, ShutdownReaction, ShutdownRequested,
33    StopOnShutdown,
34};
35pub use spec::Spec;
36pub use stashing::{StashRoute, Stashing};
37pub use supervising::{
38    ChildEvent, ChildStopped, ObserveChild, Proxy, ProxyCommand, ReportWorkerStopped,
39    RestartPolicy, Strategy, Supervising, SupervisionEvent, SupervisionFailure,
40    SupervisionFailureReaction, WorkerEvent, WorkerStopped, restart_all, restart_one, restart_rest,
41    retire_on_supervision_failure, stop_on_supervision_failure,
42};
43pub use verdict::{Never, Step};
44pub use watching::{
45    LinkReaction, ObservePeer, PeerEvent, PeerStopped, WatchEvent, Watching, stop_on_abnormal_death,
46};
47
48mod exit;
49
50pub use exit::{Crash, Exit, RestartDenial, SupervisionFailureReason};
51
52pub use behavior_macros::workers;