Skip to main content

bombay_engine/
run.rs

1//! Actor terminal classifications.
2
3/// The non-failing ways an actor process finishes.
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum RunExit<D> {
6    /// The behavior explicitly stopped.
7    Stopped(D),
8    /// The environment closed before the behavior stopped.
9    EnvironmentClosed,
10}
11
12/// A failure on either side of the behavior/environment boundary, or a
13/// poisoned machine executor.
14#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
15pub enum RunError<B, E> {
16    /// The behavior transition failed.
17    #[error("behavior transition failed: {0:?}")]
18    Behavior(B),
19    /// The environment rejected a successful transition's effects.
20    #[error("environment rejected a successful transition's effects: {0:?}")]
21    Environment(E),
22    /// The machine executor was poisoned by a panicking transition and the
23    /// driver was reused. The actor is terminal. The driver detects poison
24    /// before polling the environment again, so it does not consume another
25    /// input while reporting this marker.
26    #[error("machine executor poisoned by a panicking transition")]
27    Poisoned,
28}