swf_core/models/task/
fork_task.rs1use serde::{Deserialize, Serialize};
2
3use super::{Map, TaskDefinition, TaskDefinitionFields};
4
5#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
7pub struct ForkTaskDefinition {
8 #[serde(rename = "fork")]
10 pub fork: BranchingDefinition,
11
12 #[serde(flatten)]
14 pub common: TaskDefinitionFields,
15}
16impl ForkTaskDefinition {
17 pub fn new(fork: BranchingDefinition) -> Self {
19 Self {
20 fork,
21 common: TaskDefinitionFields::new(),
22 }
23 }
24}
25
26#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
28pub struct BranchingDefinition {
29 #[serde(rename = "branches")]
31 pub branches: Map<String, TaskDefinition>,
32
33 #[serde(rename = "compete")]
35 pub compete: bool,
36}
37impl BranchingDefinition {
38 pub fn new(branches: Map<String, TaskDefinition>, compete: bool) -> Self {
39 Self { branches, compete }
40 }
41}