solc_ast_rs_types/types/
modifier_definition.rs1use serde::{Deserialize, Serialize};
2
3use crate::types::{
4 Block, OverrideSpecifier, ParameterList, SourceLocation, StructuredDocumentation, Visibility,
5};
6
7#[doc = "ModifierDefinition"]
8#[doc = r""]
9#[doc = r" <details><summary>JSON schema</summary>"]
10#[doc = r""]
11#[doc = r" ```json"]
12#[doc = "{"]
13#[doc = " \"type\": \"object\","]
14#[doc = " \"required\": ["]
15#[doc = " \"body\","]
16#[doc = " \"id\","]
17#[doc = " \"name\","]
18#[doc = " \"nodeType\","]
19#[doc = " \"parameters\","]
20#[doc = " \"src\","]
21#[doc = " \"virtual\","]
22#[doc = " \"visibility\""]
23#[doc = " ],"]
24#[doc = " \"properties\": {"]
25#[doc = " \"baseModifiers\": {"]
26#[doc = " \"anyOf\": ["]
27#[doc = " {"]
28#[doc = " \"type\": \"array\","]
29#[doc = " \"items\": {"]
30#[doc = " \"type\": \"integer\""]
31#[doc = " }"]
32#[doc = " },"]
33#[doc = " {"]
34#[doc = " \"type\": \"null\""]
35#[doc = " }"]
36#[doc = " ]"]
37#[doc = " },"]
38#[doc = " \"body\": {"]
39#[doc = " \"$ref\": \"#/definitions/Block\""]
40#[doc = " },"]
41#[doc = " \"documentation\": {"]
42#[doc = " \"anyOf\": ["]
43#[doc = " {"]
44#[doc = " \"$ref\": \"#/definitions/StructuredDocumentation\""]
45#[doc = " },"]
46#[doc = " {"]
47#[doc = " \"type\": \"null\""]
48#[doc = " }"]
49#[doc = " ]"]
50#[doc = " },"]
51#[doc = " \"id\": {"]
52#[doc = " \"type\": \"integer\""]
53#[doc = " },"]
54#[doc = " \"name\": {"]
55#[doc = " \"type\": \"string\""]
56#[doc = " },"]
57#[doc = " \"nameLocation\": {"]
58#[doc = " \"type\": \"string\""]
59#[doc = " },"]
60#[doc = " \"nodeType\": {"]
61#[doc = " \"enum\": ["]
62#[doc = " \"ModifierDefinition\""]
63#[doc = " ]"]
64#[doc = " },"]
65#[doc = " \"overrides\": {"]
66#[doc = " \"anyOf\": ["]
67#[doc = " {"]
68#[doc = " \"$ref\": \"#/definitions/OverrideSpecifier\""]
69#[doc = " },"]
70#[doc = " {"]
71#[doc = " \"type\": \"null\""]
72#[doc = " }"]
73#[doc = " ]"]
74#[doc = " },"]
75#[doc = " \"parameters\": {"]
76#[doc = " \"$ref\": \"#/definitions/ParameterList\""]
77#[doc = " },"]
78#[doc = " \"src\": {"]
79#[doc = " \"$ref\": \"#/definitions/SourceLocation\""]
80#[doc = " },"]
81#[doc = " \"virtual\": {"]
82#[doc = " \"type\": \"boolean\""]
83#[doc = " },"]
84#[doc = " \"visibility\": {"]
85#[doc = " \"$ref\": \"#/definitions/Visibility\""]
86#[doc = " }"]
87#[doc = " },"]
88#[doc = " \"additionalProperties\": false"]
89#[doc = "}"]
90#[doc = r" ```"]
91#[doc = r" </details>"]
92#[derive(Clone, Debug, Deserialize, Serialize)]
93pub struct ModifierDefinition {
94 #[serde(
95 rename = "baseModifiers",
96 default,
97 skip_serializing_if = "Option::is_none"
98 )]
99 pub base_modifiers: Option<Vec<i64>>,
100 pub body: Block,
101 #[serde(default, skip_serializing_if = "Option::is_none")]
102 pub documentation: Option<StructuredDocumentation>,
103 pub id: i64,
104 pub name: String,
105 #[serde(
106 rename = "nameLocation",
107 default,
108 skip_serializing_if = "Option::is_none"
109 )]
110 pub name_location: Option<String>,
111 #[serde(rename = "nodeType")]
112 pub node_type: ModifierDefinitionNodeType,
113 #[serde(default, skip_serializing_if = "Option::is_none")]
114 pub overrides: Option<OverrideSpecifier>,
115 pub parameters: ParameterList,
116 pub src: SourceLocation,
117 #[serde(rename = "virtual")]
118 pub virtual_: bool,
119 pub visibility: Visibility,
120}
121
122impl From<&ModifierDefinition> for ModifierDefinition {
123 fn from(value: &ModifierDefinition) -> Self {
124 value.clone()
125 }
126}
127
128#[doc = "ModifierDefinitionNodeType"]
130#[doc = r""]
131#[doc = r" <details><summary>JSON schema</summary>"]
132#[doc = r""]
133#[doc = r" ```json"]
134#[doc = "{"]
135#[doc = " \"enum\": ["]
136#[doc = " \"ModifierDefinition\""]
137#[doc = " ]"]
138#[doc = "}"]
139#[doc = r" ```"]
140#[doc = r" </details>"]
141#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
142pub enum ModifierDefinitionNodeType {
143 ModifierDefinition,
144}
145
146impl From<&ModifierDefinitionNodeType> for ModifierDefinitionNodeType {
147 fn from(value: &ModifierDefinitionNodeType) -> Self {
148 value.clone()
149 }
150}
151
152impl ToString for ModifierDefinitionNodeType {
153 fn to_string(&self) -> String {
154 match *self {
155 Self::ModifierDefinition => "ModifierDefinition".to_string(),
156 }
157 }
158}
159
160impl std::str::FromStr for ModifierDefinitionNodeType {
161 type Err = crate::error::ConversionError;
162 fn from_str(value: &str) -> Result<Self, crate::error::ConversionError> {
163 match value {
164 "ModifierDefinition" => Ok(Self::ModifierDefinition),
165 _ => Err("invalid value".into()),
166 }
167 }
168}
169
170impl std::convert::TryFrom<&str> for ModifierDefinitionNodeType {
171 type Error = crate::error::ConversionError;
172 fn try_from(value: &str) -> Result<Self, crate::error::ConversionError> {
173 value.parse()
174 }
175}
176
177impl std::convert::TryFrom<&String> for ModifierDefinitionNodeType {
178 type Error = crate::error::ConversionError;
179 fn try_from(value: &String) -> Result<Self, crate::error::ConversionError> {
180 value.parse()
181 }
182}
183
184impl std::convert::TryFrom<String> for ModifierDefinitionNodeType {
185 type Error = crate::error::ConversionError;
186 fn try_from(value: String) -> Result<Self, crate::error::ConversionError> {
187 value.parse()
188 }
189}