]>
Commit | Line | Data |
---|---|---|
e74abb32 XL |
1 | // This file is @generated by syn-internal-codegen. |
2 | // It is not intended for manual editing. | |
3 | ||
4 | #![allow(unreachable_code, unused_variables)] | |
add651ee FG |
5 | #![allow( |
6 | clippy::match_wildcard_for_single_variants, | |
7 | clippy::needless_match, | |
8 | clippy::needless_pass_by_ref_mut, | |
9 | )] | |
e74abb32 XL |
10 | #[cfg(any(feature = "full", feature = "derive"))] |
11 | use crate::gen::helper::fold::*; | |
e74abb32 XL |
12 | use crate::*; |
13 | use proc_macro2::Span; | |
14 | #[cfg(feature = "full")] | |
15 | macro_rules! full { | |
16 | ($e:expr) => { | |
17 | $e | |
18 | }; | |
19 | } | |
20 | #[cfg(all(feature = "derive", not(feature = "full")))] | |
21 | macro_rules! full { | |
22 | ($e:expr) => { | |
04454e1e | 23 | unreachable!() |
e74abb32 XL |
24 | }; |
25 | } | |
26 | /// Syntax tree traversal to transform the nodes of an owned syntax tree. | |
27 | /// | |
28 | /// See the [module documentation] for details. | |
29 | /// | |
30 | /// [module documentation]: self | |
e74abb32 XL |
31 | pub trait Fold { |
32 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 33 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
34 | fn fold_abi(&mut self, i: Abi) -> Abi { |
35 | fold_abi(self, i) | |
36 | } | |
37 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 38 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
39 | fn fold_angle_bracketed_generic_arguments( |
40 | &mut self, | |
41 | i: AngleBracketedGenericArguments, | |
42 | ) -> AngleBracketedGenericArguments { | |
43 | fold_angle_bracketed_generic_arguments(self, i) | |
44 | } | |
45 | #[cfg(feature = "full")] | |
c0240ec0 | 46 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
47 | fn fold_arm(&mut self, i: Arm) -> Arm { |
48 | fold_arm(self, i) | |
49 | } | |
50 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 51 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 FG |
52 | fn fold_assoc_const(&mut self, i: AssocConst) -> AssocConst { |
53 | fold_assoc_const(self, i) | |
54 | } | |
55 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 56 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 FG |
57 | fn fold_assoc_type(&mut self, i: AssocType) -> AssocType { |
58 | fold_assoc_type(self, i) | |
59 | } | |
60 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 61 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
62 | fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle { |
63 | fold_attr_style(self, i) | |
64 | } | |
65 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 66 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
67 | fn fold_attribute(&mut self, i: Attribute) -> Attribute { |
68 | fold_attribute(self, i) | |
69 | } | |
70 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 71 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
72 | fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg { |
73 | fold_bare_fn_arg(self, i) | |
74 | } | |
75 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 76 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 FG |
77 | fn fold_bare_variadic(&mut self, i: BareVariadic) -> BareVariadic { |
78 | fold_bare_variadic(self, i) | |
e74abb32 XL |
79 | } |
80 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 81 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 FG |
82 | fn fold_bin_op(&mut self, i: BinOp) -> BinOp { |
83 | fold_bin_op(self, i) | |
e74abb32 XL |
84 | } |
85 | #[cfg(feature = "full")] | |
c0240ec0 | 86 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
87 | fn fold_block(&mut self, i: Block) -> Block { |
88 | fold_block(self, i) | |
89 | } | |
90 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 91 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
92 | fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes { |
93 | fold_bound_lifetimes(self, i) | |
94 | } | |
95 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 96 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
97 | fn fold_const_param(&mut self, i: ConstParam) -> ConstParam { |
98 | fold_const_param(self, i) | |
99 | } | |
100 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 101 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
102 | fn fold_constraint(&mut self, i: Constraint) -> Constraint { |
103 | fold_constraint(self, i) | |
104 | } | |
105 | #[cfg(feature = "derive")] | |
c0240ec0 | 106 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
107 | fn fold_data(&mut self, i: Data) -> Data { |
108 | fold_data(self, i) | |
109 | } | |
110 | #[cfg(feature = "derive")] | |
c0240ec0 | 111 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
112 | fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum { |
113 | fold_data_enum(self, i) | |
114 | } | |
115 | #[cfg(feature = "derive")] | |
c0240ec0 | 116 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
117 | fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct { |
118 | fold_data_struct(self, i) | |
119 | } | |
120 | #[cfg(feature = "derive")] | |
c0240ec0 | 121 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
122 | fn fold_data_union(&mut self, i: DataUnion) -> DataUnion { |
123 | fold_data_union(self, i) | |
124 | } | |
125 | #[cfg(feature = "derive")] | |
c0240ec0 | 126 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
127 | fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput { |
128 | fold_derive_input(self, i) | |
129 | } | |
130 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 131 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
132 | fn fold_expr(&mut self, i: Expr) -> Expr { |
133 | fold_expr(self, i) | |
134 | } | |
135 | #[cfg(feature = "full")] | |
c0240ec0 | 136 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
137 | fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray { |
138 | fold_expr_array(self, i) | |
139 | } | |
140 | #[cfg(feature = "full")] | |
c0240ec0 | 141 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
142 | fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign { |
143 | fold_expr_assign(self, i) | |
144 | } | |
145 | #[cfg(feature = "full")] | |
c0240ec0 | 146 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
147 | fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync { |
148 | fold_expr_async(self, i) | |
149 | } | |
150 | #[cfg(feature = "full")] | |
c0240ec0 | 151 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
152 | fn fold_expr_await(&mut self, i: ExprAwait) -> ExprAwait { |
153 | fold_expr_await(self, i) | |
154 | } | |
155 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 156 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
157 | fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary { |
158 | fold_expr_binary(self, i) | |
159 | } | |
160 | #[cfg(feature = "full")] | |
c0240ec0 | 161 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
162 | fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock { |
163 | fold_expr_block(self, i) | |
164 | } | |
165 | #[cfg(feature = "full")] | |
c0240ec0 | 166 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
167 | fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak { |
168 | fold_expr_break(self, i) | |
169 | } | |
170 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 171 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
172 | fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall { |
173 | fold_expr_call(self, i) | |
174 | } | |
175 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 176 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
177 | fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast { |
178 | fold_expr_cast(self, i) | |
179 | } | |
180 | #[cfg(feature = "full")] | |
c0240ec0 | 181 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
182 | fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure { |
183 | fold_expr_closure(self, i) | |
184 | } | |
185 | #[cfg(feature = "full")] | |
c0240ec0 | 186 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
187 | fn fold_expr_const(&mut self, i: ExprConst) -> ExprConst { |
188 | fold_expr_const(self, i) | |
189 | } | |
190 | #[cfg(feature = "full")] | |
c0240ec0 | 191 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
192 | fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue { |
193 | fold_expr_continue(self, i) | |
194 | } | |
195 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 196 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
197 | fn fold_expr_field(&mut self, i: ExprField) -> ExprField { |
198 | fold_expr_field(self, i) | |
199 | } | |
200 | #[cfg(feature = "full")] | |
c0240ec0 | 201 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
202 | fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop { |
203 | fold_expr_for_loop(self, i) | |
204 | } | |
353b0b11 | 205 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 206 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
207 | fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup { |
208 | fold_expr_group(self, i) | |
209 | } | |
210 | #[cfg(feature = "full")] | |
c0240ec0 | 211 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
212 | fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf { |
213 | fold_expr_if(self, i) | |
214 | } | |
215 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 216 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
217 | fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex { |
218 | fold_expr_index(self, i) | |
219 | } | |
220 | #[cfg(feature = "full")] | |
c0240ec0 | 221 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
222 | fn fold_expr_infer(&mut self, i: ExprInfer) -> ExprInfer { |
223 | fold_expr_infer(self, i) | |
224 | } | |
225 | #[cfg(feature = "full")] | |
c0240ec0 | 226 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
227 | fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet { |
228 | fold_expr_let(self, i) | |
229 | } | |
230 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 231 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
232 | fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit { |
233 | fold_expr_lit(self, i) | |
234 | } | |
235 | #[cfg(feature = "full")] | |
c0240ec0 | 236 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
237 | fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop { |
238 | fold_expr_loop(self, i) | |
239 | } | |
353b0b11 | 240 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 241 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
242 | fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro { |
243 | fold_expr_macro(self, i) | |
244 | } | |
245 | #[cfg(feature = "full")] | |
c0240ec0 | 246 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
247 | fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch { |
248 | fold_expr_match(self, i) | |
249 | } | |
c0240ec0 FG |
250 | #[cfg(any(feature = "derive", feature = "full"))] |
251 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] | |
e74abb32 XL |
252 | fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall { |
253 | fold_expr_method_call(self, i) | |
254 | } | |
255 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 256 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
257 | fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen { |
258 | fold_expr_paren(self, i) | |
259 | } | |
260 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 261 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
262 | fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath { |
263 | fold_expr_path(self, i) | |
264 | } | |
265 | #[cfg(feature = "full")] | |
c0240ec0 | 266 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
267 | fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange { |
268 | fold_expr_range(self, i) | |
269 | } | |
c0240ec0 FG |
270 | #[cfg(any(feature = "derive", feature = "full"))] |
271 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] | |
e74abb32 XL |
272 | fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference { |
273 | fold_expr_reference(self, i) | |
274 | } | |
275 | #[cfg(feature = "full")] | |
c0240ec0 | 276 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
277 | fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat { |
278 | fold_expr_repeat(self, i) | |
279 | } | |
280 | #[cfg(feature = "full")] | |
c0240ec0 | 281 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
282 | fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn { |
283 | fold_expr_return(self, i) | |
284 | } | |
c0240ec0 FG |
285 | #[cfg(any(feature = "derive", feature = "full"))] |
286 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] | |
e74abb32 XL |
287 | fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct { |
288 | fold_expr_struct(self, i) | |
289 | } | |
290 | #[cfg(feature = "full")] | |
c0240ec0 | 291 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
292 | fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry { |
293 | fold_expr_try(self, i) | |
294 | } | |
295 | #[cfg(feature = "full")] | |
c0240ec0 | 296 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
297 | fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock { |
298 | fold_expr_try_block(self, i) | |
299 | } | |
300 | #[cfg(feature = "full")] | |
c0240ec0 | 301 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
302 | fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple { |
303 | fold_expr_tuple(self, i) | |
304 | } | |
e74abb32 | 305 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 306 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
307 | fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary { |
308 | fold_expr_unary(self, i) | |
309 | } | |
310 | #[cfg(feature = "full")] | |
c0240ec0 | 311 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
312 | fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe { |
313 | fold_expr_unsafe(self, i) | |
314 | } | |
315 | #[cfg(feature = "full")] | |
c0240ec0 | 316 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
317 | fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile { |
318 | fold_expr_while(self, i) | |
319 | } | |
320 | #[cfg(feature = "full")] | |
c0240ec0 | 321 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
322 | fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield { |
323 | fold_expr_yield(self, i) | |
324 | } | |
325 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 326 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
327 | fn fold_field(&mut self, i: Field) -> Field { |
328 | fold_field(self, i) | |
329 | } | |
353b0b11 | 330 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 331 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 FG |
332 | fn fold_field_mutability(&mut self, i: FieldMutability) -> FieldMutability { |
333 | fold_field_mutability(self, i) | |
334 | } | |
e74abb32 | 335 | #[cfg(feature = "full")] |
c0240ec0 | 336 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
337 | fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat { |
338 | fold_field_pat(self, i) | |
339 | } | |
c0240ec0 FG |
340 | #[cfg(any(feature = "derive", feature = "full"))] |
341 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] | |
e74abb32 XL |
342 | fn fold_field_value(&mut self, i: FieldValue) -> FieldValue { |
343 | fold_field_value(self, i) | |
344 | } | |
345 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 346 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
347 | fn fold_fields(&mut self, i: Fields) -> Fields { |
348 | fold_fields(self, i) | |
349 | } | |
350 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 351 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
352 | fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed { |
353 | fold_fields_named(self, i) | |
354 | } | |
355 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 356 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
357 | fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed { |
358 | fold_fields_unnamed(self, i) | |
359 | } | |
360 | #[cfg(feature = "full")] | |
c0240ec0 | 361 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
362 | fn fold_file(&mut self, i: File) -> File { |
363 | fold_file(self, i) | |
364 | } | |
365 | #[cfg(feature = "full")] | |
c0240ec0 | 366 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
367 | fn fold_fn_arg(&mut self, i: FnArg) -> FnArg { |
368 | fold_fn_arg(self, i) | |
369 | } | |
370 | #[cfg(feature = "full")] | |
c0240ec0 | 371 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
372 | fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem { |
373 | fold_foreign_item(self, i) | |
374 | } | |
375 | #[cfg(feature = "full")] | |
c0240ec0 | 376 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
377 | fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn { |
378 | fold_foreign_item_fn(self, i) | |
379 | } | |
380 | #[cfg(feature = "full")] | |
c0240ec0 | 381 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
382 | fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro { |
383 | fold_foreign_item_macro(self, i) | |
384 | } | |
385 | #[cfg(feature = "full")] | |
c0240ec0 | 386 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
387 | fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic { |
388 | fold_foreign_item_static(self, i) | |
389 | } | |
390 | #[cfg(feature = "full")] | |
c0240ec0 | 391 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
392 | fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType { |
393 | fold_foreign_item_type(self, i) | |
394 | } | |
395 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 396 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
397 | fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument { |
398 | fold_generic_argument(self, i) | |
399 | } | |
e74abb32 | 400 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 401 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
402 | fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam { |
403 | fold_generic_param(self, i) | |
404 | } | |
405 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 406 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
407 | fn fold_generics(&mut self, i: Generics) -> Generics { |
408 | fold_generics(self, i) | |
409 | } | |
410 | fn fold_ident(&mut self, i: Ident) -> Ident { | |
411 | fold_ident(self, i) | |
412 | } | |
413 | #[cfg(feature = "full")] | |
c0240ec0 | 414 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
415 | fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem { |
416 | fold_impl_item(self, i) | |
417 | } | |
418 | #[cfg(feature = "full")] | |
c0240ec0 | 419 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
420 | fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst { |
421 | fold_impl_item_const(self, i) | |
422 | } | |
423 | #[cfg(feature = "full")] | |
c0240ec0 | 424 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
425 | fn fold_impl_item_fn(&mut self, i: ImplItemFn) -> ImplItemFn { |
426 | fold_impl_item_fn(self, i) | |
e74abb32 XL |
427 | } |
428 | #[cfg(feature = "full")] | |
c0240ec0 | 429 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
430 | fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro { |
431 | fold_impl_item_macro(self, i) | |
e74abb32 XL |
432 | } |
433 | #[cfg(feature = "full")] | |
c0240ec0 | 434 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
435 | fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType { |
436 | fold_impl_item_type(self, i) | |
437 | } | |
353b0b11 | 438 | #[cfg(feature = "full")] |
c0240ec0 | 439 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
440 | fn fold_impl_restriction(&mut self, i: ImplRestriction) -> ImplRestriction { |
441 | fold_impl_restriction(self, i) | |
442 | } | |
e74abb32 | 443 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 444 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
445 | fn fold_index(&mut self, i: Index) -> Index { |
446 | fold_index(self, i) | |
447 | } | |
448 | #[cfg(feature = "full")] | |
c0240ec0 | 449 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
450 | fn fold_item(&mut self, i: Item) -> Item { |
451 | fold_item(self, i) | |
452 | } | |
453 | #[cfg(feature = "full")] | |
c0240ec0 | 454 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
455 | fn fold_item_const(&mut self, i: ItemConst) -> ItemConst { |
456 | fold_item_const(self, i) | |
457 | } | |
458 | #[cfg(feature = "full")] | |
c0240ec0 | 459 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
460 | fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum { |
461 | fold_item_enum(self, i) | |
462 | } | |
463 | #[cfg(feature = "full")] | |
c0240ec0 | 464 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
465 | fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate { |
466 | fold_item_extern_crate(self, i) | |
467 | } | |
468 | #[cfg(feature = "full")] | |
c0240ec0 | 469 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
470 | fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn { |
471 | fold_item_fn(self, i) | |
472 | } | |
473 | #[cfg(feature = "full")] | |
c0240ec0 | 474 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
475 | fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod { |
476 | fold_item_foreign_mod(self, i) | |
477 | } | |
478 | #[cfg(feature = "full")] | |
c0240ec0 | 479 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
480 | fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl { |
481 | fold_item_impl(self, i) | |
482 | } | |
483 | #[cfg(feature = "full")] | |
c0240ec0 | 484 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
485 | fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro { |
486 | fold_item_macro(self, i) | |
487 | } | |
488 | #[cfg(feature = "full")] | |
c0240ec0 | 489 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
490 | fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod { |
491 | fold_item_mod(self, i) | |
492 | } | |
493 | #[cfg(feature = "full")] | |
c0240ec0 | 494 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
495 | fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic { |
496 | fold_item_static(self, i) | |
497 | } | |
498 | #[cfg(feature = "full")] | |
c0240ec0 | 499 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
500 | fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct { |
501 | fold_item_struct(self, i) | |
502 | } | |
503 | #[cfg(feature = "full")] | |
c0240ec0 | 504 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
505 | fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait { |
506 | fold_item_trait(self, i) | |
507 | } | |
508 | #[cfg(feature = "full")] | |
c0240ec0 | 509 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
510 | fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias { |
511 | fold_item_trait_alias(self, i) | |
512 | } | |
513 | #[cfg(feature = "full")] | |
c0240ec0 | 514 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
515 | fn fold_item_type(&mut self, i: ItemType) -> ItemType { |
516 | fold_item_type(self, i) | |
517 | } | |
518 | #[cfg(feature = "full")] | |
c0240ec0 | 519 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
520 | fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion { |
521 | fold_item_union(self, i) | |
522 | } | |
523 | #[cfg(feature = "full")] | |
c0240ec0 | 524 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
525 | fn fold_item_use(&mut self, i: ItemUse) -> ItemUse { |
526 | fold_item_use(self, i) | |
527 | } | |
528 | #[cfg(feature = "full")] | |
c0240ec0 | 529 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
530 | fn fold_label(&mut self, i: Label) -> Label { |
531 | fold_label(self, i) | |
532 | } | |
533 | fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime { | |
534 | fold_lifetime(self, i) | |
535 | } | |
536 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 537 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 FG |
538 | fn fold_lifetime_param(&mut self, i: LifetimeParam) -> LifetimeParam { |
539 | fold_lifetime_param(self, i) | |
e74abb32 | 540 | } |
e74abb32 XL |
541 | fn fold_lit(&mut self, i: Lit) -> Lit { |
542 | fold_lit(self, i) | |
543 | } | |
e74abb32 XL |
544 | fn fold_lit_bool(&mut self, i: LitBool) -> LitBool { |
545 | fold_lit_bool(self, i) | |
546 | } | |
e74abb32 XL |
547 | fn fold_lit_byte(&mut self, i: LitByte) -> LitByte { |
548 | fold_lit_byte(self, i) | |
549 | } | |
e74abb32 XL |
550 | fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr { |
551 | fold_lit_byte_str(self, i) | |
552 | } | |
e74abb32 XL |
553 | fn fold_lit_char(&mut self, i: LitChar) -> LitChar { |
554 | fold_lit_char(self, i) | |
555 | } | |
e74abb32 XL |
556 | fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat { |
557 | fold_lit_float(self, i) | |
558 | } | |
e74abb32 XL |
559 | fn fold_lit_int(&mut self, i: LitInt) -> LitInt { |
560 | fold_lit_int(self, i) | |
561 | } | |
e74abb32 XL |
562 | fn fold_lit_str(&mut self, i: LitStr) -> LitStr { |
563 | fold_lit_str(self, i) | |
564 | } | |
565 | #[cfg(feature = "full")] | |
c0240ec0 | 566 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
567 | fn fold_local(&mut self, i: Local) -> Local { |
568 | fold_local(self, i) | |
569 | } | |
353b0b11 | 570 | #[cfg(feature = "full")] |
c0240ec0 | 571 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
572 | fn fold_local_init(&mut self, i: LocalInit) -> LocalInit { |
573 | fold_local_init(self, i) | |
574 | } | |
e74abb32 | 575 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 576 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
577 | fn fold_macro(&mut self, i: Macro) -> Macro { |
578 | fold_macro(self, i) | |
579 | } | |
580 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 581 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
582 | fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter { |
583 | fold_macro_delimiter(self, i) | |
584 | } | |
585 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 586 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
587 | fn fold_member(&mut self, i: Member) -> Member { |
588 | fold_member(self, i) | |
589 | } | |
590 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 591 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
592 | fn fold_meta(&mut self, i: Meta) -> Meta { |
593 | fold_meta(self, i) | |
594 | } | |
595 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 596 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
597 | fn fold_meta_list(&mut self, i: MetaList) -> MetaList { |
598 | fold_meta_list(self, i) | |
599 | } | |
600 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 601 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
602 | fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue { |
603 | fold_meta_name_value(self, i) | |
604 | } | |
e74abb32 | 605 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 606 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
607 | fn fold_parenthesized_generic_arguments( |
608 | &mut self, | |
609 | i: ParenthesizedGenericArguments, | |
610 | ) -> ParenthesizedGenericArguments { | |
611 | fold_parenthesized_generic_arguments(self, i) | |
612 | } | |
613 | #[cfg(feature = "full")] | |
c0240ec0 | 614 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
615 | fn fold_pat(&mut self, i: Pat) -> Pat { |
616 | fold_pat(self, i) | |
617 | } | |
618 | #[cfg(feature = "full")] | |
c0240ec0 | 619 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
620 | fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent { |
621 | fold_pat_ident(self, i) | |
622 | } | |
623 | #[cfg(feature = "full")] | |
c0240ec0 | 624 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
625 | fn fold_pat_or(&mut self, i: PatOr) -> PatOr { |
626 | fold_pat_or(self, i) | |
627 | } | |
628 | #[cfg(feature = "full")] | |
c0240ec0 | 629 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
630 | fn fold_pat_paren(&mut self, i: PatParen) -> PatParen { |
631 | fold_pat_paren(self, i) | |
e74abb32 XL |
632 | } |
633 | #[cfg(feature = "full")] | |
c0240ec0 | 634 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
635 | fn fold_pat_reference(&mut self, i: PatReference) -> PatReference { |
636 | fold_pat_reference(self, i) | |
637 | } | |
638 | #[cfg(feature = "full")] | |
c0240ec0 | 639 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
640 | fn fold_pat_rest(&mut self, i: PatRest) -> PatRest { |
641 | fold_pat_rest(self, i) | |
642 | } | |
643 | #[cfg(feature = "full")] | |
c0240ec0 | 644 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
645 | fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice { |
646 | fold_pat_slice(self, i) | |
647 | } | |
648 | #[cfg(feature = "full")] | |
c0240ec0 | 649 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
650 | fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct { |
651 | fold_pat_struct(self, i) | |
652 | } | |
653 | #[cfg(feature = "full")] | |
c0240ec0 | 654 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
655 | fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple { |
656 | fold_pat_tuple(self, i) | |
657 | } | |
658 | #[cfg(feature = "full")] | |
c0240ec0 | 659 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
660 | fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct { |
661 | fold_pat_tuple_struct(self, i) | |
662 | } | |
663 | #[cfg(feature = "full")] | |
c0240ec0 | 664 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
665 | fn fold_pat_type(&mut self, i: PatType) -> PatType { |
666 | fold_pat_type(self, i) | |
667 | } | |
668 | #[cfg(feature = "full")] | |
c0240ec0 | 669 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
670 | fn fold_pat_wild(&mut self, i: PatWild) -> PatWild { |
671 | fold_pat_wild(self, i) | |
672 | } | |
673 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 674 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
675 | fn fold_path(&mut self, i: Path) -> Path { |
676 | fold_path(self, i) | |
677 | } | |
678 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 679 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
680 | fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments { |
681 | fold_path_arguments(self, i) | |
682 | } | |
683 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 684 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
685 | fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment { |
686 | fold_path_segment(self, i) | |
687 | } | |
688 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 689 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
690 | fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime { |
691 | fold_predicate_lifetime(self, i) | |
692 | } | |
693 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 694 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
695 | fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType { |
696 | fold_predicate_type(self, i) | |
697 | } | |
698 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 699 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
700 | fn fold_qself(&mut self, i: QSelf) -> QSelf { |
701 | fold_qself(self, i) | |
702 | } | |
703 | #[cfg(feature = "full")] | |
c0240ec0 | 704 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
705 | fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits { |
706 | fold_range_limits(self, i) | |
707 | } | |
708 | #[cfg(feature = "full")] | |
c0240ec0 | 709 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
710 | fn fold_receiver(&mut self, i: Receiver) -> Receiver { |
711 | fold_receiver(self, i) | |
712 | } | |
713 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 714 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
715 | fn fold_return_type(&mut self, i: ReturnType) -> ReturnType { |
716 | fold_return_type(self, i) | |
717 | } | |
718 | #[cfg(feature = "full")] | |
c0240ec0 | 719 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
720 | fn fold_signature(&mut self, i: Signature) -> Signature { |
721 | fold_signature(self, i) | |
722 | } | |
723 | fn fold_span(&mut self, i: Span) -> Span { | |
724 | fold_span(self, i) | |
725 | } | |
726 | #[cfg(feature = "full")] | |
c0240ec0 | 727 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
728 | fn fold_static_mutability(&mut self, i: StaticMutability) -> StaticMutability { |
729 | fold_static_mutability(self, i) | |
730 | } | |
731 | #[cfg(feature = "full")] | |
c0240ec0 | 732 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
733 | fn fold_stmt(&mut self, i: Stmt) -> Stmt { |
734 | fold_stmt(self, i) | |
735 | } | |
353b0b11 | 736 | #[cfg(feature = "full")] |
c0240ec0 | 737 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
738 | fn fold_stmt_macro(&mut self, i: StmtMacro) -> StmtMacro { |
739 | fold_stmt_macro(self, i) | |
740 | } | |
e74abb32 | 741 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 742 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
743 | fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound { |
744 | fold_trait_bound(self, i) | |
745 | } | |
746 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 747 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
5099ac24 FG |
748 | fn fold_trait_bound_modifier( |
749 | &mut self, | |
750 | i: TraitBoundModifier, | |
751 | ) -> TraitBoundModifier { | |
e74abb32 XL |
752 | fold_trait_bound_modifier(self, i) |
753 | } | |
754 | #[cfg(feature = "full")] | |
c0240ec0 | 755 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
756 | fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem { |
757 | fold_trait_item(self, i) | |
758 | } | |
759 | #[cfg(feature = "full")] | |
c0240ec0 | 760 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
761 | fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst { |
762 | fold_trait_item_const(self, i) | |
763 | } | |
764 | #[cfg(feature = "full")] | |
c0240ec0 | 765 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
766 | fn fold_trait_item_fn(&mut self, i: TraitItemFn) -> TraitItemFn { |
767 | fold_trait_item_fn(self, i) | |
e74abb32 XL |
768 | } |
769 | #[cfg(feature = "full")] | |
c0240ec0 | 770 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
771 | fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro { |
772 | fold_trait_item_macro(self, i) | |
e74abb32 XL |
773 | } |
774 | #[cfg(feature = "full")] | |
c0240ec0 | 775 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
776 | fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType { |
777 | fold_trait_item_type(self, i) | |
778 | } | |
779 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 780 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
781 | fn fold_type(&mut self, i: Type) -> Type { |
782 | fold_type(self, i) | |
783 | } | |
784 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 785 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
786 | fn fold_type_array(&mut self, i: TypeArray) -> TypeArray { |
787 | fold_type_array(self, i) | |
788 | } | |
789 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 790 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
791 | fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn { |
792 | fold_type_bare_fn(self, i) | |
793 | } | |
794 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 795 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
796 | fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup { |
797 | fold_type_group(self, i) | |
798 | } | |
799 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 800 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
801 | fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait { |
802 | fold_type_impl_trait(self, i) | |
803 | } | |
804 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 805 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
806 | fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer { |
807 | fold_type_infer(self, i) | |
808 | } | |
809 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 810 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
811 | fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro { |
812 | fold_type_macro(self, i) | |
813 | } | |
814 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 815 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
816 | fn fold_type_never(&mut self, i: TypeNever) -> TypeNever { |
817 | fold_type_never(self, i) | |
818 | } | |
819 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 820 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
821 | fn fold_type_param(&mut self, i: TypeParam) -> TypeParam { |
822 | fold_type_param(self, i) | |
823 | } | |
824 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 825 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
826 | fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound { |
827 | fold_type_param_bound(self, i) | |
828 | } | |
829 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 830 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
831 | fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen { |
832 | fold_type_paren(self, i) | |
833 | } | |
834 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 835 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
836 | fn fold_type_path(&mut self, i: TypePath) -> TypePath { |
837 | fold_type_path(self, i) | |
838 | } | |
839 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 840 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
841 | fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr { |
842 | fold_type_ptr(self, i) | |
843 | } | |
844 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 845 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
846 | fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference { |
847 | fold_type_reference(self, i) | |
848 | } | |
849 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 850 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
851 | fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice { |
852 | fold_type_slice(self, i) | |
853 | } | |
854 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 855 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
856 | fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject { |
857 | fold_type_trait_object(self, i) | |
858 | } | |
859 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 860 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
861 | fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple { |
862 | fold_type_tuple(self, i) | |
863 | } | |
864 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 865 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
866 | fn fold_un_op(&mut self, i: UnOp) -> UnOp { |
867 | fold_un_op(self, i) | |
868 | } | |
869 | #[cfg(feature = "full")] | |
c0240ec0 | 870 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
871 | fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob { |
872 | fold_use_glob(self, i) | |
873 | } | |
874 | #[cfg(feature = "full")] | |
c0240ec0 | 875 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
876 | fn fold_use_group(&mut self, i: UseGroup) -> UseGroup { |
877 | fold_use_group(self, i) | |
878 | } | |
879 | #[cfg(feature = "full")] | |
c0240ec0 | 880 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
881 | fn fold_use_name(&mut self, i: UseName) -> UseName { |
882 | fold_use_name(self, i) | |
883 | } | |
884 | #[cfg(feature = "full")] | |
c0240ec0 | 885 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
886 | fn fold_use_path(&mut self, i: UsePath) -> UsePath { |
887 | fold_use_path(self, i) | |
888 | } | |
889 | #[cfg(feature = "full")] | |
c0240ec0 | 890 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
891 | fn fold_use_rename(&mut self, i: UseRename) -> UseRename { |
892 | fold_use_rename(self, i) | |
893 | } | |
894 | #[cfg(feature = "full")] | |
c0240ec0 | 895 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
896 | fn fold_use_tree(&mut self, i: UseTree) -> UseTree { |
897 | fold_use_tree(self, i) | |
898 | } | |
353b0b11 | 899 | #[cfg(feature = "full")] |
c0240ec0 | 900 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
901 | fn fold_variadic(&mut self, i: Variadic) -> Variadic { |
902 | fold_variadic(self, i) | |
903 | } | |
904 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 905 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
906 | fn fold_variant(&mut self, i: Variant) -> Variant { |
907 | fold_variant(self, i) | |
908 | } | |
909 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 910 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
911 | fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted { |
912 | fold_vis_restricted(self, i) | |
913 | } | |
914 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 915 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
916 | fn fold_visibility(&mut self, i: Visibility) -> Visibility { |
917 | fold_visibility(self, i) | |
918 | } | |
919 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 920 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
921 | fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause { |
922 | fold_where_clause(self, i) | |
923 | } | |
924 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 925 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
926 | fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate { |
927 | fold_where_predicate(self, i) | |
928 | } | |
929 | } | |
930 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 931 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
932 | pub fn fold_abi<F>(f: &mut F, node: Abi) -> Abi |
933 | where | |
934 | F: Fold + ?Sized, | |
935 | { | |
936 | Abi { | |
353b0b11 | 937 | extern_token: node.extern_token, |
e74abb32 XL |
938 | name: (node.name).map(|it| f.fold_lit_str(it)), |
939 | } | |
940 | } | |
941 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 942 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
943 | pub fn fold_angle_bracketed_generic_arguments<F>( |
944 | f: &mut F, | |
945 | node: AngleBracketedGenericArguments, | |
946 | ) -> AngleBracketedGenericArguments | |
947 | where | |
948 | F: Fold + ?Sized, | |
949 | { | |
950 | AngleBracketedGenericArguments { | |
353b0b11 FG |
951 | colon2_token: node.colon2_token, |
952 | lt_token: node.lt_token, | |
e74abb32 | 953 | args: FoldHelper::lift(node.args, |it| f.fold_generic_argument(it)), |
353b0b11 | 954 | gt_token: node.gt_token, |
e74abb32 XL |
955 | } |
956 | } | |
957 | #[cfg(feature = "full")] | |
c0240ec0 | 958 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
959 | pub fn fold_arm<F>(f: &mut F, node: Arm) -> Arm |
960 | where | |
961 | F: Fold + ?Sized, | |
962 | { | |
963 | Arm { | |
964 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
965 | pat: f.fold_pat(node.pat), | |
353b0b11 FG |
966 | guard: (node.guard).map(|it| ((it).0, Box::new(f.fold_expr(*(it).1)))), |
967 | fat_arrow_token: node.fat_arrow_token, | |
e74abb32 | 968 | body: Box::new(f.fold_expr(*node.body)), |
353b0b11 FG |
969 | comma: node.comma, |
970 | } | |
971 | } | |
972 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 973 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 FG |
974 | pub fn fold_assoc_const<F>(f: &mut F, node: AssocConst) -> AssocConst |
975 | where | |
976 | F: Fold + ?Sized, | |
977 | { | |
978 | AssocConst { | |
979 | ident: f.fold_ident(node.ident), | |
980 | generics: (node.generics).map(|it| f.fold_angle_bracketed_generic_arguments(it)), | |
981 | eq_token: node.eq_token, | |
982 | value: f.fold_expr(node.value), | |
983 | } | |
984 | } | |
985 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 986 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 FG |
987 | pub fn fold_assoc_type<F>(f: &mut F, node: AssocType) -> AssocType |
988 | where | |
989 | F: Fold + ?Sized, | |
990 | { | |
991 | AssocType { | |
992 | ident: f.fold_ident(node.ident), | |
993 | generics: (node.generics).map(|it| f.fold_angle_bracketed_generic_arguments(it)), | |
994 | eq_token: node.eq_token, | |
995 | ty: f.fold_type(node.ty), | |
e74abb32 XL |
996 | } |
997 | } | |
998 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 999 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1000 | pub fn fold_attr_style<F>(f: &mut F, node: AttrStyle) -> AttrStyle |
1001 | where | |
1002 | F: Fold + ?Sized, | |
1003 | { | |
1004 | match node { | |
1005 | AttrStyle::Outer => AttrStyle::Outer, | |
353b0b11 | 1006 | AttrStyle::Inner(_binding_0) => AttrStyle::Inner(_binding_0), |
e74abb32 XL |
1007 | } |
1008 | } | |
1009 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1010 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1011 | pub fn fold_attribute<F>(f: &mut F, node: Attribute) -> Attribute |
1012 | where | |
1013 | F: Fold + ?Sized, | |
1014 | { | |
1015 | Attribute { | |
353b0b11 | 1016 | pound_token: node.pound_token, |
e74abb32 | 1017 | style: f.fold_attr_style(node.style), |
353b0b11 FG |
1018 | bracket_token: node.bracket_token, |
1019 | meta: f.fold_meta(node.meta), | |
e74abb32 XL |
1020 | } |
1021 | } | |
1022 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1023 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1024 | pub fn fold_bare_fn_arg<F>(f: &mut F, node: BareFnArg) -> BareFnArg |
1025 | where | |
1026 | F: Fold + ?Sized, | |
1027 | { | |
1028 | BareFnArg { | |
1029 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1030 | name: (node.name).map(|it| (f.fold_ident((it).0), (it).1)), |
e74abb32 XL |
1031 | ty: f.fold_type(node.ty), |
1032 | } | |
1033 | } | |
1034 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1035 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 | 1036 | pub fn fold_bare_variadic<F>(f: &mut F, node: BareVariadic) -> BareVariadic |
e74abb32 XL |
1037 | where |
1038 | F: Fold + ?Sized, | |
1039 | { | |
353b0b11 FG |
1040 | BareVariadic { |
1041 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1042 | name: (node.name).map(|it| (f.fold_ident((it).0), (it).1)), | |
1043 | dots: node.dots, | |
1044 | comma: node.comma, | |
e74abb32 XL |
1045 | } |
1046 | } | |
1047 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1048 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 | 1049 | pub fn fold_bin_op<F>(f: &mut F, node: BinOp) -> BinOp |
e74abb32 XL |
1050 | where |
1051 | F: Fold + ?Sized, | |
1052 | { | |
353b0b11 FG |
1053 | match node { |
1054 | BinOp::Add(_binding_0) => BinOp::Add(_binding_0), | |
1055 | BinOp::Sub(_binding_0) => BinOp::Sub(_binding_0), | |
1056 | BinOp::Mul(_binding_0) => BinOp::Mul(_binding_0), | |
1057 | BinOp::Div(_binding_0) => BinOp::Div(_binding_0), | |
1058 | BinOp::Rem(_binding_0) => BinOp::Rem(_binding_0), | |
1059 | BinOp::And(_binding_0) => BinOp::And(_binding_0), | |
1060 | BinOp::Or(_binding_0) => BinOp::Or(_binding_0), | |
1061 | BinOp::BitXor(_binding_0) => BinOp::BitXor(_binding_0), | |
1062 | BinOp::BitAnd(_binding_0) => BinOp::BitAnd(_binding_0), | |
1063 | BinOp::BitOr(_binding_0) => BinOp::BitOr(_binding_0), | |
1064 | BinOp::Shl(_binding_0) => BinOp::Shl(_binding_0), | |
1065 | BinOp::Shr(_binding_0) => BinOp::Shr(_binding_0), | |
1066 | BinOp::Eq(_binding_0) => BinOp::Eq(_binding_0), | |
1067 | BinOp::Lt(_binding_0) => BinOp::Lt(_binding_0), | |
1068 | BinOp::Le(_binding_0) => BinOp::Le(_binding_0), | |
1069 | BinOp::Ne(_binding_0) => BinOp::Ne(_binding_0), | |
1070 | BinOp::Ge(_binding_0) => BinOp::Ge(_binding_0), | |
1071 | BinOp::Gt(_binding_0) => BinOp::Gt(_binding_0), | |
1072 | BinOp::AddAssign(_binding_0) => BinOp::AddAssign(_binding_0), | |
1073 | BinOp::SubAssign(_binding_0) => BinOp::SubAssign(_binding_0), | |
1074 | BinOp::MulAssign(_binding_0) => BinOp::MulAssign(_binding_0), | |
1075 | BinOp::DivAssign(_binding_0) => BinOp::DivAssign(_binding_0), | |
1076 | BinOp::RemAssign(_binding_0) => BinOp::RemAssign(_binding_0), | |
1077 | BinOp::BitXorAssign(_binding_0) => BinOp::BitXorAssign(_binding_0), | |
1078 | BinOp::BitAndAssign(_binding_0) => BinOp::BitAndAssign(_binding_0), | |
1079 | BinOp::BitOrAssign(_binding_0) => BinOp::BitOrAssign(_binding_0), | |
1080 | BinOp::ShlAssign(_binding_0) => BinOp::ShlAssign(_binding_0), | |
1081 | BinOp::ShrAssign(_binding_0) => BinOp::ShrAssign(_binding_0), | |
e74abb32 XL |
1082 | } |
1083 | } | |
1084 | #[cfg(feature = "full")] | |
c0240ec0 | 1085 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1086 | pub fn fold_block<F>(f: &mut F, node: Block) -> Block |
1087 | where | |
1088 | F: Fold + ?Sized, | |
1089 | { | |
1090 | Block { | |
353b0b11 | 1091 | brace_token: node.brace_token, |
e74abb32 XL |
1092 | stmts: FoldHelper::lift(node.stmts, |it| f.fold_stmt(it)), |
1093 | } | |
1094 | } | |
1095 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1096 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1097 | pub fn fold_bound_lifetimes<F>(f: &mut F, node: BoundLifetimes) -> BoundLifetimes |
1098 | where | |
1099 | F: Fold + ?Sized, | |
1100 | { | |
1101 | BoundLifetimes { | |
353b0b11 FG |
1102 | for_token: node.for_token, |
1103 | lt_token: node.lt_token, | |
1104 | lifetimes: FoldHelper::lift(node.lifetimes, |it| f.fold_generic_param(it)), | |
1105 | gt_token: node.gt_token, | |
e74abb32 XL |
1106 | } |
1107 | } | |
1108 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1109 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1110 | pub fn fold_const_param<F>(f: &mut F, node: ConstParam) -> ConstParam |
1111 | where | |
1112 | F: Fold + ?Sized, | |
1113 | { | |
1114 | ConstParam { | |
1115 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1116 | const_token: node.const_token, |
e74abb32 | 1117 | ident: f.fold_ident(node.ident), |
353b0b11 | 1118 | colon_token: node.colon_token, |
e74abb32 | 1119 | ty: f.fold_type(node.ty), |
353b0b11 | 1120 | eq_token: node.eq_token, |
e74abb32 XL |
1121 | default: (node.default).map(|it| f.fold_expr(it)), |
1122 | } | |
1123 | } | |
1124 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1125 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1126 | pub fn fold_constraint<F>(f: &mut F, node: Constraint) -> Constraint |
1127 | where | |
1128 | F: Fold + ?Sized, | |
1129 | { | |
1130 | Constraint { | |
1131 | ident: f.fold_ident(node.ident), | |
353b0b11 FG |
1132 | generics: (node.generics).map(|it| f.fold_angle_bracketed_generic_arguments(it)), |
1133 | colon_token: node.colon_token, | |
e74abb32 XL |
1134 | bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), |
1135 | } | |
1136 | } | |
1137 | #[cfg(feature = "derive")] | |
c0240ec0 | 1138 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
1139 | pub fn fold_data<F>(f: &mut F, node: Data) -> Data |
1140 | where | |
1141 | F: Fold + ?Sized, | |
1142 | { | |
1143 | match node { | |
1144 | Data::Struct(_binding_0) => Data::Struct(f.fold_data_struct(_binding_0)), | |
1145 | Data::Enum(_binding_0) => Data::Enum(f.fold_data_enum(_binding_0)), | |
1146 | Data::Union(_binding_0) => Data::Union(f.fold_data_union(_binding_0)), | |
1147 | } | |
1148 | } | |
1149 | #[cfg(feature = "derive")] | |
c0240ec0 | 1150 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
1151 | pub fn fold_data_enum<F>(f: &mut F, node: DataEnum) -> DataEnum |
1152 | where | |
1153 | F: Fold + ?Sized, | |
1154 | { | |
1155 | DataEnum { | |
353b0b11 FG |
1156 | enum_token: node.enum_token, |
1157 | brace_token: node.brace_token, | |
e74abb32 XL |
1158 | variants: FoldHelper::lift(node.variants, |it| f.fold_variant(it)), |
1159 | } | |
1160 | } | |
1161 | #[cfg(feature = "derive")] | |
c0240ec0 | 1162 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
1163 | pub fn fold_data_struct<F>(f: &mut F, node: DataStruct) -> DataStruct |
1164 | where | |
1165 | F: Fold + ?Sized, | |
1166 | { | |
1167 | DataStruct { | |
353b0b11 | 1168 | struct_token: node.struct_token, |
e74abb32 | 1169 | fields: f.fold_fields(node.fields), |
353b0b11 | 1170 | semi_token: node.semi_token, |
e74abb32 XL |
1171 | } |
1172 | } | |
1173 | #[cfg(feature = "derive")] | |
c0240ec0 | 1174 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
1175 | pub fn fold_data_union<F>(f: &mut F, node: DataUnion) -> DataUnion |
1176 | where | |
1177 | F: Fold + ?Sized, | |
1178 | { | |
1179 | DataUnion { | |
353b0b11 | 1180 | union_token: node.union_token, |
e74abb32 XL |
1181 | fields: f.fold_fields_named(node.fields), |
1182 | } | |
1183 | } | |
1184 | #[cfg(feature = "derive")] | |
c0240ec0 | 1185 | #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] |
e74abb32 XL |
1186 | pub fn fold_derive_input<F>(f: &mut F, node: DeriveInput) -> DeriveInput |
1187 | where | |
1188 | F: Fold + ?Sized, | |
1189 | { | |
1190 | DeriveInput { | |
1191 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1192 | vis: f.fold_visibility(node.vis), | |
1193 | ident: f.fold_ident(node.ident), | |
1194 | generics: f.fold_generics(node.generics), | |
1195 | data: f.fold_data(node.data), | |
1196 | } | |
1197 | } | |
1198 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1199 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1200 | pub fn fold_expr<F>(f: &mut F, node: Expr) -> Expr |
1201 | where | |
1202 | F: Fold + ?Sized, | |
1203 | { | |
1204 | match node { | |
1205 | Expr::Array(_binding_0) => Expr::Array(full!(f.fold_expr_array(_binding_0))), | |
1206 | Expr::Assign(_binding_0) => Expr::Assign(full!(f.fold_expr_assign(_binding_0))), | |
e74abb32 XL |
1207 | Expr::Async(_binding_0) => Expr::Async(full!(f.fold_expr_async(_binding_0))), |
1208 | Expr::Await(_binding_0) => Expr::Await(full!(f.fold_expr_await(_binding_0))), | |
1209 | Expr::Binary(_binding_0) => Expr::Binary(f.fold_expr_binary(_binding_0)), | |
1210 | Expr::Block(_binding_0) => Expr::Block(full!(f.fold_expr_block(_binding_0))), | |
e74abb32 XL |
1211 | Expr::Break(_binding_0) => Expr::Break(full!(f.fold_expr_break(_binding_0))), |
1212 | Expr::Call(_binding_0) => Expr::Call(f.fold_expr_call(_binding_0)), | |
1213 | Expr::Cast(_binding_0) => Expr::Cast(f.fold_expr_cast(_binding_0)), | |
5099ac24 FG |
1214 | Expr::Closure(_binding_0) => { |
1215 | Expr::Closure(full!(f.fold_expr_closure(_binding_0))) | |
1216 | } | |
353b0b11 | 1217 | Expr::Const(_binding_0) => Expr::Const(full!(f.fold_expr_const(_binding_0))), |
5099ac24 FG |
1218 | Expr::Continue(_binding_0) => { |
1219 | Expr::Continue(full!(f.fold_expr_continue(_binding_0))) | |
1220 | } | |
e74abb32 | 1221 | Expr::Field(_binding_0) => Expr::Field(f.fold_expr_field(_binding_0)), |
5099ac24 FG |
1222 | Expr::ForLoop(_binding_0) => { |
1223 | Expr::ForLoop(full!(f.fold_expr_for_loop(_binding_0))) | |
1224 | } | |
353b0b11 | 1225 | Expr::Group(_binding_0) => Expr::Group(f.fold_expr_group(_binding_0)), |
e74abb32 XL |
1226 | Expr::If(_binding_0) => Expr::If(full!(f.fold_expr_if(_binding_0))), |
1227 | Expr::Index(_binding_0) => Expr::Index(f.fold_expr_index(_binding_0)), | |
353b0b11 | 1228 | Expr::Infer(_binding_0) => Expr::Infer(full!(f.fold_expr_infer(_binding_0))), |
e74abb32 XL |
1229 | Expr::Let(_binding_0) => Expr::Let(full!(f.fold_expr_let(_binding_0))), |
1230 | Expr::Lit(_binding_0) => Expr::Lit(f.fold_expr_lit(_binding_0)), | |
1231 | Expr::Loop(_binding_0) => Expr::Loop(full!(f.fold_expr_loop(_binding_0))), | |
353b0b11 | 1232 | Expr::Macro(_binding_0) => Expr::Macro(f.fold_expr_macro(_binding_0)), |
e74abb32 XL |
1233 | Expr::Match(_binding_0) => Expr::Match(full!(f.fold_expr_match(_binding_0))), |
1234 | Expr::MethodCall(_binding_0) => { | |
c0240ec0 | 1235 | Expr::MethodCall(f.fold_expr_method_call(_binding_0)) |
e74abb32 XL |
1236 | } |
1237 | Expr::Paren(_binding_0) => Expr::Paren(f.fold_expr_paren(_binding_0)), | |
1238 | Expr::Path(_binding_0) => Expr::Path(f.fold_expr_path(_binding_0)), | |
1239 | Expr::Range(_binding_0) => Expr::Range(full!(f.fold_expr_range(_binding_0))), | |
c0240ec0 | 1240 | Expr::Reference(_binding_0) => Expr::Reference(f.fold_expr_reference(_binding_0)), |
e74abb32 XL |
1241 | Expr::Repeat(_binding_0) => Expr::Repeat(full!(f.fold_expr_repeat(_binding_0))), |
1242 | Expr::Return(_binding_0) => Expr::Return(full!(f.fold_expr_return(_binding_0))), | |
c0240ec0 | 1243 | Expr::Struct(_binding_0) => Expr::Struct(f.fold_expr_struct(_binding_0)), |
e74abb32 | 1244 | Expr::Try(_binding_0) => Expr::Try(full!(f.fold_expr_try(_binding_0))), |
5099ac24 FG |
1245 | Expr::TryBlock(_binding_0) => { |
1246 | Expr::TryBlock(full!(f.fold_expr_try_block(_binding_0))) | |
1247 | } | |
e74abb32 | 1248 | Expr::Tuple(_binding_0) => Expr::Tuple(full!(f.fold_expr_tuple(_binding_0))), |
e74abb32 XL |
1249 | Expr::Unary(_binding_0) => Expr::Unary(f.fold_expr_unary(_binding_0)), |
1250 | Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(f.fold_expr_unsafe(_binding_0))), | |
1251 | Expr::Verbatim(_binding_0) => Expr::Verbatim(_binding_0), | |
1252 | Expr::While(_binding_0) => Expr::While(full!(f.fold_expr_while(_binding_0))), | |
1253 | Expr::Yield(_binding_0) => Expr::Yield(full!(f.fold_expr_yield(_binding_0))), | |
e74abb32 XL |
1254 | } |
1255 | } | |
1256 | #[cfg(feature = "full")] | |
c0240ec0 | 1257 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1258 | pub fn fold_expr_array<F>(f: &mut F, node: ExprArray) -> ExprArray |
1259 | where | |
1260 | F: Fold + ?Sized, | |
1261 | { | |
1262 | ExprArray { | |
1263 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1264 | bracket_token: node.bracket_token, |
e74abb32 XL |
1265 | elems: FoldHelper::lift(node.elems, |it| f.fold_expr(it)), |
1266 | } | |
1267 | } | |
1268 | #[cfg(feature = "full")] | |
c0240ec0 | 1269 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1270 | pub fn fold_expr_assign<F>(f: &mut F, node: ExprAssign) -> ExprAssign |
1271 | where | |
1272 | F: Fold + ?Sized, | |
1273 | { | |
1274 | ExprAssign { | |
1275 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1276 | left: Box::new(f.fold_expr(*node.left)), | |
353b0b11 | 1277 | eq_token: node.eq_token, |
e74abb32 XL |
1278 | right: Box::new(f.fold_expr(*node.right)), |
1279 | } | |
1280 | } | |
1281 | #[cfg(feature = "full")] | |
c0240ec0 | 1282 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1283 | pub fn fold_expr_async<F>(f: &mut F, node: ExprAsync) -> ExprAsync |
1284 | where | |
1285 | F: Fold + ?Sized, | |
1286 | { | |
1287 | ExprAsync { | |
1288 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 FG |
1289 | async_token: node.async_token, |
1290 | capture: node.capture, | |
e74abb32 XL |
1291 | block: f.fold_block(node.block), |
1292 | } | |
1293 | } | |
1294 | #[cfg(feature = "full")] | |
c0240ec0 | 1295 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1296 | pub fn fold_expr_await<F>(f: &mut F, node: ExprAwait) -> ExprAwait |
1297 | where | |
1298 | F: Fold + ?Sized, | |
1299 | { | |
1300 | ExprAwait { | |
1301 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1302 | base: Box::new(f.fold_expr(*node.base)), | |
353b0b11 FG |
1303 | dot_token: node.dot_token, |
1304 | await_token: node.await_token, | |
e74abb32 XL |
1305 | } |
1306 | } | |
1307 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1308 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1309 | pub fn fold_expr_binary<F>(f: &mut F, node: ExprBinary) -> ExprBinary |
1310 | where | |
1311 | F: Fold + ?Sized, | |
1312 | { | |
1313 | ExprBinary { | |
1314 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1315 | left: Box::new(f.fold_expr(*node.left)), | |
1316 | op: f.fold_bin_op(node.op), | |
1317 | right: Box::new(f.fold_expr(*node.right)), | |
1318 | } | |
1319 | } | |
1320 | #[cfg(feature = "full")] | |
c0240ec0 | 1321 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1322 | pub fn fold_expr_block<F>(f: &mut F, node: ExprBlock) -> ExprBlock |
1323 | where | |
1324 | F: Fold + ?Sized, | |
1325 | { | |
1326 | ExprBlock { | |
1327 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1328 | label: (node.label).map(|it| f.fold_label(it)), | |
1329 | block: f.fold_block(node.block), | |
1330 | } | |
1331 | } | |
1332 | #[cfg(feature = "full")] | |
c0240ec0 | 1333 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1334 | pub fn fold_expr_break<F>(f: &mut F, node: ExprBreak) -> ExprBreak |
1335 | where | |
1336 | F: Fold + ?Sized, | |
1337 | { | |
1338 | ExprBreak { | |
1339 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1340 | break_token: node.break_token, |
e74abb32 XL |
1341 | label: (node.label).map(|it| f.fold_lifetime(it)), |
1342 | expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))), | |
1343 | } | |
1344 | } | |
1345 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1346 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1347 | pub fn fold_expr_call<F>(f: &mut F, node: ExprCall) -> ExprCall |
1348 | where | |
1349 | F: Fold + ?Sized, | |
1350 | { | |
1351 | ExprCall { | |
1352 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1353 | func: Box::new(f.fold_expr(*node.func)), | |
353b0b11 | 1354 | paren_token: node.paren_token, |
e74abb32 XL |
1355 | args: FoldHelper::lift(node.args, |it| f.fold_expr(it)), |
1356 | } | |
1357 | } | |
1358 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1359 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1360 | pub fn fold_expr_cast<F>(f: &mut F, node: ExprCast) -> ExprCast |
1361 | where | |
1362 | F: Fold + ?Sized, | |
1363 | { | |
1364 | ExprCast { | |
1365 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1366 | expr: Box::new(f.fold_expr(*node.expr)), | |
353b0b11 | 1367 | as_token: node.as_token, |
e74abb32 XL |
1368 | ty: Box::new(f.fold_type(*node.ty)), |
1369 | } | |
1370 | } | |
1371 | #[cfg(feature = "full")] | |
c0240ec0 | 1372 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1373 | pub fn fold_expr_closure<F>(f: &mut F, node: ExprClosure) -> ExprClosure |
1374 | where | |
1375 | F: Fold + ?Sized, | |
1376 | { | |
1377 | ExprClosure { | |
1378 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 FG |
1379 | lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)), |
1380 | constness: node.constness, | |
1381 | movability: node.movability, | |
1382 | asyncness: node.asyncness, | |
1383 | capture: node.capture, | |
1384 | or1_token: node.or1_token, | |
e74abb32 | 1385 | inputs: FoldHelper::lift(node.inputs, |it| f.fold_pat(it)), |
353b0b11 | 1386 | or2_token: node.or2_token, |
e74abb32 XL |
1387 | output: f.fold_return_type(node.output), |
1388 | body: Box::new(f.fold_expr(*node.body)), | |
1389 | } | |
1390 | } | |
1391 | #[cfg(feature = "full")] | |
c0240ec0 | 1392 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
1393 | pub fn fold_expr_const<F>(f: &mut F, node: ExprConst) -> ExprConst |
1394 | where | |
1395 | F: Fold + ?Sized, | |
1396 | { | |
1397 | ExprConst { | |
1398 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1399 | const_token: node.const_token, | |
1400 | block: f.fold_block(node.block), | |
1401 | } | |
1402 | } | |
1403 | #[cfg(feature = "full")] | |
c0240ec0 | 1404 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1405 | pub fn fold_expr_continue<F>(f: &mut F, node: ExprContinue) -> ExprContinue |
1406 | where | |
1407 | F: Fold + ?Sized, | |
1408 | { | |
1409 | ExprContinue { | |
1410 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1411 | continue_token: node.continue_token, |
e74abb32 XL |
1412 | label: (node.label).map(|it| f.fold_lifetime(it)), |
1413 | } | |
1414 | } | |
1415 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1416 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1417 | pub fn fold_expr_field<F>(f: &mut F, node: ExprField) -> ExprField |
1418 | where | |
1419 | F: Fold + ?Sized, | |
1420 | { | |
1421 | ExprField { | |
1422 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1423 | base: Box::new(f.fold_expr(*node.base)), | |
353b0b11 | 1424 | dot_token: node.dot_token, |
e74abb32 XL |
1425 | member: f.fold_member(node.member), |
1426 | } | |
1427 | } | |
1428 | #[cfg(feature = "full")] | |
c0240ec0 | 1429 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1430 | pub fn fold_expr_for_loop<F>(f: &mut F, node: ExprForLoop) -> ExprForLoop |
1431 | where | |
1432 | F: Fold + ?Sized, | |
1433 | { | |
1434 | ExprForLoop { | |
1435 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1436 | label: (node.label).map(|it| f.fold_label(it)), | |
353b0b11 FG |
1437 | for_token: node.for_token, |
1438 | pat: Box::new(f.fold_pat(*node.pat)), | |
1439 | in_token: node.in_token, | |
e74abb32 XL |
1440 | expr: Box::new(f.fold_expr(*node.expr)), |
1441 | body: f.fold_block(node.body), | |
1442 | } | |
1443 | } | |
353b0b11 | 1444 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 1445 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1446 | pub fn fold_expr_group<F>(f: &mut F, node: ExprGroup) -> ExprGroup |
1447 | where | |
1448 | F: Fold + ?Sized, | |
1449 | { | |
1450 | ExprGroup { | |
1451 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1452 | group_token: node.group_token, |
e74abb32 XL |
1453 | expr: Box::new(f.fold_expr(*node.expr)), |
1454 | } | |
1455 | } | |
1456 | #[cfg(feature = "full")] | |
c0240ec0 | 1457 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1458 | pub fn fold_expr_if<F>(f: &mut F, node: ExprIf) -> ExprIf |
1459 | where | |
1460 | F: Fold + ?Sized, | |
1461 | { | |
1462 | ExprIf { | |
1463 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1464 | if_token: node.if_token, |
e74abb32 XL |
1465 | cond: Box::new(f.fold_expr(*node.cond)), |
1466 | then_branch: f.fold_block(node.then_branch), | |
5099ac24 | 1467 | else_branch: (node.else_branch) |
353b0b11 | 1468 | .map(|it| ((it).0, Box::new(f.fold_expr(*(it).1)))), |
e74abb32 XL |
1469 | } |
1470 | } | |
1471 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1472 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1473 | pub fn fold_expr_index<F>(f: &mut F, node: ExprIndex) -> ExprIndex |
1474 | where | |
1475 | F: Fold + ?Sized, | |
1476 | { | |
1477 | ExprIndex { | |
1478 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1479 | expr: Box::new(f.fold_expr(*node.expr)), | |
353b0b11 | 1480 | bracket_token: node.bracket_token, |
e74abb32 XL |
1481 | index: Box::new(f.fold_expr(*node.index)), |
1482 | } | |
1483 | } | |
1484 | #[cfg(feature = "full")] | |
c0240ec0 | 1485 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
1486 | pub fn fold_expr_infer<F>(f: &mut F, node: ExprInfer) -> ExprInfer |
1487 | where | |
1488 | F: Fold + ?Sized, | |
1489 | { | |
1490 | ExprInfer { | |
1491 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1492 | underscore_token: node.underscore_token, | |
1493 | } | |
1494 | } | |
1495 | #[cfg(feature = "full")] | |
c0240ec0 | 1496 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1497 | pub fn fold_expr_let<F>(f: &mut F, node: ExprLet) -> ExprLet |
1498 | where | |
1499 | F: Fold + ?Sized, | |
1500 | { | |
1501 | ExprLet { | |
1502 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 FG |
1503 | let_token: node.let_token, |
1504 | pat: Box::new(f.fold_pat(*node.pat)), | |
1505 | eq_token: node.eq_token, | |
e74abb32 XL |
1506 | expr: Box::new(f.fold_expr(*node.expr)), |
1507 | } | |
1508 | } | |
1509 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1510 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1511 | pub fn fold_expr_lit<F>(f: &mut F, node: ExprLit) -> ExprLit |
1512 | where | |
1513 | F: Fold + ?Sized, | |
1514 | { | |
1515 | ExprLit { | |
1516 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1517 | lit: f.fold_lit(node.lit), | |
1518 | } | |
1519 | } | |
1520 | #[cfg(feature = "full")] | |
c0240ec0 | 1521 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1522 | pub fn fold_expr_loop<F>(f: &mut F, node: ExprLoop) -> ExprLoop |
1523 | where | |
1524 | F: Fold + ?Sized, | |
1525 | { | |
1526 | ExprLoop { | |
1527 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1528 | label: (node.label).map(|it| f.fold_label(it)), | |
353b0b11 | 1529 | loop_token: node.loop_token, |
e74abb32 XL |
1530 | body: f.fold_block(node.body), |
1531 | } | |
1532 | } | |
353b0b11 | 1533 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 1534 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1535 | pub fn fold_expr_macro<F>(f: &mut F, node: ExprMacro) -> ExprMacro |
1536 | where | |
1537 | F: Fold + ?Sized, | |
1538 | { | |
1539 | ExprMacro { | |
1540 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1541 | mac: f.fold_macro(node.mac), | |
1542 | } | |
1543 | } | |
1544 | #[cfg(feature = "full")] | |
c0240ec0 | 1545 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1546 | pub fn fold_expr_match<F>(f: &mut F, node: ExprMatch) -> ExprMatch |
1547 | where | |
1548 | F: Fold + ?Sized, | |
1549 | { | |
1550 | ExprMatch { | |
1551 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1552 | match_token: node.match_token, |
e74abb32 | 1553 | expr: Box::new(f.fold_expr(*node.expr)), |
353b0b11 | 1554 | brace_token: node.brace_token, |
e74abb32 XL |
1555 | arms: FoldHelper::lift(node.arms, |it| f.fold_arm(it)), |
1556 | } | |
1557 | } | |
c0240ec0 FG |
1558 | #[cfg(any(feature = "derive", feature = "full"))] |
1559 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] | |
e74abb32 XL |
1560 | pub fn fold_expr_method_call<F>(f: &mut F, node: ExprMethodCall) -> ExprMethodCall |
1561 | where | |
1562 | F: Fold + ?Sized, | |
1563 | { | |
1564 | ExprMethodCall { | |
1565 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1566 | receiver: Box::new(f.fold_expr(*node.receiver)), | |
353b0b11 | 1567 | dot_token: node.dot_token, |
e74abb32 | 1568 | method: f.fold_ident(node.method), |
353b0b11 FG |
1569 | turbofish: (node.turbofish) |
1570 | .map(|it| f.fold_angle_bracketed_generic_arguments(it)), | |
1571 | paren_token: node.paren_token, | |
e74abb32 XL |
1572 | args: FoldHelper::lift(node.args, |it| f.fold_expr(it)), |
1573 | } | |
1574 | } | |
1575 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1576 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1577 | pub fn fold_expr_paren<F>(f: &mut F, node: ExprParen) -> ExprParen |
1578 | where | |
1579 | F: Fold + ?Sized, | |
1580 | { | |
1581 | ExprParen { | |
1582 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1583 | paren_token: node.paren_token, |
e74abb32 XL |
1584 | expr: Box::new(f.fold_expr(*node.expr)), |
1585 | } | |
1586 | } | |
1587 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1588 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1589 | pub fn fold_expr_path<F>(f: &mut F, node: ExprPath) -> ExprPath |
1590 | where | |
1591 | F: Fold + ?Sized, | |
1592 | { | |
1593 | ExprPath { | |
1594 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1595 | qself: (node.qself).map(|it| f.fold_qself(it)), | |
1596 | path: f.fold_path(node.path), | |
1597 | } | |
1598 | } | |
1599 | #[cfg(feature = "full")] | |
c0240ec0 | 1600 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1601 | pub fn fold_expr_range<F>(f: &mut F, node: ExprRange) -> ExprRange |
1602 | where | |
1603 | F: Fold + ?Sized, | |
1604 | { | |
1605 | ExprRange { | |
1606 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1607 | start: (node.start).map(|it| Box::new(f.fold_expr(*it))), |
e74abb32 | 1608 | limits: f.fold_range_limits(node.limits), |
353b0b11 | 1609 | end: (node.end).map(|it| Box::new(f.fold_expr(*it))), |
e74abb32 XL |
1610 | } |
1611 | } | |
c0240ec0 FG |
1612 | #[cfg(any(feature = "derive", feature = "full"))] |
1613 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] | |
e74abb32 XL |
1614 | pub fn fold_expr_reference<F>(f: &mut F, node: ExprReference) -> ExprReference |
1615 | where | |
1616 | F: Fold + ?Sized, | |
1617 | { | |
1618 | ExprReference { | |
1619 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 FG |
1620 | and_token: node.and_token, |
1621 | mutability: node.mutability, | |
e74abb32 XL |
1622 | expr: Box::new(f.fold_expr(*node.expr)), |
1623 | } | |
1624 | } | |
1625 | #[cfg(feature = "full")] | |
c0240ec0 | 1626 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1627 | pub fn fold_expr_repeat<F>(f: &mut F, node: ExprRepeat) -> ExprRepeat |
1628 | where | |
1629 | F: Fold + ?Sized, | |
1630 | { | |
1631 | ExprRepeat { | |
1632 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1633 | bracket_token: node.bracket_token, |
e74abb32 | 1634 | expr: Box::new(f.fold_expr(*node.expr)), |
353b0b11 | 1635 | semi_token: node.semi_token, |
e74abb32 XL |
1636 | len: Box::new(f.fold_expr(*node.len)), |
1637 | } | |
1638 | } | |
1639 | #[cfg(feature = "full")] | |
c0240ec0 | 1640 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1641 | pub fn fold_expr_return<F>(f: &mut F, node: ExprReturn) -> ExprReturn |
1642 | where | |
1643 | F: Fold + ?Sized, | |
1644 | { | |
1645 | ExprReturn { | |
1646 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1647 | return_token: node.return_token, |
e74abb32 XL |
1648 | expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))), |
1649 | } | |
1650 | } | |
c0240ec0 FG |
1651 | #[cfg(any(feature = "derive", feature = "full"))] |
1652 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] | |
e74abb32 XL |
1653 | pub fn fold_expr_struct<F>(f: &mut F, node: ExprStruct) -> ExprStruct |
1654 | where | |
1655 | F: Fold + ?Sized, | |
1656 | { | |
1657 | ExprStruct { | |
1658 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1659 | qself: (node.qself).map(|it| f.fold_qself(it)), |
e74abb32 | 1660 | path: f.fold_path(node.path), |
353b0b11 | 1661 | brace_token: node.brace_token, |
e74abb32 | 1662 | fields: FoldHelper::lift(node.fields, |it| f.fold_field_value(it)), |
353b0b11 | 1663 | dot2_token: node.dot2_token, |
e74abb32 XL |
1664 | rest: (node.rest).map(|it| Box::new(f.fold_expr(*it))), |
1665 | } | |
1666 | } | |
1667 | #[cfg(feature = "full")] | |
c0240ec0 | 1668 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1669 | pub fn fold_expr_try<F>(f: &mut F, node: ExprTry) -> ExprTry |
1670 | where | |
1671 | F: Fold + ?Sized, | |
1672 | { | |
1673 | ExprTry { | |
1674 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1675 | expr: Box::new(f.fold_expr(*node.expr)), | |
353b0b11 | 1676 | question_token: node.question_token, |
e74abb32 XL |
1677 | } |
1678 | } | |
1679 | #[cfg(feature = "full")] | |
c0240ec0 | 1680 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1681 | pub fn fold_expr_try_block<F>(f: &mut F, node: ExprTryBlock) -> ExprTryBlock |
1682 | where | |
1683 | F: Fold + ?Sized, | |
1684 | { | |
1685 | ExprTryBlock { | |
1686 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1687 | try_token: node.try_token, |
e74abb32 XL |
1688 | block: f.fold_block(node.block), |
1689 | } | |
1690 | } | |
1691 | #[cfg(feature = "full")] | |
c0240ec0 | 1692 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1693 | pub fn fold_expr_tuple<F>(f: &mut F, node: ExprTuple) -> ExprTuple |
1694 | where | |
1695 | F: Fold + ?Sized, | |
1696 | { | |
1697 | ExprTuple { | |
1698 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1699 | paren_token: node.paren_token, |
e74abb32 XL |
1700 | elems: FoldHelper::lift(node.elems, |it| f.fold_expr(it)), |
1701 | } | |
1702 | } | |
e74abb32 | 1703 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 1704 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1705 | pub fn fold_expr_unary<F>(f: &mut F, node: ExprUnary) -> ExprUnary |
1706 | where | |
1707 | F: Fold + ?Sized, | |
1708 | { | |
1709 | ExprUnary { | |
1710 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1711 | op: f.fold_un_op(node.op), | |
1712 | expr: Box::new(f.fold_expr(*node.expr)), | |
1713 | } | |
1714 | } | |
1715 | #[cfg(feature = "full")] | |
c0240ec0 | 1716 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1717 | pub fn fold_expr_unsafe<F>(f: &mut F, node: ExprUnsafe) -> ExprUnsafe |
1718 | where | |
1719 | F: Fold + ?Sized, | |
1720 | { | |
1721 | ExprUnsafe { | |
1722 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1723 | unsafe_token: node.unsafe_token, |
e74abb32 XL |
1724 | block: f.fold_block(node.block), |
1725 | } | |
1726 | } | |
1727 | #[cfg(feature = "full")] | |
c0240ec0 | 1728 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1729 | pub fn fold_expr_while<F>(f: &mut F, node: ExprWhile) -> ExprWhile |
1730 | where | |
1731 | F: Fold + ?Sized, | |
1732 | { | |
1733 | ExprWhile { | |
1734 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1735 | label: (node.label).map(|it| f.fold_label(it)), | |
353b0b11 | 1736 | while_token: node.while_token, |
e74abb32 XL |
1737 | cond: Box::new(f.fold_expr(*node.cond)), |
1738 | body: f.fold_block(node.body), | |
1739 | } | |
1740 | } | |
1741 | #[cfg(feature = "full")] | |
c0240ec0 | 1742 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1743 | pub fn fold_expr_yield<F>(f: &mut F, node: ExprYield) -> ExprYield |
1744 | where | |
1745 | F: Fold + ?Sized, | |
1746 | { | |
1747 | ExprYield { | |
1748 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 1749 | yield_token: node.yield_token, |
e74abb32 XL |
1750 | expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))), |
1751 | } | |
1752 | } | |
1753 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1754 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1755 | pub fn fold_field<F>(f: &mut F, node: Field) -> Field |
1756 | where | |
1757 | F: Fold + ?Sized, | |
1758 | { | |
1759 | Field { | |
1760 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1761 | vis: f.fold_visibility(node.vis), | |
353b0b11 | 1762 | mutability: f.fold_field_mutability(node.mutability), |
e74abb32 | 1763 | ident: (node.ident).map(|it| f.fold_ident(it)), |
353b0b11 | 1764 | colon_token: node.colon_token, |
e74abb32 XL |
1765 | ty: f.fold_type(node.ty), |
1766 | } | |
1767 | } | |
353b0b11 | 1768 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 1769 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 FG |
1770 | pub fn fold_field_mutability<F>(f: &mut F, node: FieldMutability) -> FieldMutability |
1771 | where | |
1772 | F: Fold + ?Sized, | |
1773 | { | |
1774 | match node { | |
1775 | FieldMutability::None => FieldMutability::None, | |
1776 | } | |
1777 | } | |
e74abb32 | 1778 | #[cfg(feature = "full")] |
c0240ec0 | 1779 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1780 | pub fn fold_field_pat<F>(f: &mut F, node: FieldPat) -> FieldPat |
1781 | where | |
1782 | F: Fold + ?Sized, | |
1783 | { | |
1784 | FieldPat { | |
1785 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1786 | member: f.fold_member(node.member), | |
353b0b11 | 1787 | colon_token: node.colon_token, |
e74abb32 XL |
1788 | pat: Box::new(f.fold_pat(*node.pat)), |
1789 | } | |
1790 | } | |
c0240ec0 FG |
1791 | #[cfg(any(feature = "derive", feature = "full"))] |
1792 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] | |
e74abb32 XL |
1793 | pub fn fold_field_value<F>(f: &mut F, node: FieldValue) -> FieldValue |
1794 | where | |
1795 | F: Fold + ?Sized, | |
1796 | { | |
1797 | FieldValue { | |
1798 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1799 | member: f.fold_member(node.member), | |
353b0b11 | 1800 | colon_token: node.colon_token, |
e74abb32 XL |
1801 | expr: f.fold_expr(node.expr), |
1802 | } | |
1803 | } | |
1804 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1805 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1806 | pub fn fold_fields<F>(f: &mut F, node: Fields) -> Fields |
1807 | where | |
1808 | F: Fold + ?Sized, | |
1809 | { | |
1810 | match node { | |
1811 | Fields::Named(_binding_0) => Fields::Named(f.fold_fields_named(_binding_0)), | |
1812 | Fields::Unnamed(_binding_0) => Fields::Unnamed(f.fold_fields_unnamed(_binding_0)), | |
1813 | Fields::Unit => Fields::Unit, | |
1814 | } | |
1815 | } | |
1816 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1817 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1818 | pub fn fold_fields_named<F>(f: &mut F, node: FieldsNamed) -> FieldsNamed |
1819 | where | |
1820 | F: Fold + ?Sized, | |
1821 | { | |
1822 | FieldsNamed { | |
353b0b11 | 1823 | brace_token: node.brace_token, |
e74abb32 XL |
1824 | named: FoldHelper::lift(node.named, |it| f.fold_field(it)), |
1825 | } | |
1826 | } | |
1827 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1828 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1829 | pub fn fold_fields_unnamed<F>(f: &mut F, node: FieldsUnnamed) -> FieldsUnnamed |
1830 | where | |
1831 | F: Fold + ?Sized, | |
1832 | { | |
1833 | FieldsUnnamed { | |
353b0b11 | 1834 | paren_token: node.paren_token, |
e74abb32 XL |
1835 | unnamed: FoldHelper::lift(node.unnamed, |it| f.fold_field(it)), |
1836 | } | |
1837 | } | |
1838 | #[cfg(feature = "full")] | |
c0240ec0 | 1839 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1840 | pub fn fold_file<F>(f: &mut F, node: File) -> File |
1841 | where | |
1842 | F: Fold + ?Sized, | |
1843 | { | |
1844 | File { | |
1845 | shebang: node.shebang, | |
1846 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1847 | items: FoldHelper::lift(node.items, |it| f.fold_item(it)), | |
1848 | } | |
1849 | } | |
1850 | #[cfg(feature = "full")] | |
c0240ec0 | 1851 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1852 | pub fn fold_fn_arg<F>(f: &mut F, node: FnArg) -> FnArg |
1853 | where | |
1854 | F: Fold + ?Sized, | |
1855 | { | |
1856 | match node { | |
1857 | FnArg::Receiver(_binding_0) => FnArg::Receiver(f.fold_receiver(_binding_0)), | |
1858 | FnArg::Typed(_binding_0) => FnArg::Typed(f.fold_pat_type(_binding_0)), | |
1859 | } | |
1860 | } | |
1861 | #[cfg(feature = "full")] | |
c0240ec0 | 1862 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1863 | pub fn fold_foreign_item<F>(f: &mut F, node: ForeignItem) -> ForeignItem |
1864 | where | |
1865 | F: Fold + ?Sized, | |
1866 | { | |
1867 | match node { | |
5099ac24 FG |
1868 | ForeignItem::Fn(_binding_0) => { |
1869 | ForeignItem::Fn(f.fold_foreign_item_fn(_binding_0)) | |
1870 | } | |
e74abb32 XL |
1871 | ForeignItem::Static(_binding_0) => { |
1872 | ForeignItem::Static(f.fold_foreign_item_static(_binding_0)) | |
1873 | } | |
5099ac24 FG |
1874 | ForeignItem::Type(_binding_0) => { |
1875 | ForeignItem::Type(f.fold_foreign_item_type(_binding_0)) | |
1876 | } | |
1877 | ForeignItem::Macro(_binding_0) => { | |
1878 | ForeignItem::Macro(f.fold_foreign_item_macro(_binding_0)) | |
1879 | } | |
e74abb32 | 1880 | ForeignItem::Verbatim(_binding_0) => ForeignItem::Verbatim(_binding_0), |
e74abb32 XL |
1881 | } |
1882 | } | |
1883 | #[cfg(feature = "full")] | |
c0240ec0 | 1884 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1885 | pub fn fold_foreign_item_fn<F>(f: &mut F, node: ForeignItemFn) -> ForeignItemFn |
1886 | where | |
1887 | F: Fold + ?Sized, | |
1888 | { | |
1889 | ForeignItemFn { | |
1890 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1891 | vis: f.fold_visibility(node.vis), | |
1892 | sig: f.fold_signature(node.sig), | |
353b0b11 | 1893 | semi_token: node.semi_token, |
e74abb32 XL |
1894 | } |
1895 | } | |
1896 | #[cfg(feature = "full")] | |
c0240ec0 | 1897 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1898 | pub fn fold_foreign_item_macro<F>(f: &mut F, node: ForeignItemMacro) -> ForeignItemMacro |
1899 | where | |
1900 | F: Fold + ?Sized, | |
1901 | { | |
1902 | ForeignItemMacro { | |
1903 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1904 | mac: f.fold_macro(node.mac), | |
353b0b11 | 1905 | semi_token: node.semi_token, |
e74abb32 XL |
1906 | } |
1907 | } | |
1908 | #[cfg(feature = "full")] | |
c0240ec0 | 1909 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
5099ac24 FG |
1910 | pub fn fold_foreign_item_static<F>( |
1911 | f: &mut F, | |
1912 | node: ForeignItemStatic, | |
1913 | ) -> ForeignItemStatic | |
e74abb32 XL |
1914 | where |
1915 | F: Fold + ?Sized, | |
1916 | { | |
1917 | ForeignItemStatic { | |
1918 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1919 | vis: f.fold_visibility(node.vis), | |
353b0b11 FG |
1920 | static_token: node.static_token, |
1921 | mutability: f.fold_static_mutability(node.mutability), | |
e74abb32 | 1922 | ident: f.fold_ident(node.ident), |
353b0b11 | 1923 | colon_token: node.colon_token, |
e74abb32 | 1924 | ty: Box::new(f.fold_type(*node.ty)), |
353b0b11 | 1925 | semi_token: node.semi_token, |
e74abb32 XL |
1926 | } |
1927 | } | |
1928 | #[cfg(feature = "full")] | |
c0240ec0 | 1929 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
1930 | pub fn fold_foreign_item_type<F>(f: &mut F, node: ForeignItemType) -> ForeignItemType |
1931 | where | |
1932 | F: Fold + ?Sized, | |
1933 | { | |
1934 | ForeignItemType { | |
1935 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
1936 | vis: f.fold_visibility(node.vis), | |
353b0b11 | 1937 | type_token: node.type_token, |
e74abb32 | 1938 | ident: f.fold_ident(node.ident), |
353b0b11 FG |
1939 | generics: f.fold_generics(node.generics), |
1940 | semi_token: node.semi_token, | |
e74abb32 XL |
1941 | } |
1942 | } | |
1943 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1944 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1945 | pub fn fold_generic_argument<F>(f: &mut F, node: GenericArgument) -> GenericArgument |
1946 | where | |
1947 | F: Fold + ?Sized, | |
1948 | { | |
1949 | match node { | |
1950 | GenericArgument::Lifetime(_binding_0) => { | |
1951 | GenericArgument::Lifetime(f.fold_lifetime(_binding_0)) | |
1952 | } | |
5099ac24 FG |
1953 | GenericArgument::Type(_binding_0) => { |
1954 | GenericArgument::Type(f.fold_type(_binding_0)) | |
1955 | } | |
2b03887a FG |
1956 | GenericArgument::Const(_binding_0) => { |
1957 | GenericArgument::Const(f.fold_expr(_binding_0)) | |
1958 | } | |
353b0b11 FG |
1959 | GenericArgument::AssocType(_binding_0) => { |
1960 | GenericArgument::AssocType(f.fold_assoc_type(_binding_0)) | |
1961 | } | |
1962 | GenericArgument::AssocConst(_binding_0) => { | |
1963 | GenericArgument::AssocConst(f.fold_assoc_const(_binding_0)) | |
e74abb32 XL |
1964 | } |
1965 | GenericArgument::Constraint(_binding_0) => { | |
1966 | GenericArgument::Constraint(f.fold_constraint(_binding_0)) | |
1967 | } | |
e74abb32 XL |
1968 | } |
1969 | } | |
e74abb32 | 1970 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 1971 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1972 | pub fn fold_generic_param<F>(f: &mut F, node: GenericParam) -> GenericParam |
1973 | where | |
1974 | F: Fold + ?Sized, | |
1975 | { | |
1976 | match node { | |
353b0b11 FG |
1977 | GenericParam::Lifetime(_binding_0) => { |
1978 | GenericParam::Lifetime(f.fold_lifetime_param(_binding_0)) | |
1979 | } | |
5099ac24 FG |
1980 | GenericParam::Type(_binding_0) => { |
1981 | GenericParam::Type(f.fold_type_param(_binding_0)) | |
1982 | } | |
5099ac24 FG |
1983 | GenericParam::Const(_binding_0) => { |
1984 | GenericParam::Const(f.fold_const_param(_binding_0)) | |
1985 | } | |
e74abb32 XL |
1986 | } |
1987 | } | |
1988 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 1989 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
1990 | pub fn fold_generics<F>(f: &mut F, node: Generics) -> Generics |
1991 | where | |
1992 | F: Fold + ?Sized, | |
1993 | { | |
1994 | Generics { | |
353b0b11 | 1995 | lt_token: node.lt_token, |
e74abb32 | 1996 | params: FoldHelper::lift(node.params, |it| f.fold_generic_param(it)), |
353b0b11 | 1997 | gt_token: node.gt_token, |
e74abb32 XL |
1998 | where_clause: (node.where_clause).map(|it| f.fold_where_clause(it)), |
1999 | } | |
2000 | } | |
2001 | pub fn fold_ident<F>(f: &mut F, node: Ident) -> Ident | |
2002 | where | |
2003 | F: Fold + ?Sized, | |
2004 | { | |
2005 | let mut node = node; | |
2006 | let span = f.fold_span(node.span()); | |
2007 | node.set_span(span); | |
2008 | node | |
2009 | } | |
2010 | #[cfg(feature = "full")] | |
c0240ec0 | 2011 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2012 | pub fn fold_impl_item<F>(f: &mut F, node: ImplItem) -> ImplItem |
2013 | where | |
2014 | F: Fold + ?Sized, | |
2015 | { | |
2016 | match node { | |
5099ac24 FG |
2017 | ImplItem::Const(_binding_0) => { |
2018 | ImplItem::Const(f.fold_impl_item_const(_binding_0)) | |
2019 | } | |
353b0b11 | 2020 | ImplItem::Fn(_binding_0) => ImplItem::Fn(f.fold_impl_item_fn(_binding_0)), |
e74abb32 | 2021 | ImplItem::Type(_binding_0) => ImplItem::Type(f.fold_impl_item_type(_binding_0)), |
5099ac24 FG |
2022 | ImplItem::Macro(_binding_0) => { |
2023 | ImplItem::Macro(f.fold_impl_item_macro(_binding_0)) | |
2024 | } | |
e74abb32 | 2025 | ImplItem::Verbatim(_binding_0) => ImplItem::Verbatim(_binding_0), |
e74abb32 XL |
2026 | } |
2027 | } | |
2028 | #[cfg(feature = "full")] | |
c0240ec0 | 2029 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2030 | pub fn fold_impl_item_const<F>(f: &mut F, node: ImplItemConst) -> ImplItemConst |
2031 | where | |
2032 | F: Fold + ?Sized, | |
2033 | { | |
2034 | ImplItemConst { | |
2035 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2036 | vis: f.fold_visibility(node.vis), | |
353b0b11 FG |
2037 | defaultness: node.defaultness, |
2038 | const_token: node.const_token, | |
e74abb32 | 2039 | ident: f.fold_ident(node.ident), |
353b0b11 FG |
2040 | generics: f.fold_generics(node.generics), |
2041 | colon_token: node.colon_token, | |
e74abb32 | 2042 | ty: f.fold_type(node.ty), |
353b0b11 | 2043 | eq_token: node.eq_token, |
e74abb32 | 2044 | expr: f.fold_expr(node.expr), |
353b0b11 | 2045 | semi_token: node.semi_token, |
e74abb32 XL |
2046 | } |
2047 | } | |
2048 | #[cfg(feature = "full")] | |
c0240ec0 | 2049 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 | 2050 | pub fn fold_impl_item_fn<F>(f: &mut F, node: ImplItemFn) -> ImplItemFn |
e74abb32 XL |
2051 | where |
2052 | F: Fold + ?Sized, | |
2053 | { | |
353b0b11 | 2054 | ImplItemFn { |
e74abb32 | 2055 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), |
353b0b11 FG |
2056 | vis: f.fold_visibility(node.vis), |
2057 | defaultness: node.defaultness, | |
2058 | sig: f.fold_signature(node.sig), | |
2059 | block: f.fold_block(node.block), | |
e74abb32 XL |
2060 | } |
2061 | } | |
2062 | #[cfg(feature = "full")] | |
c0240ec0 | 2063 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 | 2064 | pub fn fold_impl_item_macro<F>(f: &mut F, node: ImplItemMacro) -> ImplItemMacro |
e74abb32 XL |
2065 | where |
2066 | F: Fold + ?Sized, | |
2067 | { | |
353b0b11 | 2068 | ImplItemMacro { |
e74abb32 | 2069 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), |
353b0b11 FG |
2070 | mac: f.fold_macro(node.mac), |
2071 | semi_token: node.semi_token, | |
e74abb32 XL |
2072 | } |
2073 | } | |
2074 | #[cfg(feature = "full")] | |
c0240ec0 | 2075 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2076 | pub fn fold_impl_item_type<F>(f: &mut F, node: ImplItemType) -> ImplItemType |
2077 | where | |
2078 | F: Fold + ?Sized, | |
2079 | { | |
2080 | ImplItemType { | |
2081 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2082 | vis: f.fold_visibility(node.vis), | |
353b0b11 FG |
2083 | defaultness: node.defaultness, |
2084 | type_token: node.type_token, | |
e74abb32 XL |
2085 | ident: f.fold_ident(node.ident), |
2086 | generics: f.fold_generics(node.generics), | |
353b0b11 | 2087 | eq_token: node.eq_token, |
e74abb32 | 2088 | ty: f.fold_type(node.ty), |
353b0b11 | 2089 | semi_token: node.semi_token, |
e74abb32 XL |
2090 | } |
2091 | } | |
353b0b11 | 2092 | #[cfg(feature = "full")] |
c0240ec0 | 2093 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
2094 | pub fn fold_impl_restriction<F>(f: &mut F, node: ImplRestriction) -> ImplRestriction |
2095 | where | |
2096 | F: Fold + ?Sized, | |
2097 | { | |
2098 | match node {} | |
2099 | } | |
e74abb32 | 2100 | #[cfg(any(feature = "derive", feature = "full"))] |
c0240ec0 | 2101 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2102 | pub fn fold_index<F>(f: &mut F, node: Index) -> Index |
2103 | where | |
2104 | F: Fold + ?Sized, | |
2105 | { | |
2106 | Index { | |
2107 | index: node.index, | |
2108 | span: f.fold_span(node.span), | |
2109 | } | |
2110 | } | |
2111 | #[cfg(feature = "full")] | |
c0240ec0 | 2112 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2113 | pub fn fold_item<F>(f: &mut F, node: Item) -> Item |
2114 | where | |
2115 | F: Fold + ?Sized, | |
2116 | { | |
2117 | match node { | |
2118 | Item::Const(_binding_0) => Item::Const(f.fold_item_const(_binding_0)), | |
2119 | Item::Enum(_binding_0) => Item::Enum(f.fold_item_enum(_binding_0)), | |
5099ac24 FG |
2120 | Item::ExternCrate(_binding_0) => { |
2121 | Item::ExternCrate(f.fold_item_extern_crate(_binding_0)) | |
2122 | } | |
e74abb32 | 2123 | Item::Fn(_binding_0) => Item::Fn(f.fold_item_fn(_binding_0)), |
5099ac24 FG |
2124 | Item::ForeignMod(_binding_0) => { |
2125 | Item::ForeignMod(f.fold_item_foreign_mod(_binding_0)) | |
2126 | } | |
e74abb32 XL |
2127 | Item::Impl(_binding_0) => Item::Impl(f.fold_item_impl(_binding_0)), |
2128 | Item::Macro(_binding_0) => Item::Macro(f.fold_item_macro(_binding_0)), | |
e74abb32 XL |
2129 | Item::Mod(_binding_0) => Item::Mod(f.fold_item_mod(_binding_0)), |
2130 | Item::Static(_binding_0) => Item::Static(f.fold_item_static(_binding_0)), | |
2131 | Item::Struct(_binding_0) => Item::Struct(f.fold_item_struct(_binding_0)), | |
2132 | Item::Trait(_binding_0) => Item::Trait(f.fold_item_trait(_binding_0)), | |
5099ac24 FG |
2133 | Item::TraitAlias(_binding_0) => { |
2134 | Item::TraitAlias(f.fold_item_trait_alias(_binding_0)) | |
2135 | } | |
e74abb32 XL |
2136 | Item::Type(_binding_0) => Item::Type(f.fold_item_type(_binding_0)), |
2137 | Item::Union(_binding_0) => Item::Union(f.fold_item_union(_binding_0)), | |
2138 | Item::Use(_binding_0) => Item::Use(f.fold_item_use(_binding_0)), | |
2139 | Item::Verbatim(_binding_0) => Item::Verbatim(_binding_0), | |
e74abb32 XL |
2140 | } |
2141 | } | |
2142 | #[cfg(feature = "full")] | |
c0240ec0 | 2143 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2144 | pub fn fold_item_const<F>(f: &mut F, node: ItemConst) -> ItemConst |
2145 | where | |
2146 | F: Fold + ?Sized, | |
2147 | { | |
2148 | ItemConst { | |
2149 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2150 | vis: f.fold_visibility(node.vis), | |
353b0b11 | 2151 | const_token: node.const_token, |
e74abb32 | 2152 | ident: f.fold_ident(node.ident), |
353b0b11 FG |
2153 | generics: f.fold_generics(node.generics), |
2154 | colon_token: node.colon_token, | |
e74abb32 | 2155 | ty: Box::new(f.fold_type(*node.ty)), |
353b0b11 | 2156 | eq_token: node.eq_token, |
e74abb32 | 2157 | expr: Box::new(f.fold_expr(*node.expr)), |
353b0b11 | 2158 | semi_token: node.semi_token, |
e74abb32 XL |
2159 | } |
2160 | } | |
2161 | #[cfg(feature = "full")] | |
c0240ec0 | 2162 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2163 | pub fn fold_item_enum<F>(f: &mut F, node: ItemEnum) -> ItemEnum |
2164 | where | |
2165 | F: Fold + ?Sized, | |
2166 | { | |
2167 | ItemEnum { | |
2168 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2169 | vis: f.fold_visibility(node.vis), | |
353b0b11 | 2170 | enum_token: node.enum_token, |
e74abb32 XL |
2171 | ident: f.fold_ident(node.ident), |
2172 | generics: f.fold_generics(node.generics), | |
353b0b11 | 2173 | brace_token: node.brace_token, |
e74abb32 XL |
2174 | variants: FoldHelper::lift(node.variants, |it| f.fold_variant(it)), |
2175 | } | |
2176 | } | |
2177 | #[cfg(feature = "full")] | |
c0240ec0 | 2178 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2179 | pub fn fold_item_extern_crate<F>(f: &mut F, node: ItemExternCrate) -> ItemExternCrate |
2180 | where | |
2181 | F: Fold + ?Sized, | |
2182 | { | |
2183 | ItemExternCrate { | |
2184 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2185 | vis: f.fold_visibility(node.vis), | |
353b0b11 FG |
2186 | extern_token: node.extern_token, |
2187 | crate_token: node.crate_token, | |
e74abb32 | 2188 | ident: f.fold_ident(node.ident), |
353b0b11 FG |
2189 | rename: (node.rename).map(|it| ((it).0, f.fold_ident((it).1))), |
2190 | semi_token: node.semi_token, | |
e74abb32 XL |
2191 | } |
2192 | } | |
2193 | #[cfg(feature = "full")] | |
c0240ec0 | 2194 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2195 | pub fn fold_item_fn<F>(f: &mut F, node: ItemFn) -> ItemFn |
2196 | where | |
2197 | F: Fold + ?Sized, | |
2198 | { | |
2199 | ItemFn { | |
2200 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2201 | vis: f.fold_visibility(node.vis), | |
2202 | sig: f.fold_signature(node.sig), | |
2203 | block: Box::new(f.fold_block(*node.block)), | |
2204 | } | |
2205 | } | |
2206 | #[cfg(feature = "full")] | |
c0240ec0 | 2207 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2208 | pub fn fold_item_foreign_mod<F>(f: &mut F, node: ItemForeignMod) -> ItemForeignMod |
2209 | where | |
2210 | F: Fold + ?Sized, | |
2211 | { | |
2212 | ItemForeignMod { | |
2213 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 2214 | unsafety: node.unsafety, |
e74abb32 | 2215 | abi: f.fold_abi(node.abi), |
353b0b11 | 2216 | brace_token: node.brace_token, |
e74abb32 XL |
2217 | items: FoldHelper::lift(node.items, |it| f.fold_foreign_item(it)), |
2218 | } | |
2219 | } | |
2220 | #[cfg(feature = "full")] | |
c0240ec0 | 2221 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2222 | pub fn fold_item_impl<F>(f: &mut F, node: ItemImpl) -> ItemImpl |
2223 | where | |
2224 | F: Fold + ?Sized, | |
2225 | { | |
2226 | ItemImpl { | |
2227 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 FG |
2228 | defaultness: node.defaultness, |
2229 | unsafety: node.unsafety, | |
2230 | impl_token: node.impl_token, | |
e74abb32 | 2231 | generics: f.fold_generics(node.generics), |
353b0b11 | 2232 | trait_: (node.trait_).map(|it| ((it).0, f.fold_path((it).1), (it).2)), |
e74abb32 | 2233 | self_ty: Box::new(f.fold_type(*node.self_ty)), |
353b0b11 | 2234 | brace_token: node.brace_token, |
e74abb32 XL |
2235 | items: FoldHelper::lift(node.items, |it| f.fold_impl_item(it)), |
2236 | } | |
2237 | } | |
2238 | #[cfg(feature = "full")] | |
c0240ec0 | 2239 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2240 | pub fn fold_item_macro<F>(f: &mut F, node: ItemMacro) -> ItemMacro |
2241 | where | |
2242 | F: Fold + ?Sized, | |
2243 | { | |
2244 | ItemMacro { | |
2245 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2246 | ident: (node.ident).map(|it| f.fold_ident(it)), | |
2247 | mac: f.fold_macro(node.mac), | |
353b0b11 | 2248 | semi_token: node.semi_token, |
e74abb32 XL |
2249 | } |
2250 | } | |
2251 | #[cfg(feature = "full")] | |
c0240ec0 | 2252 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2253 | pub fn fold_item_mod<F>(f: &mut F, node: ItemMod) -> ItemMod |
2254 | where | |
2255 | F: Fold + ?Sized, | |
2256 | { | |
2257 | ItemMod { | |
2258 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2259 | vis: f.fold_visibility(node.vis), | |
353b0b11 FG |
2260 | unsafety: node.unsafety, |
2261 | mod_token: node.mod_token, | |
e74abb32 | 2262 | ident: f.fold_ident(node.ident), |
5099ac24 | 2263 | content: (node.content) |
353b0b11 FG |
2264 | .map(|it| ((it).0, FoldHelper::lift((it).1, |it| f.fold_item(it)))), |
2265 | semi: node.semi, | |
e74abb32 XL |
2266 | } |
2267 | } | |
2268 | #[cfg(feature = "full")] | |
c0240ec0 | 2269 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2270 | pub fn fold_item_static<F>(f: &mut F, node: ItemStatic) -> ItemStatic |
2271 | where | |
2272 | F: Fold + ?Sized, | |
2273 | { | |
2274 | ItemStatic { | |
2275 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2276 | vis: f.fold_visibility(node.vis), | |
353b0b11 FG |
2277 | static_token: node.static_token, |
2278 | mutability: f.fold_static_mutability(node.mutability), | |
e74abb32 | 2279 | ident: f.fold_ident(node.ident), |
353b0b11 | 2280 | colon_token: node.colon_token, |
e74abb32 | 2281 | ty: Box::new(f.fold_type(*node.ty)), |
353b0b11 | 2282 | eq_token: node.eq_token, |
e74abb32 | 2283 | expr: Box::new(f.fold_expr(*node.expr)), |
353b0b11 | 2284 | semi_token: node.semi_token, |
e74abb32 XL |
2285 | } |
2286 | } | |
2287 | #[cfg(feature = "full")] | |
c0240ec0 | 2288 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2289 | pub fn fold_item_struct<F>(f: &mut F, node: ItemStruct) -> ItemStruct |
2290 | where | |
2291 | F: Fold + ?Sized, | |
2292 | { | |
2293 | ItemStruct { | |
2294 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2295 | vis: f.fold_visibility(node.vis), | |
353b0b11 | 2296 | struct_token: node.struct_token, |
e74abb32 XL |
2297 | ident: f.fold_ident(node.ident), |
2298 | generics: f.fold_generics(node.generics), | |
2299 | fields: f.fold_fields(node.fields), | |
353b0b11 | 2300 | semi_token: node.semi_token, |
e74abb32 XL |
2301 | } |
2302 | } | |
2303 | #[cfg(feature = "full")] | |
c0240ec0 | 2304 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2305 | pub fn fold_item_trait<F>(f: &mut F, node: ItemTrait) -> ItemTrait |
2306 | where | |
2307 | F: Fold + ?Sized, | |
2308 | { | |
2309 | ItemTrait { | |
2310 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2311 | vis: f.fold_visibility(node.vis), | |
353b0b11 FG |
2312 | unsafety: node.unsafety, |
2313 | auto_token: node.auto_token, | |
2314 | restriction: (node.restriction).map(|it| f.fold_impl_restriction(it)), | |
2315 | trait_token: node.trait_token, | |
e74abb32 XL |
2316 | ident: f.fold_ident(node.ident), |
2317 | generics: f.fold_generics(node.generics), | |
353b0b11 | 2318 | colon_token: node.colon_token, |
5099ac24 FG |
2319 | supertraits: FoldHelper::lift( |
2320 | node.supertraits, | |
2321 | |it| f.fold_type_param_bound(it), | |
2322 | ), | |
353b0b11 | 2323 | brace_token: node.brace_token, |
e74abb32 XL |
2324 | items: FoldHelper::lift(node.items, |it| f.fold_trait_item(it)), |
2325 | } | |
2326 | } | |
2327 | #[cfg(feature = "full")] | |
c0240ec0 | 2328 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2329 | pub fn fold_item_trait_alias<F>(f: &mut F, node: ItemTraitAlias) -> ItemTraitAlias |
2330 | where | |
2331 | F: Fold + ?Sized, | |
2332 | { | |
2333 | ItemTraitAlias { | |
2334 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2335 | vis: f.fold_visibility(node.vis), | |
353b0b11 | 2336 | trait_token: node.trait_token, |
e74abb32 XL |
2337 | ident: f.fold_ident(node.ident), |
2338 | generics: f.fold_generics(node.generics), | |
353b0b11 | 2339 | eq_token: node.eq_token, |
e74abb32 | 2340 | bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), |
353b0b11 | 2341 | semi_token: node.semi_token, |
e74abb32 XL |
2342 | } |
2343 | } | |
2344 | #[cfg(feature = "full")] | |
c0240ec0 | 2345 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2346 | pub fn fold_item_type<F>(f: &mut F, node: ItemType) -> ItemType |
2347 | where | |
2348 | F: Fold + ?Sized, | |
2349 | { | |
2350 | ItemType { | |
2351 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2352 | vis: f.fold_visibility(node.vis), | |
353b0b11 | 2353 | type_token: node.type_token, |
e74abb32 XL |
2354 | ident: f.fold_ident(node.ident), |
2355 | generics: f.fold_generics(node.generics), | |
353b0b11 | 2356 | eq_token: node.eq_token, |
e74abb32 | 2357 | ty: Box::new(f.fold_type(*node.ty)), |
353b0b11 | 2358 | semi_token: node.semi_token, |
e74abb32 XL |
2359 | } |
2360 | } | |
2361 | #[cfg(feature = "full")] | |
c0240ec0 | 2362 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2363 | pub fn fold_item_union<F>(f: &mut F, node: ItemUnion) -> ItemUnion |
2364 | where | |
2365 | F: Fold + ?Sized, | |
2366 | { | |
2367 | ItemUnion { | |
2368 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2369 | vis: f.fold_visibility(node.vis), | |
353b0b11 | 2370 | union_token: node.union_token, |
e74abb32 XL |
2371 | ident: f.fold_ident(node.ident), |
2372 | generics: f.fold_generics(node.generics), | |
2373 | fields: f.fold_fields_named(node.fields), | |
2374 | } | |
2375 | } | |
2376 | #[cfg(feature = "full")] | |
c0240ec0 | 2377 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2378 | pub fn fold_item_use<F>(f: &mut F, node: ItemUse) -> ItemUse |
2379 | where | |
2380 | F: Fold + ?Sized, | |
2381 | { | |
2382 | ItemUse { | |
2383 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2384 | vis: f.fold_visibility(node.vis), | |
353b0b11 FG |
2385 | use_token: node.use_token, |
2386 | leading_colon: node.leading_colon, | |
e74abb32 | 2387 | tree: f.fold_use_tree(node.tree), |
353b0b11 | 2388 | semi_token: node.semi_token, |
e74abb32 XL |
2389 | } |
2390 | } | |
2391 | #[cfg(feature = "full")] | |
c0240ec0 | 2392 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2393 | pub fn fold_label<F>(f: &mut F, node: Label) -> Label |
2394 | where | |
2395 | F: Fold + ?Sized, | |
2396 | { | |
2397 | Label { | |
2398 | name: f.fold_lifetime(node.name), | |
353b0b11 | 2399 | colon_token: node.colon_token, |
e74abb32 XL |
2400 | } |
2401 | } | |
2402 | pub fn fold_lifetime<F>(f: &mut F, node: Lifetime) -> Lifetime | |
2403 | where | |
2404 | F: Fold + ?Sized, | |
2405 | { | |
2406 | Lifetime { | |
2407 | apostrophe: f.fold_span(node.apostrophe), | |
2408 | ident: f.fold_ident(node.ident), | |
2409 | } | |
2410 | } | |
2411 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2412 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
353b0b11 | 2413 | pub fn fold_lifetime_param<F>(f: &mut F, node: LifetimeParam) -> LifetimeParam |
e74abb32 XL |
2414 | where |
2415 | F: Fold + ?Sized, | |
2416 | { | |
353b0b11 | 2417 | LifetimeParam { |
e74abb32 XL |
2418 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), |
2419 | lifetime: f.fold_lifetime(node.lifetime), | |
353b0b11 | 2420 | colon_token: node.colon_token, |
e74abb32 XL |
2421 | bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)), |
2422 | } | |
2423 | } | |
e74abb32 XL |
2424 | pub fn fold_lit<F>(f: &mut F, node: Lit) -> Lit |
2425 | where | |
2426 | F: Fold + ?Sized, | |
2427 | { | |
2428 | match node { | |
2429 | Lit::Str(_binding_0) => Lit::Str(f.fold_lit_str(_binding_0)), | |
2430 | Lit::ByteStr(_binding_0) => Lit::ByteStr(f.fold_lit_byte_str(_binding_0)), | |
2431 | Lit::Byte(_binding_0) => Lit::Byte(f.fold_lit_byte(_binding_0)), | |
2432 | Lit::Char(_binding_0) => Lit::Char(f.fold_lit_char(_binding_0)), | |
2433 | Lit::Int(_binding_0) => Lit::Int(f.fold_lit_int(_binding_0)), | |
2434 | Lit::Float(_binding_0) => Lit::Float(f.fold_lit_float(_binding_0)), | |
2435 | Lit::Bool(_binding_0) => Lit::Bool(f.fold_lit_bool(_binding_0)), | |
2436 | Lit::Verbatim(_binding_0) => Lit::Verbatim(_binding_0), | |
2437 | } | |
2438 | } | |
e74abb32 XL |
2439 | pub fn fold_lit_bool<F>(f: &mut F, node: LitBool) -> LitBool |
2440 | where | |
2441 | F: Fold + ?Sized, | |
2442 | { | |
2443 | LitBool { | |
2444 | value: node.value, | |
2445 | span: f.fold_span(node.span), | |
2446 | } | |
2447 | } | |
e74abb32 XL |
2448 | pub fn fold_lit_byte<F>(f: &mut F, node: LitByte) -> LitByte |
2449 | where | |
2450 | F: Fold + ?Sized, | |
2451 | { | |
2452 | let span = f.fold_span(node.span()); | |
2453 | let mut node = node; | |
2454 | node.set_span(span); | |
2455 | node | |
2456 | } | |
e74abb32 XL |
2457 | pub fn fold_lit_byte_str<F>(f: &mut F, node: LitByteStr) -> LitByteStr |
2458 | where | |
2459 | F: Fold + ?Sized, | |
2460 | { | |
2461 | let span = f.fold_span(node.span()); | |
2462 | let mut node = node; | |
2463 | node.set_span(span); | |
2464 | node | |
2465 | } | |
e74abb32 XL |
2466 | pub fn fold_lit_char<F>(f: &mut F, node: LitChar) -> LitChar |
2467 | where | |
2468 | F: Fold + ?Sized, | |
2469 | { | |
2470 | let span = f.fold_span(node.span()); | |
2471 | let mut node = node; | |
2472 | node.set_span(span); | |
2473 | node | |
2474 | } | |
e74abb32 XL |
2475 | pub fn fold_lit_float<F>(f: &mut F, node: LitFloat) -> LitFloat |
2476 | where | |
2477 | F: Fold + ?Sized, | |
2478 | { | |
2479 | let span = f.fold_span(node.span()); | |
2480 | let mut node = node; | |
2481 | node.set_span(span); | |
2482 | node | |
2483 | } | |
e74abb32 XL |
2484 | pub fn fold_lit_int<F>(f: &mut F, node: LitInt) -> LitInt |
2485 | where | |
2486 | F: Fold + ?Sized, | |
2487 | { | |
2488 | let span = f.fold_span(node.span()); | |
2489 | let mut node = node; | |
2490 | node.set_span(span); | |
2491 | node | |
2492 | } | |
e74abb32 XL |
2493 | pub fn fold_lit_str<F>(f: &mut F, node: LitStr) -> LitStr |
2494 | where | |
2495 | F: Fold + ?Sized, | |
2496 | { | |
2497 | let span = f.fold_span(node.span()); | |
2498 | let mut node = node; | |
2499 | node.set_span(span); | |
2500 | node | |
2501 | } | |
2502 | #[cfg(feature = "full")] | |
c0240ec0 | 2503 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2504 | pub fn fold_local<F>(f: &mut F, node: Local) -> Local |
2505 | where | |
2506 | F: Fold + ?Sized, | |
2507 | { | |
2508 | Local { | |
2509 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 2510 | let_token: node.let_token, |
e74abb32 | 2511 | pat: f.fold_pat(node.pat), |
353b0b11 FG |
2512 | init: (node.init).map(|it| f.fold_local_init(it)), |
2513 | semi_token: node.semi_token, | |
2514 | } | |
2515 | } | |
2516 | #[cfg(feature = "full")] | |
c0240ec0 | 2517 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
2518 | pub fn fold_local_init<F>(f: &mut F, node: LocalInit) -> LocalInit |
2519 | where | |
2520 | F: Fold + ?Sized, | |
2521 | { | |
2522 | LocalInit { | |
2523 | eq_token: node.eq_token, | |
2524 | expr: Box::new(f.fold_expr(*node.expr)), | |
2525 | diverge: (node.diverge).map(|it| ((it).0, Box::new(f.fold_expr(*(it).1)))), | |
e74abb32 XL |
2526 | } |
2527 | } | |
2528 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2529 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2530 | pub fn fold_macro<F>(f: &mut F, node: Macro) -> Macro |
2531 | where | |
2532 | F: Fold + ?Sized, | |
2533 | { | |
2534 | Macro { | |
2535 | path: f.fold_path(node.path), | |
353b0b11 | 2536 | bang_token: node.bang_token, |
e74abb32 XL |
2537 | delimiter: f.fold_macro_delimiter(node.delimiter), |
2538 | tokens: node.tokens, | |
2539 | } | |
2540 | } | |
2541 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2542 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2543 | pub fn fold_macro_delimiter<F>(f: &mut F, node: MacroDelimiter) -> MacroDelimiter |
2544 | where | |
2545 | F: Fold + ?Sized, | |
2546 | { | |
2547 | match node { | |
353b0b11 FG |
2548 | MacroDelimiter::Paren(_binding_0) => MacroDelimiter::Paren(_binding_0), |
2549 | MacroDelimiter::Brace(_binding_0) => MacroDelimiter::Brace(_binding_0), | |
2550 | MacroDelimiter::Bracket(_binding_0) => MacroDelimiter::Bracket(_binding_0), | |
e74abb32 XL |
2551 | } |
2552 | } | |
2553 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2554 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2555 | pub fn fold_member<F>(f: &mut F, node: Member) -> Member |
2556 | where | |
2557 | F: Fold + ?Sized, | |
2558 | { | |
2559 | match node { | |
2560 | Member::Named(_binding_0) => Member::Named(f.fold_ident(_binding_0)), | |
2561 | Member::Unnamed(_binding_0) => Member::Unnamed(f.fold_index(_binding_0)), | |
2562 | } | |
2563 | } | |
2564 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2565 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2566 | pub fn fold_meta<F>(f: &mut F, node: Meta) -> Meta |
2567 | where | |
2568 | F: Fold + ?Sized, | |
2569 | { | |
2570 | match node { | |
2571 | Meta::Path(_binding_0) => Meta::Path(f.fold_path(_binding_0)), | |
2572 | Meta::List(_binding_0) => Meta::List(f.fold_meta_list(_binding_0)), | |
5099ac24 FG |
2573 | Meta::NameValue(_binding_0) => { |
2574 | Meta::NameValue(f.fold_meta_name_value(_binding_0)) | |
2575 | } | |
e74abb32 XL |
2576 | } |
2577 | } | |
2578 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2579 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2580 | pub fn fold_meta_list<F>(f: &mut F, node: MetaList) -> MetaList |
2581 | where | |
2582 | F: Fold + ?Sized, | |
2583 | { | |
2584 | MetaList { | |
2585 | path: f.fold_path(node.path), | |
353b0b11 FG |
2586 | delimiter: f.fold_macro_delimiter(node.delimiter), |
2587 | tokens: node.tokens, | |
e74abb32 XL |
2588 | } |
2589 | } | |
2590 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2591 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2592 | pub fn fold_meta_name_value<F>(f: &mut F, node: MetaNameValue) -> MetaNameValue |
2593 | where | |
2594 | F: Fold + ?Sized, | |
2595 | { | |
2596 | MetaNameValue { | |
2597 | path: f.fold_path(node.path), | |
353b0b11 FG |
2598 | eq_token: node.eq_token, |
2599 | value: f.fold_expr(node.value), | |
e74abb32 XL |
2600 | } |
2601 | } | |
2602 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2603 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2604 | pub fn fold_parenthesized_generic_arguments<F>( |
2605 | f: &mut F, | |
2606 | node: ParenthesizedGenericArguments, | |
2607 | ) -> ParenthesizedGenericArguments | |
2608 | where | |
2609 | F: Fold + ?Sized, | |
2610 | { | |
2611 | ParenthesizedGenericArguments { | |
353b0b11 | 2612 | paren_token: node.paren_token, |
e74abb32 XL |
2613 | inputs: FoldHelper::lift(node.inputs, |it| f.fold_type(it)), |
2614 | output: f.fold_return_type(node.output), | |
2615 | } | |
2616 | } | |
2617 | #[cfg(feature = "full")] | |
c0240ec0 | 2618 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2619 | pub fn fold_pat<F>(f: &mut F, node: Pat) -> Pat |
2620 | where | |
2621 | F: Fold + ?Sized, | |
2622 | { | |
2623 | match node { | |
353b0b11 | 2624 | Pat::Const(_binding_0) => Pat::Const(f.fold_expr_const(_binding_0)), |
e74abb32 | 2625 | Pat::Ident(_binding_0) => Pat::Ident(f.fold_pat_ident(_binding_0)), |
353b0b11 FG |
2626 | Pat::Lit(_binding_0) => Pat::Lit(f.fold_expr_lit(_binding_0)), |
2627 | Pat::Macro(_binding_0) => Pat::Macro(f.fold_expr_macro(_binding_0)), | |
e74abb32 | 2628 | Pat::Or(_binding_0) => Pat::Or(f.fold_pat_or(_binding_0)), |
353b0b11 FG |
2629 | Pat::Paren(_binding_0) => Pat::Paren(f.fold_pat_paren(_binding_0)), |
2630 | Pat::Path(_binding_0) => Pat::Path(f.fold_expr_path(_binding_0)), | |
2631 | Pat::Range(_binding_0) => Pat::Range(f.fold_expr_range(_binding_0)), | |
e74abb32 XL |
2632 | Pat::Reference(_binding_0) => Pat::Reference(f.fold_pat_reference(_binding_0)), |
2633 | Pat::Rest(_binding_0) => Pat::Rest(f.fold_pat_rest(_binding_0)), | |
2634 | Pat::Slice(_binding_0) => Pat::Slice(f.fold_pat_slice(_binding_0)), | |
2635 | Pat::Struct(_binding_0) => Pat::Struct(f.fold_pat_struct(_binding_0)), | |
2636 | Pat::Tuple(_binding_0) => Pat::Tuple(f.fold_pat_tuple(_binding_0)), | |
5099ac24 FG |
2637 | Pat::TupleStruct(_binding_0) => { |
2638 | Pat::TupleStruct(f.fold_pat_tuple_struct(_binding_0)) | |
2639 | } | |
e74abb32 XL |
2640 | Pat::Type(_binding_0) => Pat::Type(f.fold_pat_type(_binding_0)), |
2641 | Pat::Verbatim(_binding_0) => Pat::Verbatim(_binding_0), | |
2642 | Pat::Wild(_binding_0) => Pat::Wild(f.fold_pat_wild(_binding_0)), | |
e74abb32 XL |
2643 | } |
2644 | } | |
2645 | #[cfg(feature = "full")] | |
c0240ec0 | 2646 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2647 | pub fn fold_pat_ident<F>(f: &mut F, node: PatIdent) -> PatIdent |
2648 | where | |
2649 | F: Fold + ?Sized, | |
2650 | { | |
2651 | PatIdent { | |
2652 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 FG |
2653 | by_ref: node.by_ref, |
2654 | mutability: node.mutability, | |
e74abb32 | 2655 | ident: f.fold_ident(node.ident), |
353b0b11 | 2656 | subpat: (node.subpat).map(|it| ((it).0, Box::new(f.fold_pat(*(it).1)))), |
e74abb32 XL |
2657 | } |
2658 | } | |
2659 | #[cfg(feature = "full")] | |
c0240ec0 | 2660 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2661 | pub fn fold_pat_or<F>(f: &mut F, node: PatOr) -> PatOr |
2662 | where | |
2663 | F: Fold + ?Sized, | |
2664 | { | |
2665 | PatOr { | |
2666 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 2667 | leading_vert: node.leading_vert, |
e74abb32 XL |
2668 | cases: FoldHelper::lift(node.cases, |it| f.fold_pat(it)), |
2669 | } | |
2670 | } | |
2671 | #[cfg(feature = "full")] | |
c0240ec0 | 2672 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 | 2673 | pub fn fold_pat_paren<F>(f: &mut F, node: PatParen) -> PatParen |
e74abb32 XL |
2674 | where |
2675 | F: Fold + ?Sized, | |
2676 | { | |
353b0b11 | 2677 | PatParen { |
e74abb32 | 2678 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), |
353b0b11 FG |
2679 | paren_token: node.paren_token, |
2680 | pat: Box::new(f.fold_pat(*node.pat)), | |
e74abb32 XL |
2681 | } |
2682 | } | |
2683 | #[cfg(feature = "full")] | |
c0240ec0 | 2684 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2685 | pub fn fold_pat_reference<F>(f: &mut F, node: PatReference) -> PatReference |
2686 | where | |
2687 | F: Fold + ?Sized, | |
2688 | { | |
2689 | PatReference { | |
2690 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 FG |
2691 | and_token: node.and_token, |
2692 | mutability: node.mutability, | |
e74abb32 XL |
2693 | pat: Box::new(f.fold_pat(*node.pat)), |
2694 | } | |
2695 | } | |
2696 | #[cfg(feature = "full")] | |
c0240ec0 | 2697 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2698 | pub fn fold_pat_rest<F>(f: &mut F, node: PatRest) -> PatRest |
2699 | where | |
2700 | F: Fold + ?Sized, | |
2701 | { | |
2702 | PatRest { | |
2703 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 2704 | dot2_token: node.dot2_token, |
e74abb32 XL |
2705 | } |
2706 | } | |
2707 | #[cfg(feature = "full")] | |
c0240ec0 | 2708 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2709 | pub fn fold_pat_slice<F>(f: &mut F, node: PatSlice) -> PatSlice |
2710 | where | |
2711 | F: Fold + ?Sized, | |
2712 | { | |
2713 | PatSlice { | |
2714 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 2715 | bracket_token: node.bracket_token, |
e74abb32 XL |
2716 | elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)), |
2717 | } | |
2718 | } | |
2719 | #[cfg(feature = "full")] | |
c0240ec0 | 2720 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2721 | pub fn fold_pat_struct<F>(f: &mut F, node: PatStruct) -> PatStruct |
2722 | where | |
2723 | F: Fold + ?Sized, | |
2724 | { | |
2725 | PatStruct { | |
2726 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 2727 | qself: (node.qself).map(|it| f.fold_qself(it)), |
e74abb32 | 2728 | path: f.fold_path(node.path), |
353b0b11 | 2729 | brace_token: node.brace_token, |
e74abb32 | 2730 | fields: FoldHelper::lift(node.fields, |it| f.fold_field_pat(it)), |
353b0b11 | 2731 | rest: (node.rest).map(|it| f.fold_pat_rest(it)), |
e74abb32 XL |
2732 | } |
2733 | } | |
2734 | #[cfg(feature = "full")] | |
c0240ec0 | 2735 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2736 | pub fn fold_pat_tuple<F>(f: &mut F, node: PatTuple) -> PatTuple |
2737 | where | |
2738 | F: Fold + ?Sized, | |
2739 | { | |
2740 | PatTuple { | |
2741 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 2742 | paren_token: node.paren_token, |
e74abb32 XL |
2743 | elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)), |
2744 | } | |
2745 | } | |
2746 | #[cfg(feature = "full")] | |
c0240ec0 | 2747 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2748 | pub fn fold_pat_tuple_struct<F>(f: &mut F, node: PatTupleStruct) -> PatTupleStruct |
2749 | where | |
2750 | F: Fold + ?Sized, | |
2751 | { | |
2752 | PatTupleStruct { | |
2753 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 2754 | qself: (node.qself).map(|it| f.fold_qself(it)), |
e74abb32 | 2755 | path: f.fold_path(node.path), |
353b0b11 FG |
2756 | paren_token: node.paren_token, |
2757 | elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)), | |
e74abb32 XL |
2758 | } |
2759 | } | |
2760 | #[cfg(feature = "full")] | |
c0240ec0 | 2761 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2762 | pub fn fold_pat_type<F>(f: &mut F, node: PatType) -> PatType |
2763 | where | |
2764 | F: Fold + ?Sized, | |
2765 | { | |
2766 | PatType { | |
2767 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2768 | pat: Box::new(f.fold_pat(*node.pat)), | |
353b0b11 | 2769 | colon_token: node.colon_token, |
e74abb32 XL |
2770 | ty: Box::new(f.fold_type(*node.ty)), |
2771 | } | |
2772 | } | |
2773 | #[cfg(feature = "full")] | |
c0240ec0 | 2774 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2775 | pub fn fold_pat_wild<F>(f: &mut F, node: PatWild) -> PatWild |
2776 | where | |
2777 | F: Fold + ?Sized, | |
2778 | { | |
2779 | PatWild { | |
2780 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 2781 | underscore_token: node.underscore_token, |
e74abb32 XL |
2782 | } |
2783 | } | |
2784 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2785 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2786 | pub fn fold_path<F>(f: &mut F, node: Path) -> Path |
2787 | where | |
2788 | F: Fold + ?Sized, | |
2789 | { | |
2790 | Path { | |
353b0b11 | 2791 | leading_colon: node.leading_colon, |
e74abb32 XL |
2792 | segments: FoldHelper::lift(node.segments, |it| f.fold_path_segment(it)), |
2793 | } | |
2794 | } | |
2795 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2796 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2797 | pub fn fold_path_arguments<F>(f: &mut F, node: PathArguments) -> PathArguments |
2798 | where | |
2799 | F: Fold + ?Sized, | |
2800 | { | |
2801 | match node { | |
2802 | PathArguments::None => PathArguments::None, | |
2803 | PathArguments::AngleBracketed(_binding_0) => { | |
5099ac24 FG |
2804 | PathArguments::AngleBracketed( |
2805 | f.fold_angle_bracketed_generic_arguments(_binding_0), | |
2806 | ) | |
e74abb32 XL |
2807 | } |
2808 | PathArguments::Parenthesized(_binding_0) => { | |
5099ac24 FG |
2809 | PathArguments::Parenthesized( |
2810 | f.fold_parenthesized_generic_arguments(_binding_0), | |
2811 | ) | |
e74abb32 XL |
2812 | } |
2813 | } | |
2814 | } | |
2815 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2816 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2817 | pub fn fold_path_segment<F>(f: &mut F, node: PathSegment) -> PathSegment |
2818 | where | |
2819 | F: Fold + ?Sized, | |
2820 | { | |
2821 | PathSegment { | |
2822 | ident: f.fold_ident(node.ident), | |
2823 | arguments: f.fold_path_arguments(node.arguments), | |
2824 | } | |
2825 | } | |
2826 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2827 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
5099ac24 FG |
2828 | pub fn fold_predicate_lifetime<F>( |
2829 | f: &mut F, | |
2830 | node: PredicateLifetime, | |
2831 | ) -> PredicateLifetime | |
e74abb32 XL |
2832 | where |
2833 | F: Fold + ?Sized, | |
2834 | { | |
2835 | PredicateLifetime { | |
2836 | lifetime: f.fold_lifetime(node.lifetime), | |
353b0b11 | 2837 | colon_token: node.colon_token, |
e74abb32 XL |
2838 | bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)), |
2839 | } | |
2840 | } | |
2841 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2842 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2843 | pub fn fold_predicate_type<F>(f: &mut F, node: PredicateType) -> PredicateType |
2844 | where | |
2845 | F: Fold + ?Sized, | |
2846 | { | |
2847 | PredicateType { | |
2848 | lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)), | |
2849 | bounded_ty: f.fold_type(node.bounded_ty), | |
353b0b11 | 2850 | colon_token: node.colon_token, |
e74abb32 XL |
2851 | bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), |
2852 | } | |
2853 | } | |
2854 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2855 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2856 | pub fn fold_qself<F>(f: &mut F, node: QSelf) -> QSelf |
2857 | where | |
2858 | F: Fold + ?Sized, | |
2859 | { | |
2860 | QSelf { | |
353b0b11 | 2861 | lt_token: node.lt_token, |
e74abb32 XL |
2862 | ty: Box::new(f.fold_type(*node.ty)), |
2863 | position: node.position, | |
353b0b11 FG |
2864 | as_token: node.as_token, |
2865 | gt_token: node.gt_token, | |
e74abb32 XL |
2866 | } |
2867 | } | |
2868 | #[cfg(feature = "full")] | |
c0240ec0 | 2869 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2870 | pub fn fold_range_limits<F>(f: &mut F, node: RangeLimits) -> RangeLimits |
2871 | where | |
2872 | F: Fold + ?Sized, | |
2873 | { | |
2874 | match node { | |
353b0b11 FG |
2875 | RangeLimits::HalfOpen(_binding_0) => RangeLimits::HalfOpen(_binding_0), |
2876 | RangeLimits::Closed(_binding_0) => RangeLimits::Closed(_binding_0), | |
e74abb32 XL |
2877 | } |
2878 | } | |
2879 | #[cfg(feature = "full")] | |
c0240ec0 | 2880 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2881 | pub fn fold_receiver<F>(f: &mut F, node: Receiver) -> Receiver |
2882 | where | |
2883 | F: Fold + ?Sized, | |
2884 | { | |
2885 | Receiver { | |
2886 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
5099ac24 | 2887 | reference: (node.reference) |
353b0b11 FG |
2888 | .map(|it| ((it).0, ((it).1).map(|it| f.fold_lifetime(it)))), |
2889 | mutability: node.mutability, | |
2890 | self_token: node.self_token, | |
2891 | colon_token: node.colon_token, | |
2892 | ty: Box::new(f.fold_type(*node.ty)), | |
e74abb32 XL |
2893 | } |
2894 | } | |
2895 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2896 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2897 | pub fn fold_return_type<F>(f: &mut F, node: ReturnType) -> ReturnType |
2898 | where | |
2899 | F: Fold + ?Sized, | |
2900 | { | |
2901 | match node { | |
2902 | ReturnType::Default => ReturnType::Default, | |
5099ac24 | 2903 | ReturnType::Type(_binding_0, _binding_1) => { |
353b0b11 | 2904 | ReturnType::Type(_binding_0, Box::new(f.fold_type(*_binding_1))) |
5099ac24 | 2905 | } |
e74abb32 XL |
2906 | } |
2907 | } | |
2908 | #[cfg(feature = "full")] | |
c0240ec0 | 2909 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2910 | pub fn fold_signature<F>(f: &mut F, node: Signature) -> Signature |
2911 | where | |
2912 | F: Fold + ?Sized, | |
2913 | { | |
2914 | Signature { | |
353b0b11 FG |
2915 | constness: node.constness, |
2916 | asyncness: node.asyncness, | |
2917 | unsafety: node.unsafety, | |
e74abb32 | 2918 | abi: (node.abi).map(|it| f.fold_abi(it)), |
353b0b11 | 2919 | fn_token: node.fn_token, |
e74abb32 XL |
2920 | ident: f.fold_ident(node.ident), |
2921 | generics: f.fold_generics(node.generics), | |
353b0b11 | 2922 | paren_token: node.paren_token, |
e74abb32 XL |
2923 | inputs: FoldHelper::lift(node.inputs, |it| f.fold_fn_arg(it)), |
2924 | variadic: (node.variadic).map(|it| f.fold_variadic(it)), | |
2925 | output: f.fold_return_type(node.output), | |
2926 | } | |
2927 | } | |
2928 | pub fn fold_span<F>(f: &mut F, node: Span) -> Span | |
2929 | where | |
2930 | F: Fold + ?Sized, | |
2931 | { | |
2932 | node | |
2933 | } | |
2934 | #[cfg(feature = "full")] | |
c0240ec0 | 2935 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
2936 | pub fn fold_static_mutability<F>(f: &mut F, node: StaticMutability) -> StaticMutability |
2937 | where | |
2938 | F: Fold + ?Sized, | |
2939 | { | |
2940 | match node { | |
2941 | StaticMutability::Mut(_binding_0) => StaticMutability::Mut(_binding_0), | |
2942 | StaticMutability::None => StaticMutability::None, | |
2943 | } | |
2944 | } | |
2945 | #[cfg(feature = "full")] | |
c0240ec0 | 2946 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
2947 | pub fn fold_stmt<F>(f: &mut F, node: Stmt) -> Stmt |
2948 | where | |
2949 | F: Fold + ?Sized, | |
2950 | { | |
2951 | match node { | |
2952 | Stmt::Local(_binding_0) => Stmt::Local(f.fold_local(_binding_0)), | |
2953 | Stmt::Item(_binding_0) => Stmt::Item(f.fold_item(_binding_0)), | |
353b0b11 FG |
2954 | Stmt::Expr(_binding_0, _binding_1) => { |
2955 | Stmt::Expr(f.fold_expr(_binding_0), _binding_1) | |
5099ac24 | 2956 | } |
353b0b11 FG |
2957 | Stmt::Macro(_binding_0) => Stmt::Macro(f.fold_stmt_macro(_binding_0)), |
2958 | } | |
2959 | } | |
2960 | #[cfg(feature = "full")] | |
c0240ec0 | 2961 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 FG |
2962 | pub fn fold_stmt_macro<F>(f: &mut F, node: StmtMacro) -> StmtMacro |
2963 | where | |
2964 | F: Fold + ?Sized, | |
2965 | { | |
2966 | StmtMacro { | |
2967 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
2968 | mac: f.fold_macro(node.mac), | |
2969 | semi_token: node.semi_token, | |
e74abb32 XL |
2970 | } |
2971 | } | |
2972 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2973 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
2974 | pub fn fold_trait_bound<F>(f: &mut F, node: TraitBound) -> TraitBound |
2975 | where | |
2976 | F: Fold + ?Sized, | |
2977 | { | |
2978 | TraitBound { | |
353b0b11 | 2979 | paren_token: node.paren_token, |
e74abb32 XL |
2980 | modifier: f.fold_trait_bound_modifier(node.modifier), |
2981 | lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)), | |
2982 | path: f.fold_path(node.path), | |
2983 | } | |
2984 | } | |
2985 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 2986 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
5099ac24 FG |
2987 | pub fn fold_trait_bound_modifier<F>( |
2988 | f: &mut F, | |
2989 | node: TraitBoundModifier, | |
2990 | ) -> TraitBoundModifier | |
e74abb32 XL |
2991 | where |
2992 | F: Fold + ?Sized, | |
2993 | { | |
2994 | match node { | |
2995 | TraitBoundModifier::None => TraitBoundModifier::None, | |
353b0b11 | 2996 | TraitBoundModifier::Maybe(_binding_0) => TraitBoundModifier::Maybe(_binding_0), |
e74abb32 XL |
2997 | } |
2998 | } | |
2999 | #[cfg(feature = "full")] | |
c0240ec0 | 3000 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3001 | pub fn fold_trait_item<F>(f: &mut F, node: TraitItem) -> TraitItem |
3002 | where | |
3003 | F: Fold + ?Sized, | |
3004 | { | |
3005 | match node { | |
5099ac24 FG |
3006 | TraitItem::Const(_binding_0) => { |
3007 | TraitItem::Const(f.fold_trait_item_const(_binding_0)) | |
3008 | } | |
353b0b11 | 3009 | TraitItem::Fn(_binding_0) => TraitItem::Fn(f.fold_trait_item_fn(_binding_0)), |
5099ac24 FG |
3010 | TraitItem::Type(_binding_0) => { |
3011 | TraitItem::Type(f.fold_trait_item_type(_binding_0)) | |
3012 | } | |
3013 | TraitItem::Macro(_binding_0) => { | |
3014 | TraitItem::Macro(f.fold_trait_item_macro(_binding_0)) | |
3015 | } | |
e74abb32 | 3016 | TraitItem::Verbatim(_binding_0) => TraitItem::Verbatim(_binding_0), |
e74abb32 XL |
3017 | } |
3018 | } | |
3019 | #[cfg(feature = "full")] | |
c0240ec0 | 3020 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3021 | pub fn fold_trait_item_const<F>(f: &mut F, node: TraitItemConst) -> TraitItemConst |
3022 | where | |
3023 | F: Fold + ?Sized, | |
3024 | { | |
3025 | TraitItemConst { | |
3026 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 3027 | const_token: node.const_token, |
e74abb32 | 3028 | ident: f.fold_ident(node.ident), |
353b0b11 FG |
3029 | generics: f.fold_generics(node.generics), |
3030 | colon_token: node.colon_token, | |
e74abb32 | 3031 | ty: f.fold_type(node.ty), |
353b0b11 FG |
3032 | default: (node.default).map(|it| ((it).0, f.fold_expr((it).1))), |
3033 | semi_token: node.semi_token, | |
e74abb32 XL |
3034 | } |
3035 | } | |
3036 | #[cfg(feature = "full")] | |
c0240ec0 | 3037 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 | 3038 | pub fn fold_trait_item_fn<F>(f: &mut F, node: TraitItemFn) -> TraitItemFn |
e74abb32 XL |
3039 | where |
3040 | F: Fold + ?Sized, | |
3041 | { | |
353b0b11 | 3042 | TraitItemFn { |
e74abb32 | 3043 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), |
353b0b11 FG |
3044 | sig: f.fold_signature(node.sig), |
3045 | default: (node.default).map(|it| f.fold_block(it)), | |
3046 | semi_token: node.semi_token, | |
e74abb32 XL |
3047 | } |
3048 | } | |
3049 | #[cfg(feature = "full")] | |
c0240ec0 | 3050 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
353b0b11 | 3051 | pub fn fold_trait_item_macro<F>(f: &mut F, node: TraitItemMacro) -> TraitItemMacro |
e74abb32 XL |
3052 | where |
3053 | F: Fold + ?Sized, | |
3054 | { | |
353b0b11 | 3055 | TraitItemMacro { |
e74abb32 | 3056 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), |
353b0b11 FG |
3057 | mac: f.fold_macro(node.mac), |
3058 | semi_token: node.semi_token, | |
e74abb32 XL |
3059 | } |
3060 | } | |
3061 | #[cfg(feature = "full")] | |
c0240ec0 | 3062 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3063 | pub fn fold_trait_item_type<F>(f: &mut F, node: TraitItemType) -> TraitItemType |
3064 | where | |
3065 | F: Fold + ?Sized, | |
3066 | { | |
3067 | TraitItemType { | |
3068 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 | 3069 | type_token: node.type_token, |
e74abb32 XL |
3070 | ident: f.fold_ident(node.ident), |
3071 | generics: f.fold_generics(node.generics), | |
353b0b11 | 3072 | colon_token: node.colon_token, |
e74abb32 | 3073 | bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), |
353b0b11 FG |
3074 | default: (node.default).map(|it| ((it).0, f.fold_type((it).1))), |
3075 | semi_token: node.semi_token, | |
e74abb32 XL |
3076 | } |
3077 | } | |
3078 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3079 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3080 | pub fn fold_type<F>(f: &mut F, node: Type) -> Type |
3081 | where | |
3082 | F: Fold + ?Sized, | |
3083 | { | |
3084 | match node { | |
3085 | Type::Array(_binding_0) => Type::Array(f.fold_type_array(_binding_0)), | |
3086 | Type::BareFn(_binding_0) => Type::BareFn(f.fold_type_bare_fn(_binding_0)), | |
3087 | Type::Group(_binding_0) => Type::Group(f.fold_type_group(_binding_0)), | |
5099ac24 FG |
3088 | Type::ImplTrait(_binding_0) => { |
3089 | Type::ImplTrait(f.fold_type_impl_trait(_binding_0)) | |
3090 | } | |
e74abb32 XL |
3091 | Type::Infer(_binding_0) => Type::Infer(f.fold_type_infer(_binding_0)), |
3092 | Type::Macro(_binding_0) => Type::Macro(f.fold_type_macro(_binding_0)), | |
3093 | Type::Never(_binding_0) => Type::Never(f.fold_type_never(_binding_0)), | |
3094 | Type::Paren(_binding_0) => Type::Paren(f.fold_type_paren(_binding_0)), | |
3095 | Type::Path(_binding_0) => Type::Path(f.fold_type_path(_binding_0)), | |
3096 | Type::Ptr(_binding_0) => Type::Ptr(f.fold_type_ptr(_binding_0)), | |
3097 | Type::Reference(_binding_0) => Type::Reference(f.fold_type_reference(_binding_0)), | |
3098 | Type::Slice(_binding_0) => Type::Slice(f.fold_type_slice(_binding_0)), | |
5099ac24 FG |
3099 | Type::TraitObject(_binding_0) => { |
3100 | Type::TraitObject(f.fold_type_trait_object(_binding_0)) | |
3101 | } | |
e74abb32 XL |
3102 | Type::Tuple(_binding_0) => Type::Tuple(f.fold_type_tuple(_binding_0)), |
3103 | Type::Verbatim(_binding_0) => Type::Verbatim(_binding_0), | |
e74abb32 XL |
3104 | } |
3105 | } | |
3106 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3107 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3108 | pub fn fold_type_array<F>(f: &mut F, node: TypeArray) -> TypeArray |
3109 | where | |
3110 | F: Fold + ?Sized, | |
3111 | { | |
3112 | TypeArray { | |
353b0b11 | 3113 | bracket_token: node.bracket_token, |
e74abb32 | 3114 | elem: Box::new(f.fold_type(*node.elem)), |
353b0b11 | 3115 | semi_token: node.semi_token, |
e74abb32 XL |
3116 | len: f.fold_expr(node.len), |
3117 | } | |
3118 | } | |
3119 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3120 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3121 | pub fn fold_type_bare_fn<F>(f: &mut F, node: TypeBareFn) -> TypeBareFn |
3122 | where | |
3123 | F: Fold + ?Sized, | |
3124 | { | |
3125 | TypeBareFn { | |
3126 | lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)), | |
353b0b11 | 3127 | unsafety: node.unsafety, |
e74abb32 | 3128 | abi: (node.abi).map(|it| f.fold_abi(it)), |
353b0b11 FG |
3129 | fn_token: node.fn_token, |
3130 | paren_token: node.paren_token, | |
e74abb32 | 3131 | inputs: FoldHelper::lift(node.inputs, |it| f.fold_bare_fn_arg(it)), |
353b0b11 | 3132 | variadic: (node.variadic).map(|it| f.fold_bare_variadic(it)), |
e74abb32 XL |
3133 | output: f.fold_return_type(node.output), |
3134 | } | |
3135 | } | |
3136 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3137 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3138 | pub fn fold_type_group<F>(f: &mut F, node: TypeGroup) -> TypeGroup |
3139 | where | |
3140 | F: Fold + ?Sized, | |
3141 | { | |
3142 | TypeGroup { | |
353b0b11 | 3143 | group_token: node.group_token, |
e74abb32 XL |
3144 | elem: Box::new(f.fold_type(*node.elem)), |
3145 | } | |
3146 | } | |
3147 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3148 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3149 | pub fn fold_type_impl_trait<F>(f: &mut F, node: TypeImplTrait) -> TypeImplTrait |
3150 | where | |
3151 | F: Fold + ?Sized, | |
3152 | { | |
3153 | TypeImplTrait { | |
353b0b11 | 3154 | impl_token: node.impl_token, |
e74abb32 XL |
3155 | bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), |
3156 | } | |
3157 | } | |
3158 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3159 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3160 | pub fn fold_type_infer<F>(f: &mut F, node: TypeInfer) -> TypeInfer |
3161 | where | |
3162 | F: Fold + ?Sized, | |
3163 | { | |
3164 | TypeInfer { | |
353b0b11 | 3165 | underscore_token: node.underscore_token, |
e74abb32 XL |
3166 | } |
3167 | } | |
3168 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3169 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3170 | pub fn fold_type_macro<F>(f: &mut F, node: TypeMacro) -> TypeMacro |
3171 | where | |
3172 | F: Fold + ?Sized, | |
3173 | { | |
3174 | TypeMacro { | |
3175 | mac: f.fold_macro(node.mac), | |
3176 | } | |
3177 | } | |
3178 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3179 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3180 | pub fn fold_type_never<F>(f: &mut F, node: TypeNever) -> TypeNever |
3181 | where | |
3182 | F: Fold + ?Sized, | |
3183 | { | |
3184 | TypeNever { | |
353b0b11 | 3185 | bang_token: node.bang_token, |
e74abb32 XL |
3186 | } |
3187 | } | |
3188 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3189 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3190 | pub fn fold_type_param<F>(f: &mut F, node: TypeParam) -> TypeParam |
3191 | where | |
3192 | F: Fold + ?Sized, | |
3193 | { | |
3194 | TypeParam { | |
3195 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
3196 | ident: f.fold_ident(node.ident), | |
353b0b11 | 3197 | colon_token: node.colon_token, |
e74abb32 | 3198 | bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), |
353b0b11 | 3199 | eq_token: node.eq_token, |
e74abb32 XL |
3200 | default: (node.default).map(|it| f.fold_type(it)), |
3201 | } | |
3202 | } | |
3203 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3204 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3205 | pub fn fold_type_param_bound<F>(f: &mut F, node: TypeParamBound) -> TypeParamBound |
3206 | where | |
3207 | F: Fold + ?Sized, | |
3208 | { | |
3209 | match node { | |
5099ac24 FG |
3210 | TypeParamBound::Trait(_binding_0) => { |
3211 | TypeParamBound::Trait(f.fold_trait_bound(_binding_0)) | |
3212 | } | |
e74abb32 XL |
3213 | TypeParamBound::Lifetime(_binding_0) => { |
3214 | TypeParamBound::Lifetime(f.fold_lifetime(_binding_0)) | |
3215 | } | |
353b0b11 | 3216 | TypeParamBound::Verbatim(_binding_0) => TypeParamBound::Verbatim(_binding_0), |
e74abb32 XL |
3217 | } |
3218 | } | |
3219 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3220 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3221 | pub fn fold_type_paren<F>(f: &mut F, node: TypeParen) -> TypeParen |
3222 | where | |
3223 | F: Fold + ?Sized, | |
3224 | { | |
3225 | TypeParen { | |
353b0b11 | 3226 | paren_token: node.paren_token, |
e74abb32 XL |
3227 | elem: Box::new(f.fold_type(*node.elem)), |
3228 | } | |
3229 | } | |
3230 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3231 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3232 | pub fn fold_type_path<F>(f: &mut F, node: TypePath) -> TypePath |
3233 | where | |
3234 | F: Fold + ?Sized, | |
3235 | { | |
3236 | TypePath { | |
3237 | qself: (node.qself).map(|it| f.fold_qself(it)), | |
3238 | path: f.fold_path(node.path), | |
3239 | } | |
3240 | } | |
3241 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3242 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3243 | pub fn fold_type_ptr<F>(f: &mut F, node: TypePtr) -> TypePtr |
3244 | where | |
3245 | F: Fold + ?Sized, | |
3246 | { | |
3247 | TypePtr { | |
353b0b11 FG |
3248 | star_token: node.star_token, |
3249 | const_token: node.const_token, | |
3250 | mutability: node.mutability, | |
e74abb32 XL |
3251 | elem: Box::new(f.fold_type(*node.elem)), |
3252 | } | |
3253 | } | |
3254 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3255 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3256 | pub fn fold_type_reference<F>(f: &mut F, node: TypeReference) -> TypeReference |
3257 | where | |
3258 | F: Fold + ?Sized, | |
3259 | { | |
3260 | TypeReference { | |
353b0b11 | 3261 | and_token: node.and_token, |
e74abb32 | 3262 | lifetime: (node.lifetime).map(|it| f.fold_lifetime(it)), |
353b0b11 | 3263 | mutability: node.mutability, |
e74abb32 XL |
3264 | elem: Box::new(f.fold_type(*node.elem)), |
3265 | } | |
3266 | } | |
3267 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3268 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3269 | pub fn fold_type_slice<F>(f: &mut F, node: TypeSlice) -> TypeSlice |
3270 | where | |
3271 | F: Fold + ?Sized, | |
3272 | { | |
3273 | TypeSlice { | |
353b0b11 | 3274 | bracket_token: node.bracket_token, |
e74abb32 XL |
3275 | elem: Box::new(f.fold_type(*node.elem)), |
3276 | } | |
3277 | } | |
3278 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3279 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3280 | pub fn fold_type_trait_object<F>(f: &mut F, node: TypeTraitObject) -> TypeTraitObject |
3281 | where | |
3282 | F: Fold + ?Sized, | |
3283 | { | |
3284 | TypeTraitObject { | |
353b0b11 | 3285 | dyn_token: node.dyn_token, |
e74abb32 XL |
3286 | bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), |
3287 | } | |
3288 | } | |
3289 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3290 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3291 | pub fn fold_type_tuple<F>(f: &mut F, node: TypeTuple) -> TypeTuple |
3292 | where | |
3293 | F: Fold + ?Sized, | |
3294 | { | |
3295 | TypeTuple { | |
353b0b11 | 3296 | paren_token: node.paren_token, |
e74abb32 XL |
3297 | elems: FoldHelper::lift(node.elems, |it| f.fold_type(it)), |
3298 | } | |
3299 | } | |
3300 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3301 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3302 | pub fn fold_un_op<F>(f: &mut F, node: UnOp) -> UnOp |
3303 | where | |
3304 | F: Fold + ?Sized, | |
3305 | { | |
3306 | match node { | |
353b0b11 FG |
3307 | UnOp::Deref(_binding_0) => UnOp::Deref(_binding_0), |
3308 | UnOp::Not(_binding_0) => UnOp::Not(_binding_0), | |
3309 | UnOp::Neg(_binding_0) => UnOp::Neg(_binding_0), | |
e74abb32 XL |
3310 | } |
3311 | } | |
3312 | #[cfg(feature = "full")] | |
c0240ec0 | 3313 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3314 | pub fn fold_use_glob<F>(f: &mut F, node: UseGlob) -> UseGlob |
3315 | where | |
3316 | F: Fold + ?Sized, | |
3317 | { | |
3318 | UseGlob { | |
353b0b11 | 3319 | star_token: node.star_token, |
e74abb32 XL |
3320 | } |
3321 | } | |
3322 | #[cfg(feature = "full")] | |
c0240ec0 | 3323 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3324 | pub fn fold_use_group<F>(f: &mut F, node: UseGroup) -> UseGroup |
3325 | where | |
3326 | F: Fold + ?Sized, | |
3327 | { | |
3328 | UseGroup { | |
353b0b11 | 3329 | brace_token: node.brace_token, |
e74abb32 XL |
3330 | items: FoldHelper::lift(node.items, |it| f.fold_use_tree(it)), |
3331 | } | |
3332 | } | |
3333 | #[cfg(feature = "full")] | |
c0240ec0 | 3334 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3335 | pub fn fold_use_name<F>(f: &mut F, node: UseName) -> UseName |
3336 | where | |
3337 | F: Fold + ?Sized, | |
3338 | { | |
3339 | UseName { | |
3340 | ident: f.fold_ident(node.ident), | |
3341 | } | |
3342 | } | |
3343 | #[cfg(feature = "full")] | |
c0240ec0 | 3344 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3345 | pub fn fold_use_path<F>(f: &mut F, node: UsePath) -> UsePath |
3346 | where | |
3347 | F: Fold + ?Sized, | |
3348 | { | |
3349 | UsePath { | |
3350 | ident: f.fold_ident(node.ident), | |
353b0b11 | 3351 | colon2_token: node.colon2_token, |
e74abb32 XL |
3352 | tree: Box::new(f.fold_use_tree(*node.tree)), |
3353 | } | |
3354 | } | |
3355 | #[cfg(feature = "full")] | |
c0240ec0 | 3356 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3357 | pub fn fold_use_rename<F>(f: &mut F, node: UseRename) -> UseRename |
3358 | where | |
3359 | F: Fold + ?Sized, | |
3360 | { | |
3361 | UseRename { | |
3362 | ident: f.fold_ident(node.ident), | |
353b0b11 | 3363 | as_token: node.as_token, |
e74abb32 XL |
3364 | rename: f.fold_ident(node.rename), |
3365 | } | |
3366 | } | |
3367 | #[cfg(feature = "full")] | |
c0240ec0 | 3368 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3369 | pub fn fold_use_tree<F>(f: &mut F, node: UseTree) -> UseTree |
3370 | where | |
3371 | F: Fold + ?Sized, | |
3372 | { | |
3373 | match node { | |
3374 | UseTree::Path(_binding_0) => UseTree::Path(f.fold_use_path(_binding_0)), | |
3375 | UseTree::Name(_binding_0) => UseTree::Name(f.fold_use_name(_binding_0)), | |
3376 | UseTree::Rename(_binding_0) => UseTree::Rename(f.fold_use_rename(_binding_0)), | |
3377 | UseTree::Glob(_binding_0) => UseTree::Glob(f.fold_use_glob(_binding_0)), | |
3378 | UseTree::Group(_binding_0) => UseTree::Group(f.fold_use_group(_binding_0)), | |
3379 | } | |
3380 | } | |
353b0b11 | 3381 | #[cfg(feature = "full")] |
c0240ec0 | 3382 | #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] |
e74abb32 XL |
3383 | pub fn fold_variadic<F>(f: &mut F, node: Variadic) -> Variadic |
3384 | where | |
3385 | F: Fold + ?Sized, | |
3386 | { | |
3387 | Variadic { | |
3388 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
353b0b11 FG |
3389 | pat: (node.pat).map(|it| (Box::new(f.fold_pat(*(it).0)), (it).1)), |
3390 | dots: node.dots, | |
3391 | comma: node.comma, | |
e74abb32 XL |
3392 | } |
3393 | } | |
3394 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3395 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3396 | pub fn fold_variant<F>(f: &mut F, node: Variant) -> Variant |
3397 | where | |
3398 | F: Fold + ?Sized, | |
3399 | { | |
3400 | Variant { | |
3401 | attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), | |
3402 | ident: f.fold_ident(node.ident), | |
3403 | fields: f.fold_fields(node.fields), | |
353b0b11 | 3404 | discriminant: (node.discriminant).map(|it| ((it).0, f.fold_expr((it).1))), |
e74abb32 XL |
3405 | } |
3406 | } | |
3407 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3408 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3409 | pub fn fold_vis_restricted<F>(f: &mut F, node: VisRestricted) -> VisRestricted |
3410 | where | |
3411 | F: Fold + ?Sized, | |
3412 | { | |
3413 | VisRestricted { | |
353b0b11 FG |
3414 | pub_token: node.pub_token, |
3415 | paren_token: node.paren_token, | |
3416 | in_token: node.in_token, | |
e74abb32 XL |
3417 | path: Box::new(f.fold_path(*node.path)), |
3418 | } | |
3419 | } | |
3420 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3421 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3422 | pub fn fold_visibility<F>(f: &mut F, node: Visibility) -> Visibility |
3423 | where | |
3424 | F: Fold + ?Sized, | |
3425 | { | |
3426 | match node { | |
353b0b11 | 3427 | Visibility::Public(_binding_0) => Visibility::Public(_binding_0), |
e74abb32 XL |
3428 | Visibility::Restricted(_binding_0) => { |
3429 | Visibility::Restricted(f.fold_vis_restricted(_binding_0)) | |
3430 | } | |
3431 | Visibility::Inherited => Visibility::Inherited, | |
3432 | } | |
3433 | } | |
3434 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3435 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3436 | pub fn fold_where_clause<F>(f: &mut F, node: WhereClause) -> WhereClause |
3437 | where | |
3438 | F: Fold + ?Sized, | |
3439 | { | |
3440 | WhereClause { | |
353b0b11 | 3441 | where_token: node.where_token, |
e74abb32 XL |
3442 | predicates: FoldHelper::lift(node.predicates, |it| f.fold_where_predicate(it)), |
3443 | } | |
3444 | } | |
3445 | #[cfg(any(feature = "derive", feature = "full"))] | |
c0240ec0 | 3446 | #[cfg_attr(doc_cfg, doc(cfg(any(feature = "derive", feature = "full"))))] |
e74abb32 XL |
3447 | pub fn fold_where_predicate<F>(f: &mut F, node: WherePredicate) -> WherePredicate |
3448 | where | |
3449 | F: Fold + ?Sized, | |
3450 | { | |
3451 | match node { | |
e74abb32 XL |
3452 | WherePredicate::Lifetime(_binding_0) => { |
3453 | WherePredicate::Lifetime(f.fold_predicate_lifetime(_binding_0)) | |
3454 | } | |
353b0b11 FG |
3455 | WherePredicate::Type(_binding_0) => { |
3456 | WherePredicate::Type(f.fold_predicate_type(_binding_0)) | |
5099ac24 | 3457 | } |
e74abb32 XL |
3458 | } |
3459 | } |