solc_ast_rs_types/types/block/statement/
unchecked.rs

1use serde::{Deserialize, Serialize};
2
3use crate::types::{SourceLocation, Statement};
4
5#[doc = "UncheckedBlock"]
6#[doc = r""]
7#[doc = r" <details><summary>JSON schema</summary>"]
8#[doc = r""]
9#[doc = r" ```json"]
10#[doc = "{"]
11#[doc = "  \"type\": \"object\","]
12#[doc = "  \"required\": ["]
13#[doc = "    \"id\","]
14#[doc = "    \"nodeType\","]
15#[doc = "    \"src\","]
16#[doc = "    \"statements\""]
17#[doc = "  ],"]
18#[doc = "  \"properties\": {"]
19#[doc = "    \"documentation\": {"]
20#[doc = "      \"type\": \"string\""]
21#[doc = "    },"]
22#[doc = "    \"id\": {"]
23#[doc = "      \"type\": \"integer\""]
24#[doc = "    },"]
25#[doc = "    \"nodeType\": {"]
26#[doc = "      \"enum\": ["]
27#[doc = "        \"UncheckedBlock\""]
28#[doc = "      ]"]
29#[doc = "    },"]
30#[doc = "    \"src\": {"]
31#[doc = "      \"$ref\": \"#/definitions/SourceLocation\""]
32#[doc = "    },"]
33#[doc = "    \"statements\": {"]
34#[doc = "      \"type\": \"array\","]
35#[doc = "      \"items\": {"]
36#[doc = "        \"$ref\": \"#/definitions/Statement\""]
37#[doc = "      }"]
38#[doc = "    }"]
39#[doc = "  },"]
40#[doc = "  \"additionalProperties\": false"]
41#[doc = "}"]
42#[doc = r" ```"]
43#[doc = r" </details>"]
44#[derive(Clone, Debug, Deserialize, Serialize)]
45pub struct UncheckedBlock {
46    #[serde(default, skip_serializing_if = "Option::is_none")]
47    pub documentation: Option<String>,
48    pub id: i64,
49    #[serde(rename = "nodeType")]
50    pub node_type: UncheckedBlockNodeType,
51    pub src: SourceLocation,
52    pub statements: Vec<Statement>,
53}
54
55impl From<&UncheckedBlock> for UncheckedBlock {
56    fn from(value: &UncheckedBlock) -> Self {
57        value.clone()
58    }
59}
60
61// Node type
62#[doc = "UncheckedBlockNodeType"]
63#[doc = r""]
64#[doc = r" <details><summary>JSON schema</summary>"]
65#[doc = r""]
66#[doc = r" ```json"]
67#[doc = "{"]
68#[doc = "  \"enum\": ["]
69#[doc = "    \"UncheckedBlock\""]
70#[doc = "  ]"]
71#[doc = "}"]
72#[doc = r" ```"]
73#[doc = r" </details>"]
74#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
75pub enum UncheckedBlockNodeType {
76    UncheckedBlock,
77}
78
79impl From<&UncheckedBlockNodeType> for UncheckedBlockNodeType {
80    fn from(value: &UncheckedBlockNodeType) -> Self {
81        value.clone()
82    }
83}
84
85impl ToString for UncheckedBlockNodeType {
86    fn to_string(&self) -> String {
87        match *self {
88            Self::UncheckedBlock => "UncheckedBlock".to_string(),
89        }
90    }
91}
92
93impl std::str::FromStr for UncheckedBlockNodeType {
94    type Err = crate::error::ConversionError;
95    fn from_str(value: &str) -> Result<Self, crate::error::ConversionError> {
96        match value {
97            "UncheckedBlock" => Ok(Self::UncheckedBlock),
98            _ => Err("invalid value".into()),
99        }
100    }
101}
102
103impl std::convert::TryFrom<&str> for UncheckedBlockNodeType {
104    type Error = crate::error::ConversionError;
105    fn try_from(value: &str) -> Result<Self, crate::error::ConversionError> {
106        value.parse()
107    }
108}
109
110impl std::convert::TryFrom<&String> for UncheckedBlockNodeType {
111    type Error = crate::error::ConversionError;
112    fn try_from(value: &String) -> Result<Self, crate::error::ConversionError> {
113        value.parse()
114    }
115}
116
117impl std::convert::TryFrom<String> for UncheckedBlockNodeType {
118    type Error = crate::error::ConversionError;
119    fn try_from(value: String) -> Result<Self, crate::error::ConversionError> {
120        value.parse()
121    }
122}