avm1_tree/
cfg_blocks.rs

1use crate::{CfgAction, CfgLabel};
2use serde::{Deserialize, Serialize};
3
4#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
5#[serde(rename_all = "snake_case")]
6pub struct CfgErrorBlock {
7  pub label: CfgLabel,
8  pub actions: Vec<CfgAction>,
9}
10
11#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
12#[serde(rename_all = "snake_case")]
13pub struct CfgIfBlock {
14  pub label: CfgLabel,
15  pub actions: Vec<CfgAction>,
16  pub if_true: Option<CfgLabel>,
17  pub if_false: Option<CfgLabel>,
18}
19
20#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
21#[serde(rename_all = "snake_case")]
22pub struct CfgReturnBlock {
23  pub label: CfgLabel,
24  pub actions: Vec<CfgAction>,
25}
26
27#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
28#[serde(rename_all = "snake_case")]
29pub struct CfgSimpleBlock {
30  pub label: CfgLabel,
31  pub actions: Vec<CfgAction>,
32  pub next: Option<CfgLabel>,
33}
34
35#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
36#[serde(rename_all = "snake_case")]
37pub struct CfgTryBlock {
38  pub label: CfgLabel,
39  pub actions: Vec<CfgAction>,
40  pub r#try: crate::Cfg,
41  #[serde(skip_serializing_if = "Option::is_none")]
42  pub catch: Option<crate::Cfg>,
43  pub catch_target: crate::actions::r#try::CatchTarget,
44  #[serde(skip_serializing_if = "Option::is_none")]
45  pub finally: Option<crate::Cfg>,
46}
47
48#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
49#[serde(rename_all = "snake_case")]
50pub struct CfgWaitForFrameBlock {
51  pub label: CfgLabel,
52  pub actions: Vec<CfgAction>,
53  pub frame: u16,
54  pub if_loaded: Option<CfgLabel>,
55  pub if_not_loaded: Option<CfgLabel>,
56}
57
58#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
59#[serde(rename_all = "snake_case")]
60pub struct CfgWaitForFrame2Block {
61  pub label: CfgLabel,
62  pub actions: Vec<CfgAction>,
63  pub if_loaded: Option<CfgLabel>,
64  pub if_not_loaded: Option<CfgLabel>,
65}
66
67#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
68#[serde(rename_all = "snake_case")]
69pub struct CfgWithBlock {
70  pub label: CfgLabel,
71  pub actions: Vec<CfgAction>,
72  pub with: crate::Cfg,
73}
74
75#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
76#[serde(rename_all = "snake_case")]
77pub struct CfgThrowBlock {
78  pub label: CfgLabel,
79  pub actions: Vec<CfgAction>,
80}