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