1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! What a step node returns. Port of `platform/types.py` Pass / Drop / FanOut.
use crate::event::Event;
/// The outcome of running one event through one [`crate::node::StepNode`].
#[derive(Debug, Clone)]
pub enum StepResult {
/// Forward the (possibly derived) event to the next step.
Pass(Event),
/// Stop propagation here. Filters and sink terminals return this.
Drop {
reason: String,
/// Stable machine-readable code for material business outcomes. A
/// routine filter drop leaves this empty.
exit_reason: Option<String>,
},
/// Forward several events. Only nodes that declare `produces_fan_out`
/// may return this; the validator bans fan-out upstream of `execute.*`.
FanOut(Vec<Event>),
}
impl StepResult {
pub fn drop(reason: impl Into<String>) -> Self {
StepResult::Drop {
reason: reason.into(),
exit_reason: None,
}
}
/// A material gate/drop that recorders should persist as a run step.
pub fn gate(exit_reason: impl Into<String>) -> Self {
let code = exit_reason.into();
StepResult::Drop {
reason: code.clone(),
exit_reason: Some(code),
}
}
}