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
39
40
use crate::FieldList;

#[derive(Debug, PartialEq)]
pub struct Transition {
    pub name: String,
    pub params: FieldList,
}

impl Transition {
    pub fn new(name: &str, params: FieldList) -> Self {
        Self {
            name: name.to_string(),
            params,
        }
    }

    pub fn new_without_param(name: &str) -> Self {
        Self {
            name: name.to_string(),
            params: FieldList::default(),
        }
    }
}

#[derive(Debug, PartialEq, Default)]
pub struct TransitionList(pub Vec<Transition>);

impl std::ops::Deref for TransitionList {
    type Target = Vec<Transition>;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl std::ops::DerefMut for TransitionList {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}