swf_core/models/task/
flow_directive.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5#[serde(untagged)]
6pub enum FlowDirectiveValue {
7 Enumerated(FlowDirectiveType),
9 Custom(String),
11}
12
13#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
15pub enum FlowDirectiveType {
16 #[serde(rename = "continue")]
18 Continue,
19 #[serde(rename = "exit")]
21 Exit,
22 #[serde(rename = "end")]
24 End,
25}
26
27impl FlowDirectiveValue {
28 pub fn is_enumerated(&self) -> bool {
30 matches!(self, FlowDirectiveValue::Enumerated(_))
31 }
32
33 pub fn is_termination(&self) -> bool {
35 matches!(
36 self,
37 FlowDirectiveValue::Enumerated(FlowDirectiveType::Exit | FlowDirectiveType::End)
38 )
39 }
40}
41
42impl Default for FlowDirectiveValue {
43 fn default() -> Self {
44 FlowDirectiveValue::Enumerated(FlowDirectiveType::Continue)
45 }
46}