1#[macro_export]
6macro_rules! create_node {
7 (parent: $parent:expr, id: $id:expr, name: $name:expr) => {
8 fidl_diagnostics_validate::Action::CreateNode(fidl_diagnostics_validate::CreateNode {
9 parent: $parent,
10 id: $id,
11 name: $name.into(),
12 })
13 };
14}
15
16#[macro_export]
17macro_rules! delete_node {
18 (id: $id:expr) => {
19 fidl_diagnostics_validate::Action::DeleteNode(fidl_diagnostics_validate::DeleteNode {
20 id: $id,
21 })
22 };
23}
24
25#[macro_export]
26macro_rules! create_numeric_property {
27 (parent: $parent:expr, id: $id:expr, name: $name:expr, value: $value:expr) => {
28 fidl_diagnostics_validate::Action::CreateNumericProperty(
29 fidl_diagnostics_validate::CreateNumericProperty {
30 parent: $parent,
31 id: $id,
32 name: $name.into(),
33 value: $value,
34 },
35 )
36 };
37}
38
39#[macro_export]
40macro_rules! create_bytes_property {
41 (parent: $parent:expr, id: $id:expr, name: $name:expr, value: $value:expr) => {
42 fidl_diagnostics_validate::Action::CreateBytesProperty(
43 fidl_diagnostics_validate::CreateBytesProperty {
44 parent: $parent,
45 id: $id,
46 name: $name.into(),
47 value: $value.into(),
48 },
49 )
50 };
51}
52
53#[macro_export]
54macro_rules! create_string_property {
55 (parent: $parent:expr, id: $id:expr, name: $name:expr, value: $value:expr) => {
56 fidl_diagnostics_validate::Action::CreateStringProperty(
57 fidl_diagnostics_validate::CreateStringProperty {
58 parent: $parent,
59 id: $id,
60 name: $name.into(),
61 value: $value.into(),
62 },
63 )
64 };
65}
66
67#[macro_export]
68macro_rules! create_bool_property {
69 (parent: $parent:expr, id: $id:expr, name: $name:expr, value: $value:expr) => {
70 fidl_diagnostics_validate::Action::CreateBoolProperty(
71 fidl_diagnostics_validate::CreateBoolProperty {
72 parent: $parent,
73 id: $id,
74 name: $name.into(),
75 value: $value.into(),
76 },
77 )
78 };
79}
80
81#[macro_export]
82macro_rules! set_string {
83 (id: $id:expr, value: $value:expr) => {
84 fidl_diagnostics_validate::Action::SetString(fidl_diagnostics_validate::SetString {
85 id: $id,
86 value: $value.into(),
87 })
88 };
89}
90
91#[macro_export]
92macro_rules! set_bytes {
93 (id: $id:expr, value: $value:expr) => {
94 fidl_diagnostics_validate::Action::SetBytes(fidl_diagnostics_validate::SetBytes {
95 id: $id,
96 value: $value.into(),
97 })
98 };
99}
100
101#[macro_export]
102macro_rules! set_number {
103 (id: $id:expr, value: $value:expr) => {
104 fidl_diagnostics_validate::Action::SetNumber(fidl_diagnostics_validate::SetNumber {
105 id: $id,
106 value: $value,
107 })
108 };
109}
110
111#[macro_export]
112macro_rules! set_bool {
113 (id: $id:expr, value: $value:expr) => {
114 fidl_diagnostics_validate::Action::SetBool(fidl_diagnostics_validate::SetBool {
115 id: $id,
116 value: $value.into(),
117 })
118 };
119}
120
121#[macro_export]
122macro_rules! add_number {
123 (id: $id:expr, value: $value:expr) => {
124 fidl_diagnostics_validate::Action::AddNumber(fidl_diagnostics_validate::AddNumber {
125 id: $id,
126 value: $value,
127 })
128 };
129}
130
131#[macro_export]
132macro_rules! subtract_number {
133 (id: $id:expr, value: $value:expr) => {
134 fidl_diagnostics_validate::Action::SubtractNumber(
135 fidl_diagnostics_validate::SubtractNumber { id: $id, value: $value },
136 )
137 };
138}
139
140#[macro_export]
141macro_rules! delete_property {
142 (id: $id:expr) => {
143 fidl_diagnostics_validate::Action::DeleteProperty(
144 fidl_diagnostics_validate::DeleteProperty { id: $id },
145 )
146 };
147}
148
149#[macro_export]
150macro_rules! apply_no_op {
151 () => {
152 fidl_diagnostics_validate::Action::ApplyNoOp(fidl_diagnostics_validate::ApplyNoOp {})
153 };
154}
155
156#[macro_export]
157macro_rules! create_array_property {
158 (parent: $parent:expr, id: $id:expr, name: $name:expr, slots: $slots:expr, type: $type:expr) => {
159 fidl_diagnostics_validate::Action::CreateArrayProperty(
160 fidl_diagnostics_validate::CreateArrayProperty {
161 parent: $parent,
162 id: $id,
163 name: $name.into(),
164 slots: $slots,
165 value_type: $type,
166 },
167 )
168 };
169}
170
171#[macro_export]
172macro_rules! array_set {
173 (id: $id:expr, index: $index:expr, value: $value:expr) => {
174 fidl_diagnostics_validate::Action::ArraySet(fidl_diagnostics_validate::ArraySet {
175 id: $id,
176 index: $index,
177 value: $value,
178 })
179 };
180}
181
182#[macro_export]
183macro_rules! array_add {
184 (id: $id:expr, index: $index:expr, value: $value:expr) => {
185 fidl_diagnostics_validate::Action::ArrayAdd(fidl_diagnostics_validate::ArrayAdd {
186 id: $id,
187 index: $index,
188 value: $value,
189 })
190 };
191}
192
193#[macro_export]
194macro_rules! array_subtract {
195 (id: $id:expr, index: $index:expr, value: $value:expr) => {
196 fidl_diagnostics_validate::Action::ArraySubtract(fidl_diagnostics_validate::ArraySubtract {
197 id: $id,
198 index: $index,
199 value: $value,
200 })
201 };
202}
203
204#[macro_export]
205macro_rules! create_linear_histogram {
206 (parent: $parent:expr, id: $id:expr, name: $name:expr, floor: $floor:expr,
207 step_size: $step_size:expr, buckets: $buckets:expr, type: $type:ident) => {
208 fidl_diagnostics_validate::Action::CreateLinearHistogram(
209 fidl_diagnostics_validate::CreateLinearHistogram {
210 parent: $parent,
211 id: $id,
212 name: $name.into(),
213 floor: Value::$type($floor),
214 step_size: Value::$type($step_size),
215 buckets: $buckets,
216 },
217 )
218 };
219}
220
221#[macro_export]
222macro_rules! create_exponential_histogram {
223 (parent: $parent:expr, id: $id:expr, name: $name:expr, floor: $floor:expr,
224 initial_step: $initial_step:expr, step_multiplier: $step_multiplier:expr,
225 buckets: $buckets:expr, type: $type:ident) => {
226 fidl_diagnostics_validate::Action::CreateExponentialHistogram(
227 fidl_diagnostics_validate::CreateExponentialHistogram {
228 parent: $parent,
229 id: $id,
230 name: $name.into(),
231 floor: Value::$type($floor),
232 initial_step: Value::$type($initial_step),
233 step_multiplier: Value::$type($step_multiplier),
234 buckets: $buckets,
235 },
236 )
237 };
238}
239
240#[macro_export]
241macro_rules! insert {
242 (id: $id:expr, value: $value:expr) => {
243 fidl_diagnostics_validate::Action::Insert(fidl_diagnostics_validate::Insert {
244 id: $id,
245 value: $value,
246 })
247 };
248}
249
250#[macro_export]
251macro_rules! insert_multiple {
252 (id: $id:expr, value: $value:expr, count: $count:expr) => {
253 fidl_diagnostics_validate::Action::InsertMultiple(
254 fidl_diagnostics_validate::InsertMultiple { id: $id, value: $value, count: $count },
255 )
256 };
257}
258
259#[macro_export]
260macro_rules! create_lazy_node {
261 (parent: $parent:expr, id: $id:expr, name: $name:expr, disposition: $disposition:expr, actions: $actions:expr) => {
262 fidl_diagnostics_validate::LazyAction::CreateLazyNode(
263 fidl_diagnostics_validate::CreateLazyNode {
264 parent: $parent,
265 id: $id,
266 name: $name.into(),
267 disposition: $disposition,
268 actions: $actions,
269 },
270 )
271 };
272}
273
274#[macro_export]
275macro_rules! delete_lazy_node {
276 (id: $id:expr) => {
277 fidl_diagnostics_validate::LazyAction::DeleteLazyNode(
278 fidl_diagnostics_validate::DeleteLazyNode { id: $id },
279 )
280 };
281}