blob: 31d1cf3765c9ac4d30fb60176d23e7f5850ff9b8 [file] [log] [blame]
Nika Layzell27726662017-10-24 23:16:35 -04001// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
2
Nika Layzell27726662017-10-24 23:16:35 -04003#![allow(unreachable_code)]
David Tolnayf0d63bf2017-12-26 12:29:47 -05004#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
David Tolnay0a0d78c2018-01-05 15:24:01 -08005#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05006use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07007use proc_macro2::Span;
8#[cfg(any(feature = "full", feature = "derive"))]
9use token::{Brace, Bracket, Group, Paren};
10use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040011#[cfg(feature = "full")]
12macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070013 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070014 $e
15 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040016}
David Tolnay0a0d78c2018-01-05 15:24:01 -080017#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040018macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070019 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070020 unreachable!()
21 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040022}
David Tolnay6af48992018-08-01 11:16:28 -070023#[doc = r" Syntax tree traversal to transform the nodes of an owned syntax tree."]
24#[doc = r""]
25#[doc = r" See the [module documentation] for details."]
26#[doc = r""]
27#[doc = r" [module documentation]: index.html"]
28#[doc = r""]
29#[doc = r#" *This trait is available if Syn is built with the `"fold"` feature.*"#]
David Tolnay4b4c4b62018-01-06 13:48:05 -080030pub trait Fold {
David Tolnay8c81f622018-07-31 23:34:35 -070031 #[cfg(any(feature = "full", feature = "derive"))]
32 fn fold_abi(&mut self, i: Abi) -> Abi {
33 fold_abi(self, i)
34 }
35 #[cfg(any(feature = "full", feature = "derive"))]
36 fn fold_angle_bracketed_generic_arguments(
37 &mut self,
38 i: AngleBracketedGenericArguments,
39 ) -> AngleBracketedGenericArguments {
40 fold_angle_bracketed_generic_arguments(self, i)
41 }
42 #[cfg(feature = "full")]
43 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
44 fold_arg_captured(self, i)
45 }
46 #[cfg(feature = "full")]
47 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
48 fold_arg_self(self, i)
49 }
50 #[cfg(feature = "full")]
51 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
52 fold_arg_self_ref(self, i)
53 }
54 #[cfg(any(feature = "full", feature = "derive"))]
55 #[cfg(feature = "full")]
56 fn fold_arm(&mut self, i: Arm) -> Arm {
57 fold_arm(self, i)
58 }
59 #[cfg(any(feature = "full", feature = "derive"))]
60 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
61 fold_attr_style(self, i)
62 }
63 #[cfg(any(feature = "full", feature = "derive"))]
64 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
65 fold_attribute(self, i)
66 }
67 #[cfg(any(feature = "full", feature = "derive"))]
68 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
69 fold_bare_fn_arg(self, i)
70 }
71 #[cfg(any(feature = "full", feature = "derive"))]
72 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
73 fold_bare_fn_arg_name(self, i)
74 }
75 #[cfg(any(feature = "full", feature = "derive"))]
76 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
77 fold_bin_op(self, i)
78 }
79 #[cfg(any(feature = "full", feature = "derive"))]
80 fn fold_binding(&mut self, i: Binding) -> Binding {
81 fold_binding(self, i)
82 }
83 #[cfg(any(feature = "full", feature = "derive"))]
84 #[cfg(feature = "full")]
85 fn fold_block(&mut self, i: Block) -> Block {
86 fold_block(self, i)
87 }
88 #[cfg(any(feature = "full", feature = "derive"))]
89 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
90 fold_bound_lifetimes(self, i)
91 }
92 #[cfg(any(feature = "full", feature = "derive"))]
93 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
94 fold_const_param(self, i)
95 }
96 #[cfg(feature = "derive")]
97 fn fold_data(&mut self, i: Data) -> Data {
98 fold_data(self, i)
99 }
100 #[cfg(feature = "derive")]
101 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
102 fold_data_enum(self, i)
103 }
104 #[cfg(feature = "derive")]
105 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
106 fold_data_struct(self, i)
107 }
108 #[cfg(feature = "derive")]
109 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
110 fold_data_union(self, i)
111 }
112 #[cfg(feature = "derive")]
113 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
114 fold_derive_input(self, i)
115 }
116 #[cfg(any(feature = "full", feature = "derive"))]
117 fn fold_expr(&mut self, i: Expr) -> Expr {
118 fold_expr(self, i)
119 }
120 #[cfg(feature = "full")]
121 #[cfg(any(feature = "full", feature = "derive"))]
122 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
123 fold_expr_array(self, i)
124 }
125 #[cfg(feature = "full")]
126 #[cfg(any(feature = "full", feature = "derive"))]
127 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
128 fold_expr_assign(self, i)
129 }
130 #[cfg(feature = "full")]
131 #[cfg(any(feature = "full", feature = "derive"))]
132 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
133 fold_expr_assign_op(self, i)
134 }
David Tolnay02a9c6f2018-08-24 18:58:45 -0400135 #[cfg(feature = "full")]
136 #[cfg(any(feature = "full", feature = "derive"))]
137 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
138 fold_expr_async(self, i)
139 }
David Tolnay8c81f622018-07-31 23:34:35 -0700140 #[cfg(any(feature = "full", feature = "derive"))]
141 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
142 fold_expr_binary(self, i)
143 }
144 #[cfg(feature = "full")]
145 #[cfg(any(feature = "full", feature = "derive"))]
146 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
147 fold_expr_block(self, i)
148 }
149 #[cfg(feature = "full")]
150 #[cfg(any(feature = "full", feature = "derive"))]
151 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
152 fold_expr_box(self, i)
153 }
154 #[cfg(feature = "full")]
155 #[cfg(any(feature = "full", feature = "derive"))]
156 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
157 fold_expr_break(self, i)
158 }
159 #[cfg(any(feature = "full", feature = "derive"))]
160 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
161 fold_expr_call(self, i)
162 }
163 #[cfg(any(feature = "full", feature = "derive"))]
164 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
165 fold_expr_cast(self, i)
166 }
167 #[cfg(feature = "full")]
168 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700169 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
170 fold_expr_closure(self, i)
171 }
172 #[cfg(feature = "full")]
173 #[cfg(any(feature = "full", feature = "derive"))]
174 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
175 fold_expr_continue(self, i)
176 }
177 #[cfg(any(feature = "full", feature = "derive"))]
178 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
179 fold_expr_field(self, i)
180 }
181 #[cfg(feature = "full")]
182 #[cfg(any(feature = "full", feature = "derive"))]
183 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
184 fold_expr_for_loop(self, i)
185 }
186 #[cfg(feature = "full")]
187 #[cfg(any(feature = "full", feature = "derive"))]
188 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
189 fold_expr_group(self, i)
190 }
191 #[cfg(feature = "full")]
192 #[cfg(any(feature = "full", feature = "derive"))]
193 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
194 fold_expr_if(self, i)
195 }
196 #[cfg(feature = "full")]
197 #[cfg(any(feature = "full", feature = "derive"))]
198 fn fold_expr_if_let(&mut self, i: ExprIfLet) -> ExprIfLet {
199 fold_expr_if_let(self, i)
200 }
201 #[cfg(feature = "full")]
202 #[cfg(any(feature = "full", feature = "derive"))]
203 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
204 fold_expr_in_place(self, i)
205 }
206 #[cfg(any(feature = "full", feature = "derive"))]
207 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
208 fold_expr_index(self, i)
209 }
210 #[cfg(any(feature = "full", feature = "derive"))]
211 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
212 fold_expr_lit(self, i)
213 }
214 #[cfg(feature = "full")]
215 #[cfg(any(feature = "full", feature = "derive"))]
216 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
217 fold_expr_loop(self, i)
218 }
219 #[cfg(feature = "full")]
220 #[cfg(any(feature = "full", feature = "derive"))]
221 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
222 fold_expr_macro(self, i)
223 }
224 #[cfg(feature = "full")]
225 #[cfg(any(feature = "full", feature = "derive"))]
226 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
227 fold_expr_match(self, i)
228 }
229 #[cfg(feature = "full")]
230 #[cfg(any(feature = "full", feature = "derive"))]
231 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
232 fold_expr_method_call(self, i)
233 }
234 #[cfg(any(feature = "full", feature = "derive"))]
235 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
236 fold_expr_paren(self, i)
237 }
238 #[cfg(any(feature = "full", feature = "derive"))]
239 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
240 fold_expr_path(self, i)
241 }
242 #[cfg(feature = "full")]
243 #[cfg(any(feature = "full", feature = "derive"))]
244 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
245 fold_expr_range(self, i)
246 }
247 #[cfg(feature = "full")]
248 #[cfg(any(feature = "full", feature = "derive"))]
249 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
250 fold_expr_reference(self, i)
251 }
252 #[cfg(feature = "full")]
253 #[cfg(any(feature = "full", feature = "derive"))]
254 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
255 fold_expr_repeat(self, i)
256 }
257 #[cfg(feature = "full")]
258 #[cfg(any(feature = "full", feature = "derive"))]
259 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
260 fold_expr_return(self, i)
261 }
262 #[cfg(feature = "full")]
263 #[cfg(any(feature = "full", feature = "derive"))]
264 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
265 fold_expr_struct(self, i)
266 }
267 #[cfg(feature = "full")]
268 #[cfg(any(feature = "full", feature = "derive"))]
269 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
270 fold_expr_try(self, i)
271 }
272 #[cfg(feature = "full")]
273 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -0400274 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
275 fold_expr_try_block(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700279 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
280 fold_expr_tuple(self, i)
281 }
282 #[cfg(feature = "full")]
283 #[cfg(any(feature = "full", feature = "derive"))]
284 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
285 fold_expr_type(self, i)
286 }
287 #[cfg(any(feature = "full", feature = "derive"))]
288 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
289 fold_expr_unary(self, i)
290 }
291 #[cfg(feature = "full")]
292 #[cfg(any(feature = "full", feature = "derive"))]
293 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
294 fold_expr_unsafe(self, i)
295 }
296 #[cfg(any(feature = "full", feature = "derive"))]
297 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
298 fold_expr_verbatim(self, i)
299 }
300 #[cfg(feature = "full")]
301 #[cfg(any(feature = "full", feature = "derive"))]
302 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
303 fold_expr_while(self, i)
304 }
305 #[cfg(feature = "full")]
306 #[cfg(any(feature = "full", feature = "derive"))]
307 fn fold_expr_while_let(&mut self, i: ExprWhileLet) -> ExprWhileLet {
308 fold_expr_while_let(self, i)
309 }
310 #[cfg(feature = "full")]
311 #[cfg(any(feature = "full", feature = "derive"))]
312 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
313 fold_expr_yield(self, i)
314 }
315 #[cfg(any(feature = "full", feature = "derive"))]
316 fn fold_field(&mut self, i: Field) -> Field {
317 fold_field(self, i)
318 }
319 #[cfg(any(feature = "full", feature = "derive"))]
320 #[cfg(feature = "full")]
321 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
322 fold_field_pat(self, i)
323 }
324 #[cfg(any(feature = "full", feature = "derive"))]
325 #[cfg(feature = "full")]
326 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
327 fold_field_value(self, i)
328 }
329 #[cfg(any(feature = "full", feature = "derive"))]
330 fn fold_fields(&mut self, i: Fields) -> Fields {
331 fold_fields(self, i)
332 }
333 #[cfg(any(feature = "full", feature = "derive"))]
334 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
335 fold_fields_named(self, i)
336 }
337 #[cfg(any(feature = "full", feature = "derive"))]
338 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
339 fold_fields_unnamed(self, i)
340 }
341 #[cfg(feature = "full")]
342 fn fold_file(&mut self, i: File) -> File {
343 fold_file(self, i)
344 }
345 #[cfg(feature = "full")]
346 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
347 fold_fn_arg(self, i)
348 }
349 #[cfg(feature = "full")]
350 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
351 fold_fn_decl(self, i)
352 }
353 #[cfg(feature = "full")]
354 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
355 fold_foreign_item(self, i)
356 }
357 #[cfg(feature = "full")]
358 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
359 fold_foreign_item_fn(self, i)
360 }
361 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400362 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
363 fold_foreign_item_macro(self, i)
364 }
365 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700366 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
367 fold_foreign_item_static(self, i)
368 }
369 #[cfg(feature = "full")]
370 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
371 fold_foreign_item_type(self, i)
372 }
373 #[cfg(feature = "full")]
374 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
375 fold_foreign_item_verbatim(self, i)
376 }
377 #[cfg(any(feature = "full", feature = "derive"))]
378 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
379 fold_generic_argument(self, i)
380 }
381 #[cfg(any(feature = "full", feature = "derive"))]
382 #[cfg(feature = "full")]
383 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
384 fold_generic_method_argument(self, i)
385 }
386 #[cfg(any(feature = "full", feature = "derive"))]
387 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
388 fold_generic_param(self, i)
389 }
390 #[cfg(any(feature = "full", feature = "derive"))]
391 fn fold_generics(&mut self, i: Generics) -> Generics {
392 fold_generics(self, i)
393 }
David Tolnay8c81f622018-07-31 23:34:35 -0700394 fn fold_ident(&mut self, i: Ident) -> Ident {
395 fold_ident(self, i)
396 }
397 #[cfg(feature = "full")]
398 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
399 fold_impl_item(self, i)
400 }
401 #[cfg(feature = "full")]
402 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
403 fold_impl_item_const(self, i)
404 }
405 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400406 fn fold_impl_item_existential(&mut self, i: ImplItemExistential) -> ImplItemExistential {
407 fold_impl_item_existential(self, i)
408 }
409 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700410 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
411 fold_impl_item_macro(self, i)
412 }
413 #[cfg(feature = "full")]
414 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
415 fold_impl_item_method(self, i)
416 }
417 #[cfg(feature = "full")]
418 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
419 fold_impl_item_type(self, i)
420 }
421 #[cfg(feature = "full")]
422 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
423 fold_impl_item_verbatim(self, i)
424 }
425 #[cfg(any(feature = "full", feature = "derive"))]
426 fn fold_index(&mut self, i: Index) -> Index {
427 fold_index(self, i)
428 }
429 #[cfg(feature = "full")]
430 fn fold_item(&mut self, i: Item) -> Item {
431 fold_item(self, i)
432 }
433 #[cfg(feature = "full")]
434 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
435 fold_item_const(self, i)
436 }
437 #[cfg(feature = "full")]
438 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
439 fold_item_enum(self, i)
440 }
441 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400442 fn fold_item_existential(&mut self, i: ItemExistential) -> ItemExistential {
443 fold_item_existential(self, i)
444 }
445 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700446 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
447 fold_item_extern_crate(self, i)
448 }
449 #[cfg(feature = "full")]
450 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
451 fold_item_fn(self, i)
452 }
453 #[cfg(feature = "full")]
454 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
455 fold_item_foreign_mod(self, i)
456 }
457 #[cfg(feature = "full")]
458 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
459 fold_item_impl(self, i)
460 }
461 #[cfg(feature = "full")]
462 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
463 fold_item_macro(self, i)
464 }
465 #[cfg(feature = "full")]
466 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
467 fold_item_macro2(self, i)
468 }
469 #[cfg(feature = "full")]
470 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
471 fold_item_mod(self, i)
472 }
473 #[cfg(feature = "full")]
474 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
475 fold_item_static(self, i)
476 }
477 #[cfg(feature = "full")]
478 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
479 fold_item_struct(self, i)
480 }
481 #[cfg(feature = "full")]
482 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
483 fold_item_trait(self, i)
484 }
485 #[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -0700486 fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias {
487 fold_item_trait_alias(self, i)
488 }
489 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700490 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
491 fold_item_type(self, i)
492 }
493 #[cfg(feature = "full")]
494 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
495 fold_item_union(self, i)
496 }
497 #[cfg(feature = "full")]
498 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
499 fold_item_use(self, i)
500 }
501 #[cfg(feature = "full")]
502 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
503 fold_item_verbatim(self, i)
504 }
505 #[cfg(any(feature = "full", feature = "derive"))]
506 #[cfg(feature = "full")]
507 fn fold_label(&mut self, i: Label) -> Label {
508 fold_label(self, i)
509 }
David Tolnay8c81f622018-07-31 23:34:35 -0700510 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
511 fold_lifetime(self, i)
512 }
513 #[cfg(any(feature = "full", feature = "derive"))]
514 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
515 fold_lifetime_def(self, i)
516 }
517 #[cfg(any(feature = "full", feature = "derive"))]
518 fn fold_lit(&mut self, i: Lit) -> Lit {
519 fold_lit(self, i)
520 }
521 #[cfg(any(feature = "full", feature = "derive"))]
522 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
523 fold_lit_bool(self, i)
524 }
525 #[cfg(any(feature = "full", feature = "derive"))]
526 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
527 fold_lit_byte(self, i)
528 }
529 #[cfg(any(feature = "full", feature = "derive"))]
530 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
531 fold_lit_byte_str(self, i)
532 }
533 #[cfg(any(feature = "full", feature = "derive"))]
534 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
535 fold_lit_char(self, i)
536 }
537 #[cfg(any(feature = "full", feature = "derive"))]
538 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
539 fold_lit_float(self, i)
540 }
541 #[cfg(any(feature = "full", feature = "derive"))]
542 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
543 fold_lit_int(self, i)
544 }
545 #[cfg(any(feature = "full", feature = "derive"))]
546 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
547 fold_lit_str(self, i)
548 }
549 #[cfg(any(feature = "full", feature = "derive"))]
550 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
551 fold_lit_verbatim(self, i)
552 }
553 #[cfg(any(feature = "full", feature = "derive"))]
554 #[cfg(feature = "full")]
555 fn fold_local(&mut self, i: Local) -> Local {
556 fold_local(self, i)
557 }
558 #[cfg(any(feature = "full", feature = "derive"))]
559 fn fold_macro(&mut self, i: Macro) -> Macro {
560 fold_macro(self, i)
561 }
562 #[cfg(any(feature = "full", feature = "derive"))]
563 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
564 fold_macro_delimiter(self, i)
565 }
566 #[cfg(any(feature = "full", feature = "derive"))]
567 fn fold_member(&mut self, i: Member) -> Member {
568 fold_member(self, i)
569 }
570 #[cfg(any(feature = "full", feature = "derive"))]
571 fn fold_meta(&mut self, i: Meta) -> Meta {
572 fold_meta(self, i)
573 }
574 #[cfg(any(feature = "full", feature = "derive"))]
575 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
576 fold_meta_list(self, i)
577 }
578 #[cfg(any(feature = "full", feature = "derive"))]
579 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
580 fold_meta_name_value(self, i)
581 }
582 #[cfg(feature = "full")]
583 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
584 fold_method_sig(self, i)
585 }
586 #[cfg(any(feature = "full", feature = "derive"))]
587 #[cfg(feature = "full")]
588 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
589 fold_method_turbofish(self, i)
590 }
591 #[cfg(any(feature = "full", feature = "derive"))]
592 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
593 fold_nested_meta(self, i)
594 }
595 #[cfg(any(feature = "full", feature = "derive"))]
596 fn fold_parenthesized_generic_arguments(
597 &mut self,
598 i: ParenthesizedGenericArguments,
599 ) -> ParenthesizedGenericArguments {
600 fold_parenthesized_generic_arguments(self, i)
601 }
602 #[cfg(any(feature = "full", feature = "derive"))]
603 #[cfg(feature = "full")]
604 fn fold_pat(&mut self, i: Pat) -> Pat {
605 fold_pat(self, i)
606 }
607 #[cfg(any(feature = "full", feature = "derive"))]
608 #[cfg(feature = "full")]
609 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
610 fold_pat_box(self, i)
611 }
612 #[cfg(any(feature = "full", feature = "derive"))]
613 #[cfg(feature = "full")]
614 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
615 fold_pat_ident(self, i)
616 }
617 #[cfg(any(feature = "full", feature = "derive"))]
618 #[cfg(feature = "full")]
619 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
620 fold_pat_lit(self, i)
621 }
622 #[cfg(any(feature = "full", feature = "derive"))]
623 #[cfg(feature = "full")]
624 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
625 fold_pat_macro(self, i)
626 }
627 #[cfg(any(feature = "full", feature = "derive"))]
628 #[cfg(feature = "full")]
629 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
630 fold_pat_path(self, i)
631 }
632 #[cfg(any(feature = "full", feature = "derive"))]
633 #[cfg(feature = "full")]
634 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
635 fold_pat_range(self, i)
636 }
637 #[cfg(any(feature = "full", feature = "derive"))]
638 #[cfg(feature = "full")]
639 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
640 fold_pat_ref(self, i)
641 }
642 #[cfg(any(feature = "full", feature = "derive"))]
643 #[cfg(feature = "full")]
644 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
645 fold_pat_slice(self, i)
646 }
647 #[cfg(any(feature = "full", feature = "derive"))]
648 #[cfg(feature = "full")]
649 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
650 fold_pat_struct(self, i)
651 }
652 #[cfg(any(feature = "full", feature = "derive"))]
653 #[cfg(feature = "full")]
654 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
655 fold_pat_tuple(self, i)
656 }
657 #[cfg(any(feature = "full", feature = "derive"))]
658 #[cfg(feature = "full")]
659 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
660 fold_pat_tuple_struct(self, i)
661 }
662 #[cfg(any(feature = "full", feature = "derive"))]
663 #[cfg(feature = "full")]
664 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
665 fold_pat_verbatim(self, i)
666 }
667 #[cfg(any(feature = "full", feature = "derive"))]
668 #[cfg(feature = "full")]
669 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
670 fold_pat_wild(self, i)
671 }
672 #[cfg(any(feature = "full", feature = "derive"))]
673 fn fold_path(&mut self, i: Path) -> Path {
674 fold_path(self, i)
675 }
676 #[cfg(any(feature = "full", feature = "derive"))]
677 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
678 fold_path_arguments(self, i)
679 }
680 #[cfg(any(feature = "full", feature = "derive"))]
681 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
682 fold_path_segment(self, i)
683 }
684 #[cfg(any(feature = "full", feature = "derive"))]
685 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
686 fold_predicate_eq(self, i)
687 }
688 #[cfg(any(feature = "full", feature = "derive"))]
689 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
690 fold_predicate_lifetime(self, i)
691 }
692 #[cfg(any(feature = "full", feature = "derive"))]
693 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
694 fold_predicate_type(self, i)
695 }
696 #[cfg(any(feature = "full", feature = "derive"))]
697 fn fold_qself(&mut self, i: QSelf) -> QSelf {
698 fold_qself(self, i)
699 }
700 #[cfg(any(feature = "full", feature = "derive"))]
701 #[cfg(feature = "full")]
702 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
703 fold_range_limits(self, i)
704 }
705 #[cfg(any(feature = "full", feature = "derive"))]
706 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
707 fold_return_type(self, i)
708 }
David Tolnay8c81f622018-07-31 23:34:35 -0700709 fn fold_span(&mut self, i: Span) -> Span {
710 fold_span(self, i)
711 }
712 #[cfg(any(feature = "full", feature = "derive"))]
713 #[cfg(feature = "full")]
714 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
715 fold_stmt(self, i)
716 }
717 #[cfg(any(feature = "full", feature = "derive"))]
718 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
719 fold_trait_bound(self, i)
720 }
721 #[cfg(any(feature = "full", feature = "derive"))]
722 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
723 fold_trait_bound_modifier(self, i)
724 }
725 #[cfg(feature = "full")]
726 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
727 fold_trait_item(self, i)
728 }
729 #[cfg(feature = "full")]
730 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
731 fold_trait_item_const(self, i)
732 }
733 #[cfg(feature = "full")]
734 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
735 fold_trait_item_macro(self, i)
736 }
737 #[cfg(feature = "full")]
738 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
739 fold_trait_item_method(self, i)
740 }
741 #[cfg(feature = "full")]
742 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
743 fold_trait_item_type(self, i)
744 }
745 #[cfg(feature = "full")]
746 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
747 fold_trait_item_verbatim(self, i)
748 }
749 #[cfg(any(feature = "full", feature = "derive"))]
750 fn fold_type(&mut self, i: Type) -> Type {
751 fold_type(self, i)
752 }
753 #[cfg(any(feature = "full", feature = "derive"))]
754 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
755 fold_type_array(self, i)
756 }
757 #[cfg(any(feature = "full", feature = "derive"))]
758 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
759 fold_type_bare_fn(self, i)
760 }
761 #[cfg(any(feature = "full", feature = "derive"))]
762 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
763 fold_type_group(self, i)
764 }
765 #[cfg(any(feature = "full", feature = "derive"))]
766 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
767 fold_type_impl_trait(self, i)
768 }
769 #[cfg(any(feature = "full", feature = "derive"))]
770 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
771 fold_type_infer(self, i)
772 }
773 #[cfg(any(feature = "full", feature = "derive"))]
774 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
775 fold_type_macro(self, i)
776 }
777 #[cfg(any(feature = "full", feature = "derive"))]
778 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
779 fold_type_never(self, i)
780 }
781 #[cfg(any(feature = "full", feature = "derive"))]
782 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
783 fold_type_param(self, i)
784 }
785 #[cfg(any(feature = "full", feature = "derive"))]
786 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
787 fold_type_param_bound(self, i)
788 }
789 #[cfg(any(feature = "full", feature = "derive"))]
790 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
791 fold_type_paren(self, i)
792 }
793 #[cfg(any(feature = "full", feature = "derive"))]
794 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
795 fold_type_path(self, i)
796 }
797 #[cfg(any(feature = "full", feature = "derive"))]
798 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
799 fold_type_ptr(self, i)
800 }
801 #[cfg(any(feature = "full", feature = "derive"))]
802 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
803 fold_type_reference(self, i)
804 }
805 #[cfg(any(feature = "full", feature = "derive"))]
806 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
807 fold_type_slice(self, i)
808 }
809 #[cfg(any(feature = "full", feature = "derive"))]
810 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
811 fold_type_trait_object(self, i)
812 }
813 #[cfg(any(feature = "full", feature = "derive"))]
814 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
815 fold_type_tuple(self, i)
816 }
817 #[cfg(any(feature = "full", feature = "derive"))]
818 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
819 fold_type_verbatim(self, i)
820 }
821 #[cfg(any(feature = "full", feature = "derive"))]
822 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
823 fold_un_op(self, i)
824 }
825 #[cfg(feature = "full")]
826 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
827 fold_use_glob(self, i)
828 }
829 #[cfg(feature = "full")]
830 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
831 fold_use_group(self, i)
832 }
833 #[cfg(feature = "full")]
834 fn fold_use_name(&mut self, i: UseName) -> UseName {
835 fold_use_name(self, i)
836 }
837 #[cfg(feature = "full")]
838 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
839 fold_use_path(self, i)
840 }
841 #[cfg(feature = "full")]
842 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
843 fold_use_rename(self, i)
844 }
845 #[cfg(feature = "full")]
846 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
847 fold_use_tree(self, i)
848 }
849 #[cfg(any(feature = "full", feature = "derive"))]
850 fn fold_variant(&mut self, i: Variant) -> Variant {
851 fold_variant(self, i)
852 }
853 #[cfg(any(feature = "full", feature = "derive"))]
854 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
855 fold_vis_crate(self, i)
856 }
857 #[cfg(any(feature = "full", feature = "derive"))]
858 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
859 fold_vis_public(self, i)
860 }
861 #[cfg(any(feature = "full", feature = "derive"))]
862 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
863 fold_vis_restricted(self, i)
864 }
865 #[cfg(any(feature = "full", feature = "derive"))]
866 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
867 fold_visibility(self, i)
868 }
869 #[cfg(any(feature = "full", feature = "derive"))]
870 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
871 fold_where_clause(self, i)
872 }
873 #[cfg(any(feature = "full", feature = "derive"))]
874 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
875 fold_where_predicate(self, i)
876 }
Nika Layzell27726662017-10-24 23:16:35 -0400877}
David Tolnayd3f32142018-05-20 20:21:12 -0700878#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800879macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700880 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800881 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700882 let span = _visitor.fold_span(_i.span());
883 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800884 _i
885 }
David Tolnay8c81f622018-07-31 23:34:35 -0700886 };
David Tolnayd0adf522017-12-29 01:30:07 -0500887}
David Tolnay360efd22018-01-04 23:35:26 -0800888#[cfg(any(feature = "full", feature = "derive"))]
889fold_span_only!(fold_lit_byte: LitByte);
890#[cfg(any(feature = "full", feature = "derive"))]
891fold_span_only!(fold_lit_byte_str: LitByteStr);
892#[cfg(any(feature = "full", feature = "derive"))]
893fold_span_only!(fold_lit_char: LitChar);
894#[cfg(any(feature = "full", feature = "derive"))]
895fold_span_only!(fold_lit_float: LitFloat);
896#[cfg(any(feature = "full", feature = "derive"))]
897fold_span_only!(fold_lit_int: LitInt);
898#[cfg(any(feature = "full", feature = "derive"))]
899fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700900#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800901pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400902 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400903 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700904 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400905 }
906}
David Tolnay8c81f622018-07-31 23:34:35 -0700907#[cfg(any(feature = "full", feature = "derive"))]
908pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
909 _visitor: &mut V,
910 _i: AngleBracketedGenericArguments,
911) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500912 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400913 colon2_token: (_i.colon2_token)
914 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
915 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700916 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400917 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400918 }
919}
David Tolnay8c81f622018-07-31 23:34:35 -0700920#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800921pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400922 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700923 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400924 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700925 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400926 }
927}
David Tolnay8c81f622018-07-31 23:34:35 -0700928#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800929pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400930 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400931 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
932 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400933 }
934}
David Tolnay8c81f622018-07-31 23:34:35 -0700935#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800936pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400937 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400938 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700939 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400940 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
941 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400942 }
943}
David Tolnay8c81f622018-07-31 23:34:35 -0700944#[cfg(any(feature = "full", feature = "derive"))]
945#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800946pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400947 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700948 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400949 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700950 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
951 guard: (_i.guard).map(|it| {
952 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400953 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700954 Box::new(_visitor.fold_expr(*(it).1)),
955 )
956 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400957 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700958 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400959 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400960 }
961}
David Tolnay8c81f622018-07-31 23:34:35 -0700962#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800963pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400964 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700965 AttrStyle::Outer => AttrStyle::Outer,
966 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400967 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400968 }
969 }
970}
David Tolnay8c81f622018-07-31 23:34:35 -0700971#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800972pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400973 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400974 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700975 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400976 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700977 path: _visitor.fold_path(_i.path),
978 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400979 }
980}
David Tolnay8c81f622018-07-31 23:34:35 -0700981#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800982pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400983 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700984 name: (_i.name).map(|it| {
985 (
986 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400987 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700988 )
989 }),
990 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400991 }
992}
David Tolnay8c81f622018-07-31 23:34:35 -0700993#[cfg(any(feature = "full", feature = "derive"))]
994pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
995 _visitor: &mut V,
996 _i: BareFnArgName,
997) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400998 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700999 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
1000 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001001 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001002 }
1003 }
1004}
David Tolnay8c81f622018-07-31 23:34:35 -07001005#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001006pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -04001007 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001008 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001009 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001010 }
David Tolnay8c81f622018-07-31 23:34:35 -07001011 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001012 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001013 }
David Tolnay8c81f622018-07-31 23:34:35 -07001014 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001015 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001016 }
David Tolnay8c81f622018-07-31 23:34:35 -07001017 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001018 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001019 }
David Tolnay8c81f622018-07-31 23:34:35 -07001020 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001021 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001022 }
David Tolnay8c81f622018-07-31 23:34:35 -07001023 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001024 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001025 }
David Tolnay8c81f622018-07-31 23:34:35 -07001026 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001027 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001028 }
David Tolnay8c81f622018-07-31 23:34:35 -07001029 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001030 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001031 }
David Tolnay8c81f622018-07-31 23:34:35 -07001032 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001033 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001034 }
David Tolnay8c81f622018-07-31 23:34:35 -07001035 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001036 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001037 }
David Tolnay8c81f622018-07-31 23:34:35 -07001038 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001039 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001040 }
David Tolnay8c81f622018-07-31 23:34:35 -07001041 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001042 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001043 }
David Tolnay8c81f622018-07-31 23:34:35 -07001044 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001045 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001046 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001047 BinOp::Lt(_binding_0) => {
1048 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1049 }
David Tolnay8c81f622018-07-31 23:34:35 -07001050 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001051 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001052 }
David Tolnay8c81f622018-07-31 23:34:35 -07001053 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001054 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001055 }
David Tolnay8c81f622018-07-31 23:34:35 -07001056 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001057 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001058 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001059 BinOp::Gt(_binding_0) => {
1060 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1061 }
David Tolnay8c81f622018-07-31 23:34:35 -07001062 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001063 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001064 }
David Tolnay8c81f622018-07-31 23:34:35 -07001065 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001066 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001067 }
David Tolnay8c81f622018-07-31 23:34:35 -07001068 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001069 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001070 }
David Tolnay8c81f622018-07-31 23:34:35 -07001071 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001072 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001073 }
David Tolnay8c81f622018-07-31 23:34:35 -07001074 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001075 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001076 }
David Tolnay8c81f622018-07-31 23:34:35 -07001077 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001078 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001079 }
David Tolnay8c81f622018-07-31 23:34:35 -07001080 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001081 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001082 }
David Tolnay8c81f622018-07-31 23:34:35 -07001083 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001084 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001085 }
David Tolnay8c81f622018-07-31 23:34:35 -07001086 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001087 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001088 }
David Tolnay8c81f622018-07-31 23:34:35 -07001089 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001090 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001091 }
1092 }
1093}
David Tolnay8c81f622018-07-31 23:34:35 -07001094#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001095pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001096 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001097 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001098 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001099 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001100 }
1101}
David Tolnay8c81f622018-07-31 23:34:35 -07001102#[cfg(any(feature = "full", feature = "derive"))]
1103#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001104pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001105 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001106 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001107 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001108 }
1109}
David Tolnay8c81f622018-07-31 23:34:35 -07001110#[cfg(any(feature = "full", feature = "derive"))]
1111pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1112 _visitor: &mut V,
1113 _i: BoundLifetimes,
1114) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001115 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001116 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1117 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001118 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001119 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001120 }
1121}
David Tolnay8c81f622018-07-31 23:34:35 -07001122#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001123pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001124 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001125 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001126 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001127 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001128 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001129 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001130 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001131 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001132 }
1133}
David Tolnay8c81f622018-07-31 23:34:35 -07001134#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001135pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001136 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001137 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1138 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1139 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001140 }
1141}
David Tolnay8c81f622018-07-31 23:34:35 -07001142#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001143pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001144 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001145 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1146 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001147 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001148 }
1149}
David Tolnay8c81f622018-07-31 23:34:35 -07001150#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001151pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001152 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001153 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001154 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001155 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001156 }
1157}
David Tolnay8c81f622018-07-31 23:34:35 -07001158#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001159pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001160 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001161 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001162 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001163 }
1164}
David Tolnay8c81f622018-07-31 23:34:35 -07001165#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001166pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001167 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001168 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1169 vis: _visitor.fold_visibility(_i.vis),
1170 ident: _visitor.fold_ident(_i.ident),
1171 generics: _visitor.fold_generics(_i.generics),
1172 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001173 }
1174}
David Tolnay8c81f622018-07-31 23:34:35 -07001175#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001176pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001177 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001178 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1179 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1180 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1181 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1182 Expr::MethodCall(_binding_0) => {
1183 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001184 }
David Tolnay8c81f622018-07-31 23:34:35 -07001185 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1186 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1187 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1188 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1189 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1190 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
1191 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
1192 Expr::IfLet(_binding_0) => Expr::IfLet(full!(_visitor.fold_expr_if_let(_binding_0))),
1193 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
1194 Expr::WhileLet(_binding_0) => {
1195 Expr::WhileLet(full!(_visitor.fold_expr_while_let(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001196 }
David Tolnay8c81f622018-07-31 23:34:35 -07001197 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1198 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1199 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1200 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1201 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1202 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1203 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1204 Expr::AssignOp(_binding_0) => {
1205 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001206 }
David Tolnay8c81f622018-07-31 23:34:35 -07001207 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1208 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1209 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1210 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1211 Expr::Reference(_binding_0) => {
1212 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001213 }
David Tolnay8c81f622018-07-31 23:34:35 -07001214 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1215 Expr::Continue(_binding_0) => {
1216 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001217 }
David Tolnay8c81f622018-07-31 23:34:35 -07001218 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1219 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1220 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1221 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1222 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1223 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1224 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001225 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001226 Expr::TryBlock(_binding_0) => {
1227 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1228 }
David Tolnay8c81f622018-07-31 23:34:35 -07001229 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1230 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001231 }
1232}
David Tolnay8c81f622018-07-31 23:34:35 -07001233#[cfg(feature = "full")]
1234#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001235pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001236 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001237 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001238 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001239 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001240 }
1241}
David Tolnay8c81f622018-07-31 23:34:35 -07001242#[cfg(feature = "full")]
1243#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001244pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001245 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001246 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1247 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001248 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001249 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001250 }
1251}
David Tolnay8c81f622018-07-31 23:34:35 -07001252#[cfg(feature = "full")]
1253#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001254pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001255 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001256 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1257 left: Box::new(_visitor.fold_expr(*_i.left)),
1258 op: _visitor.fold_bin_op(_i.op),
1259 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001260 }
1261}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001262#[cfg(feature = "full")]
1263#[cfg(any(feature = "full", feature = "derive"))]
1264pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1265 ExprAsync {
1266 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1267 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
1268 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1269 block: _visitor.fold_block(_i.block),
1270 }
1271}
David Tolnay8c81f622018-07-31 23:34:35 -07001272#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001273pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001274 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001275 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1276 left: Box::new(_visitor.fold_expr(*_i.left)),
1277 op: _visitor.fold_bin_op(_i.op),
1278 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001279 }
1280}
David Tolnay8c81f622018-07-31 23:34:35 -07001281#[cfg(feature = "full")]
1282#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001283pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001284 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001285 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001286 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001287 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001288 }
1289}
David Tolnay8c81f622018-07-31 23:34:35 -07001290#[cfg(feature = "full")]
1291#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001292pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001293 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001294 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001295 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001296 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001297 }
1298}
David Tolnay8c81f622018-07-31 23:34:35 -07001299#[cfg(feature = "full")]
1300#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001301pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001302 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001303 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001304 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001305 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1306 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001307 }
1308}
David Tolnay8c81f622018-07-31 23:34:35 -07001309#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001310pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001311 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001312 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1313 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001314 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001315 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001316 }
1317}
David Tolnay8c81f622018-07-31 23:34:35 -07001318#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001319pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001320 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001321 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1322 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001323 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001324 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001325 }
1326}
David Tolnay8c81f622018-07-31 23:34:35 -07001327#[cfg(feature = "full")]
1328#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001329pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001330 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001331 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001332 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001333 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1334 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1335 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001336 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001337 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001338 output: _visitor.fold_return_type(_i.output),
1339 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001340 }
1341}
David Tolnay8c81f622018-07-31 23:34:35 -07001342#[cfg(feature = "full")]
1343#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001344pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001345 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001346 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001347 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001348 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001349 }
1350}
David Tolnay8c81f622018-07-31 23:34:35 -07001351#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001352pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001353 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001354 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1355 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001356 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001357 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001358 }
1359}
David Tolnay8c81f622018-07-31 23:34:35 -07001360#[cfg(feature = "full")]
1361#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001362pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001363 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001364 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1365 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001366 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001367 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001368 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001369 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1370 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001371 }
1372}
David Tolnay8c81f622018-07-31 23:34:35 -07001373#[cfg(feature = "full")]
1374#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001375pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001376 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001377 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001378 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001379 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001380 }
1381}
David Tolnay8c81f622018-07-31 23:34:35 -07001382#[cfg(feature = "full")]
1383#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001384pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001385 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001386 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001387 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001388 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1389 then_branch: _visitor.fold_block(_i.then_branch),
1390 else_branch: (_i.else_branch).map(|it| {
1391 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001392 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001393 Box::new(_visitor.fold_expr(*(it).1)),
1394 )
1395 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001396 }
1397}
David Tolnay8c81f622018-07-31 23:34:35 -07001398#[cfg(feature = "full")]
1399#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001400pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001401 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001402 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001403 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
1404 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001405 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001406 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001407 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1408 then_branch: _visitor.fold_block(_i.then_branch),
1409 else_branch: (_i.else_branch).map(|it| {
1410 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001411 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001412 Box::new(_visitor.fold_expr(*(it).1)),
1413 )
1414 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001415 }
1416}
David Tolnay8c81f622018-07-31 23:34:35 -07001417#[cfg(feature = "full")]
1418#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001419pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001420 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001421 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1422 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001423 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001424 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001425 }
1426}
David Tolnay8c81f622018-07-31 23:34:35 -07001427#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001428pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001429 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001430 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1431 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001432 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001433 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001434 }
1435}
David Tolnay8c81f622018-07-31 23:34:35 -07001436#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001437pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001438 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001439 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1440 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001441 }
1442}
David Tolnay8c81f622018-07-31 23:34:35 -07001443#[cfg(feature = "full")]
1444#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001445pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001446 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001447 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1448 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001449 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001450 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001451 }
1452}
David Tolnay8c81f622018-07-31 23:34:35 -07001453#[cfg(feature = "full")]
1454#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001455pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001456 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001457 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1458 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001459 }
1460}
David Tolnay8c81f622018-07-31 23:34:35 -07001461#[cfg(feature = "full")]
1462#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001463pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001464 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001465 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001466 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001467 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001468 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001469 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001470 }
1471}
David Tolnay8c81f622018-07-31 23:34:35 -07001472#[cfg(feature = "full")]
1473#[cfg(any(feature = "full", feature = "derive"))]
1474pub fn fold_expr_method_call<V: Fold + ?Sized>(
1475 _visitor: &mut V,
1476 _i: ExprMethodCall,
1477) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001478 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001479 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1480 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001481 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001482 method: _visitor.fold_ident(_i.method),
1483 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001484 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001485 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001486 }
1487}
David Tolnay8c81f622018-07-31 23:34:35 -07001488#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001489pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001490 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001491 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001492 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001493 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001494 }
1495}
David Tolnay8c81f622018-07-31 23:34:35 -07001496#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001497pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001498 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001499 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1500 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1501 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001502 }
1503}
David Tolnay8c81f622018-07-31 23:34:35 -07001504#[cfg(feature = "full")]
1505#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001506pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001507 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001508 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1509 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1510 limits: _visitor.fold_range_limits(_i.limits),
1511 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001512 }
1513}
David Tolnay8c81f622018-07-31 23:34:35 -07001514#[cfg(feature = "full")]
1515#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001516pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1517 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001518 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001519 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1520 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001521 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001522 }
1523}
David Tolnay8c81f622018-07-31 23:34:35 -07001524#[cfg(feature = "full")]
1525#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001526pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001527 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001528 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001529 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001530 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001531 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001532 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001533 }
1534}
David Tolnay8c81f622018-07-31 23:34:35 -07001535#[cfg(feature = "full")]
1536#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001537pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001538 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001539 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001540 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001541 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001542 }
1543}
David Tolnay8c81f622018-07-31 23:34:35 -07001544#[cfg(feature = "full")]
1545#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001546pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001547 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001548 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1549 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001550 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001551 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001552 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001553 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001554 }
1555}
David Tolnay8c81f622018-07-31 23:34:35 -07001556#[cfg(feature = "full")]
1557#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001558pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001559 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001560 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1561 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001562 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001563 }
1564}
David Tolnay8c81f622018-07-31 23:34:35 -07001565#[cfg(feature = "full")]
1566#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001567pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1568 ExprTryBlock {
1569 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1570 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1571 block: _visitor.fold_block(_i.block),
1572 }
1573}
1574#[cfg(feature = "full")]
1575#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001576pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001577 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001578 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001579 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001580 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001581 }
1582}
David Tolnay8c81f622018-07-31 23:34:35 -07001583#[cfg(feature = "full")]
1584#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001585pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001586 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001587 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1588 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001589 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001590 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001591 }
1592}
David Tolnay8c81f622018-07-31 23:34:35 -07001593#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001594pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001595 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001596 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1597 op: _visitor.fold_un_op(_i.op),
1598 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001599 }
1600}
David Tolnay8c81f622018-07-31 23:34:35 -07001601#[cfg(feature = "full")]
1602#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001603pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001604 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001605 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001606 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001607 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001608 }
1609}
David Tolnay8c81f622018-07-31 23:34:35 -07001610#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001611pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001612 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001613}
David Tolnay8c81f622018-07-31 23:34:35 -07001614#[cfg(feature = "full")]
1615#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001616pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001617 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001618 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1619 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001620 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001621 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1622 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001623 }
1624}
David Tolnay8c81f622018-07-31 23:34:35 -07001625#[cfg(feature = "full")]
1626#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001627pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001628 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001629 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1630 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001631 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
1632 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001633 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001634 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001635 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1636 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001637 }
1638}
David Tolnay8c81f622018-07-31 23:34:35 -07001639#[cfg(feature = "full")]
1640#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001641pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001642 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001643 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001644 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001645 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001646 }
1647}
David Tolnay8c81f622018-07-31 23:34:35 -07001648#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001649pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001650 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001651 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1652 vis: _visitor.fold_visibility(_i.vis),
1653 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001654 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001655 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001656 }
1657}
David Tolnay8c81f622018-07-31 23:34:35 -07001658#[cfg(any(feature = "full", feature = "derive"))]
1659#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001660pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001661 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001662 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1663 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001664 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001665 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001666 }
1667}
David Tolnay8c81f622018-07-31 23:34:35 -07001668#[cfg(any(feature = "full", feature = "derive"))]
1669#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001670pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001671 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001672 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1673 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001674 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001675 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001676 }
1677}
David Tolnay8c81f622018-07-31 23:34:35 -07001678#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001679pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001680 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001681 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1682 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1683 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001684 }
1685}
David Tolnay8c81f622018-07-31 23:34:35 -07001686#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001687pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001688 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001689 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001690 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001691 }
1692}
David Tolnay8c81f622018-07-31 23:34:35 -07001693#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001694pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001695 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001696 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001697 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001698 }
1699}
David Tolnay8c81f622018-07-31 23:34:35 -07001700#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001701pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001702 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001703 shebang: _i.shebang,
1704 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1705 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001706 }
1707}
David Tolnay8c81f622018-07-31 23:34:35 -07001708#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001709pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001710 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001711 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1712 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1713 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1714 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1715 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001716 }
1717}
David Tolnay8c81f622018-07-31 23:34:35 -07001718#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001719pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001720 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001721 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001722 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001723 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001724 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001725 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001726 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001727 }
1728}
David Tolnay8c81f622018-07-31 23:34:35 -07001729#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001730pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001731 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001732 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1733 ForeignItem::Static(_binding_0) => {
1734 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001735 }
David Tolnay8c81f622018-07-31 23:34:35 -07001736 ForeignItem::Type(_binding_0) => {
1737 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001738 }
David Tolnay435c1782018-08-24 16:15:44 -04001739 ForeignItem::Macro(_binding_0) => {
1740 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1741 }
David Tolnay8c81f622018-07-31 23:34:35 -07001742 ForeignItem::Verbatim(_binding_0) => {
1743 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001744 }
Nika Layzell27726662017-10-24 23:16:35 -04001745 }
1746}
David Tolnay8c81f622018-07-31 23:34:35 -07001747#[cfg(feature = "full")]
1748pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1749 _visitor: &mut V,
1750 _i: ForeignItemFn,
1751) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001752 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001753 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1754 vis: _visitor.fold_visibility(_i.vis),
1755 ident: _visitor.fold_ident(_i.ident),
1756 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001757 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001758 }
1759}
David Tolnay8c81f622018-07-31 23:34:35 -07001760#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001761pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1762 _visitor: &mut V,
1763 _i: ForeignItemMacro,
1764) -> ForeignItemMacro {
1765 ForeignItemMacro {
1766 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1767 mac: _visitor.fold_macro(_i.mac),
1768 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1769 }
1770}
1771#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001772pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1773 _visitor: &mut V,
1774 _i: ForeignItemStatic,
1775) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001776 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001777 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1778 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001779 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1780 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001781 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001782 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001783 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001784 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001785 }
1786}
David Tolnay8c81f622018-07-31 23:34:35 -07001787#[cfg(feature = "full")]
1788pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1789 _visitor: &mut V,
1790 _i: ForeignItemType,
1791) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001792 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001793 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1794 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001795 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001796 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001797 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001798 }
1799}
David Tolnay8c81f622018-07-31 23:34:35 -07001800#[cfg(feature = "full")]
1801pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1802 _visitor: &mut V,
1803 _i: ForeignItemVerbatim,
1804) -> ForeignItemVerbatim {
1805 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001806}
David Tolnay8c81f622018-07-31 23:34:35 -07001807#[cfg(any(feature = "full", feature = "derive"))]
1808pub fn fold_generic_argument<V: Fold + ?Sized>(
1809 _visitor: &mut V,
1810 _i: GenericArgument,
1811) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001812 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001813 GenericArgument::Lifetime(_binding_0) => {
1814 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001815 }
David Tolnay8c81f622018-07-31 23:34:35 -07001816 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1817 GenericArgument::Binding(_binding_0) => {
1818 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001819 }
David Tolnay8c81f622018-07-31 23:34:35 -07001820 GenericArgument::Const(_binding_0) => {
1821 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001822 }
Nika Layzell357885a2017-12-04 15:47:07 -05001823 }
1824}
David Tolnay8c81f622018-07-31 23:34:35 -07001825#[cfg(any(feature = "full", feature = "derive"))]
1826#[cfg(feature = "full")]
1827pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1828 _visitor: &mut V,
1829 _i: GenericMethodArgument,
1830) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001831 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001832 GenericMethodArgument::Type(_binding_0) => {
1833 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001834 }
David Tolnay8c81f622018-07-31 23:34:35 -07001835 GenericMethodArgument::Const(_binding_0) => {
1836 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001837 }
1838 }
1839}
David Tolnay8c81f622018-07-31 23:34:35 -07001840#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001841pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001842 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001843 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1844 GenericParam::Lifetime(_binding_0) => {
1845 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001846 }
David Tolnay8c81f622018-07-31 23:34:35 -07001847 GenericParam::Const(_binding_0) => {
1848 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001849 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001850 }
1851}
David Tolnay8c81f622018-07-31 23:34:35 -07001852#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001853pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001854 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001855 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001856 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001857 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001858 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001859 }
1860}
Alex Crichtond261d092018-05-18 13:47:35 -07001861pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001862 let mut _i = _i;
1863 let span = _visitor.fold_span(_i.span());
1864 _i.set_span(span);
1865 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001866}
David Tolnay8c81f622018-07-31 23:34:35 -07001867#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001868pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001869 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001870 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1871 ImplItem::Method(_binding_0) => {
1872 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001873 }
David Tolnay8c81f622018-07-31 23:34:35 -07001874 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001875 ImplItem::Existential(_binding_0) => {
1876 ImplItem::Existential(_visitor.fold_impl_item_existential(_binding_0))
1877 }
David Tolnay8c81f622018-07-31 23:34:35 -07001878 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1879 ImplItem::Verbatim(_binding_0) => {
1880 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001881 }
Nika Layzell27726662017-10-24 23:16:35 -04001882 }
1883}
David Tolnay8c81f622018-07-31 23:34:35 -07001884#[cfg(feature = "full")]
1885pub fn fold_impl_item_const<V: Fold + ?Sized>(
1886 _visitor: &mut V,
1887 _i: ImplItemConst,
1888) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001889 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001890 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1891 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001892 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1893 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001894 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001895 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001896 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001897 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001898 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001899 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001900 }
1901}
David Tolnay8c81f622018-07-31 23:34:35 -07001902#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001903pub fn fold_impl_item_existential<V: Fold + ?Sized>(
1904 _visitor: &mut V,
1905 _i: ImplItemExistential,
1906) -> ImplItemExistential {
1907 ImplItemExistential {
1908 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1909 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
1910 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
1911 ident: _visitor.fold_ident(_i.ident),
1912 generics: _visitor.fold_generics(_i.generics),
1913 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1914 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1915 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1916 }
1917}
1918#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001919pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1920 _visitor: &mut V,
1921 _i: ImplItemMacro,
1922) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001923 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001924 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1925 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001926 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001927 }
1928}
David Tolnay8c81f622018-07-31 23:34:35 -07001929#[cfg(feature = "full")]
1930pub fn fold_impl_item_method<V: Fold + ?Sized>(
1931 _visitor: &mut V,
1932 _i: ImplItemMethod,
1933) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001934 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001935 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1936 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001937 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001938 sig: _visitor.fold_method_sig(_i.sig),
1939 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001940 }
1941}
David Tolnay8c81f622018-07-31 23:34:35 -07001942#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001943pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001944 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001945 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1946 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001947 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1948 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001949 ident: _visitor.fold_ident(_i.ident),
1950 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001951 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001952 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001953 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001954 }
1955}
David Tolnay8c81f622018-07-31 23:34:35 -07001956#[cfg(feature = "full")]
1957pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1958 _visitor: &mut V,
1959 _i: ImplItemVerbatim,
1960) -> ImplItemVerbatim {
1961 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001962}
David Tolnay8c81f622018-07-31 23:34:35 -07001963#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001964pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001965 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001966 index: _i.index,
1967 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001968 }
1969}
David Tolnay8c81f622018-07-31 23:34:35 -07001970#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001971pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001972 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001973 Item::ExternCrate(_binding_0) => {
1974 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001975 }
David Tolnay8c81f622018-07-31 23:34:35 -07001976 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1977 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1978 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1979 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1980 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1981 Item::ForeignMod(_binding_0) => {
1982 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001983 }
David Tolnay8c81f622018-07-31 23:34:35 -07001984 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001985 Item::Existential(_binding_0) => {
1986 Item::Existential(_visitor.fold_item_existential(_binding_0))
1987 }
David Tolnay8c81f622018-07-31 23:34:35 -07001988 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1989 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1990 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1991 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07001992 Item::TraitAlias(_binding_0) => {
1993 Item::TraitAlias(_visitor.fold_item_trait_alias(_binding_0))
1994 }
David Tolnay8c81f622018-07-31 23:34:35 -07001995 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1996 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1997 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1998 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001999 }
2000}
David Tolnay8c81f622018-07-31 23:34:35 -07002001#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002002pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002003 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002004 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2005 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002006 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002007 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002008 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002009 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002010 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002011 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002012 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002013 }
2014}
David Tolnay8c81f622018-07-31 23:34:35 -07002015#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002016pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002017 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07002018 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2019 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002020 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002021 ident: _visitor.fold_ident(_i.ident),
2022 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002023 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002024 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002025 }
2026}
David Tolnay8c81f622018-07-31 23:34:35 -07002027#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04002028pub fn fold_item_existential<V: Fold + ?Sized>(
2029 _visitor: &mut V,
2030 _i: ItemExistential,
2031) -> ItemExistential {
2032 ItemExistential {
2033 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2034 vis: _visitor.fold_visibility(_i.vis),
2035 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
2036 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
2037 ident: _visitor.fold_ident(_i.ident),
2038 generics: _visitor.fold_generics(_i.generics),
2039 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
2040 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2041 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2042 }
2043}
2044#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07002045pub fn fold_item_extern_crate<V: Fold + ?Sized>(
2046 _visitor: &mut V,
2047 _i: ItemExternCrate,
2048) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002049 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07002050 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2051 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002052 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
2053 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002054 ident: _visitor.fold_ident(_i.ident),
2055 rename: (_i.rename).map(|it| {
2056 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002057 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002058 _visitor.fold_ident((it).1),
2059 )
2060 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002061 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002062 }
2063}
David Tolnay8c81f622018-07-31 23:34:35 -07002064#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002065pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002066 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07002067 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2068 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002069 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2070 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002071 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002072 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2073 ident: _visitor.fold_ident(_i.ident),
2074 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2075 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002076 }
2077}
David Tolnay8c81f622018-07-31 23:34:35 -07002078#[cfg(feature = "full")]
2079pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2080 _visitor: &mut V,
2081 _i: ItemForeignMod,
2082) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002083 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002084 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2085 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002086 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002087 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002088 }
2089}
David Tolnay8c81f622018-07-31 23:34:35 -07002090#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002091pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002092 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002093 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002094 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2095 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2096 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002097 generics: _visitor.fold_generics(_i.generics),
2098 trait_: (_i.trait_).map(|it| {
2099 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002100 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002101 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002102 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002103 )
2104 }),
2105 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002106 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002107 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002108 }
2109}
David Tolnay8c81f622018-07-31 23:34:35 -07002110#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002111pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002112 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002113 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2114 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2115 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002116 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002117 }
2118}
David Tolnay8c81f622018-07-31 23:34:35 -07002119#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002120pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002121 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002122 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2123 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002124 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002125 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002126 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002127 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002128 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002129 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002130 }
2131}
David Tolnay8c81f622018-07-31 23:34:35 -07002132#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002133pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002134 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002135 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2136 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002137 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002138 ident: _visitor.fold_ident(_i.ident),
2139 content: (_i.content).map(|it| {
2140 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002141 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002142 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2143 )
2144 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002145 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002146 }
2147}
David Tolnay8c81f622018-07-31 23:34:35 -07002148#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002149pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002150 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002151 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2152 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002153 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2154 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002155 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002156 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002157 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002158 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002159 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002160 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002161 }
2162}
David Tolnay8c81f622018-07-31 23:34:35 -07002163#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002164pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002165 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002166 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2167 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002168 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002169 ident: _visitor.fold_ident(_i.ident),
2170 generics: _visitor.fold_generics(_i.generics),
2171 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002172 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002173 }
2174}
David Tolnay8c81f622018-07-31 23:34:35 -07002175#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002176pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002177 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002178 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2179 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002180 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2181 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2182 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002183 ident: _visitor.fold_ident(_i.ident),
2184 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002185 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002186 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002187 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002188 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002189 }
2190}
David Tolnay8c81f622018-07-31 23:34:35 -07002191#[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -07002192pub fn fold_item_trait_alias<V: Fold + ?Sized>(
2193 _visitor: &mut V,
2194 _i: ItemTraitAlias,
2195) -> ItemTraitAlias {
2196 ItemTraitAlias {
2197 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2198 vis: _visitor.fold_visibility(_i.vis),
2199 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
2200 ident: _visitor.fold_ident(_i.ident),
2201 generics: _visitor.fold_generics(_i.generics),
2202 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
2203 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2204 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2205 }
2206}
2207#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002208pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002209 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002210 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2211 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002212 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002213 ident: _visitor.fold_ident(_i.ident),
2214 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002215 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002216 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002217 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002218 }
2219}
David Tolnay8c81f622018-07-31 23:34:35 -07002220#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002221pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002222 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002223 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2224 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002225 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002226 ident: _visitor.fold_ident(_i.ident),
2227 generics: _visitor.fold_generics(_i.generics),
2228 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002229 }
2230}
David Tolnay8c81f622018-07-31 23:34:35 -07002231#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002232pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002233 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002234 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2235 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002236 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002237 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002238 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002239 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002240 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002241 }
2242}
David Tolnay8c81f622018-07-31 23:34:35 -07002243#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002244pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002245 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002246}
David Tolnay8c81f622018-07-31 23:34:35 -07002247#[cfg(any(feature = "full", feature = "derive"))]
2248#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002249pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002250 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002251 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002252 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002253 }
2254}
Alex Crichton131308c2018-05-18 14:00:24 -07002255pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2256 Lifetime {
David Tolnay17f63892018-08-31 10:36:32 -07002257 apostrophe: _visitor.fold_span(_i.apostrophe),
David Tolnay8c81f622018-07-31 23:34:35 -07002258 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002259 }
2260}
David Tolnay8c81f622018-07-31 23:34:35 -07002261#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002262pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002263 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002264 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2265 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002266 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002267 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002268 }
2269}
David Tolnay8c81f622018-07-31 23:34:35 -07002270#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002271pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002272 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002273 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2274 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2275 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2276 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2277 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2278 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2279 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2280 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002281 }
2282}
David Tolnay8c81f622018-07-31 23:34:35 -07002283#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002284pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002285 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002286 value: _i.value,
2287 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002288 }
2289}
David Tolnay8c81f622018-07-31 23:34:35 -07002290#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002291pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002292 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002293}
David Tolnay8c81f622018-07-31 23:34:35 -07002294#[cfg(any(feature = "full", feature = "derive"))]
2295#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002296pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002297 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002298 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002299 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002300 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2301 ty: (_i.ty).map(|it| {
2302 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002303 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002304 Box::new(_visitor.fold_type(*(it).1)),
2305 )
2306 }),
2307 init: (_i.init).map(|it| {
2308 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002309 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002310 Box::new(_visitor.fold_expr(*(it).1)),
2311 )
2312 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002313 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002314 }
2315}
David Tolnay8c81f622018-07-31 23:34:35 -07002316#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002317pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002318 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002319 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002320 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002321 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2322 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002323 }
2324}
David Tolnay8c81f622018-07-31 23:34:35 -07002325#[cfg(any(feature = "full", feature = "derive"))]
2326pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2327 _visitor: &mut V,
2328 _i: MacroDelimiter,
2329) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002330 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002331 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002332 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002333 }
David Tolnay8c81f622018-07-31 23:34:35 -07002334 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002335 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002336 }
David Tolnay8c81f622018-07-31 23:34:35 -07002337 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002338 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002339 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002340 }
2341}
David Tolnay8c81f622018-07-31 23:34:35 -07002342#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002343pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002344 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002345 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2346 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002347 }
2348}
David Tolnay8c81f622018-07-31 23:34:35 -07002349#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002350pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002351 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002352 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2353 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2354 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002355 }
2356}
David Tolnay8c81f622018-07-31 23:34:35 -07002357#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002358pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2359 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002360 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002361 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002362 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002363 }
2364}
David Tolnay8c81f622018-07-31 23:34:35 -07002365#[cfg(any(feature = "full", feature = "derive"))]
2366pub fn fold_meta_name_value<V: Fold + ?Sized>(
2367 _visitor: &mut V,
2368 _i: MetaNameValue,
2369) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002370 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002371 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002372 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002373 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002374 }
2375}
David Tolnay8c81f622018-07-31 23:34:35 -07002376#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002377pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002378 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002379 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2380 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002381 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002382 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2383 ident: _visitor.fold_ident(_i.ident),
2384 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002385 }
2386}
David Tolnay8c81f622018-07-31 23:34:35 -07002387#[cfg(any(feature = "full", feature = "derive"))]
2388#[cfg(feature = "full")]
2389pub fn fold_method_turbofish<V: Fold + ?Sized>(
2390 _visitor: &mut V,
2391 _i: MethodTurbofish,
2392) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002393 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002394 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2395 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002396 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002397 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002398 }
2399}
David Tolnay8c81f622018-07-31 23:34:35 -07002400#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002401pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002402 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002403 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2404 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002405 }
2406}
David Tolnay8c81f622018-07-31 23:34:35 -07002407#[cfg(any(feature = "full", feature = "derive"))]
2408pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2409 _visitor: &mut V,
2410 _i: ParenthesizedGenericArguments,
2411) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002412 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002413 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002414 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2415 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002416 }
2417}
David Tolnay8c81f622018-07-31 23:34:35 -07002418#[cfg(any(feature = "full", feature = "derive"))]
2419#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002420pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002421 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002422 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2423 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2424 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2425 Pat::TupleStruct(_binding_0) => {
2426 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002427 }
David Tolnay8c81f622018-07-31 23:34:35 -07002428 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2429 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2430 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2431 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2432 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2433 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2434 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2435 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2436 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002437 }
2438}
David Tolnay8c81f622018-07-31 23:34:35 -07002439#[cfg(any(feature = "full", feature = "derive"))]
2440#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002441pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002442 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002443 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002444 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002445 }
2446}
David Tolnay8c81f622018-07-31 23:34:35 -07002447#[cfg(any(feature = "full", feature = "derive"))]
2448#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002449pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002450 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002451 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2452 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002453 ident: _visitor.fold_ident(_i.ident),
2454 subpat: (_i.subpat).map(|it| {
2455 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002456 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002457 Box::new(_visitor.fold_pat(*(it).1)),
2458 )
2459 }),
Nika Layzell27726662017-10-24 23:16:35 -04002460 }
2461}
David Tolnay8c81f622018-07-31 23:34:35 -07002462#[cfg(any(feature = "full", feature = "derive"))]
2463#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002464pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002465 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002466 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002467 }
2468}
David Tolnay8c81f622018-07-31 23:34:35 -07002469#[cfg(any(feature = "full", feature = "derive"))]
2470#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002471pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002472 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002473 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002474 }
2475}
David Tolnay8c81f622018-07-31 23:34:35 -07002476#[cfg(any(feature = "full", feature = "derive"))]
2477#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002478pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002479 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002480 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2481 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002482 }
2483}
David Tolnay8c81f622018-07-31 23:34:35 -07002484#[cfg(any(feature = "full", feature = "derive"))]
2485#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002486pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002487 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002488 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2489 limits: _visitor.fold_range_limits(_i.limits),
2490 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002491 }
2492}
David Tolnay8c81f622018-07-31 23:34:35 -07002493#[cfg(any(feature = "full", feature = "derive"))]
2494#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002495pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002496 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002497 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2498 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002499 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002500 }
2501}
David Tolnay8c81f622018-07-31 23:34:35 -07002502#[cfg(any(feature = "full", feature = "derive"))]
2503#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002504pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002505 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002506 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002507 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2508 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002509 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2510 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002511 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002512 }
2513}
David Tolnay8c81f622018-07-31 23:34:35 -07002514#[cfg(any(feature = "full", feature = "derive"))]
2515#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002516pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002517 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002518 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002519 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002520 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002521 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002522 }
2523}
David Tolnay8c81f622018-07-31 23:34:35 -07002524#[cfg(any(feature = "full", feature = "derive"))]
2525#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002526pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002527 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002528 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002529 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002530 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2531 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002532 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002533 }
2534}
David Tolnay8c81f622018-07-31 23:34:35 -07002535#[cfg(any(feature = "full", feature = "derive"))]
2536#[cfg(feature = "full")]
2537pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2538 _visitor: &mut V,
2539 _i: PatTupleStruct,
2540) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002541 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002542 path: _visitor.fold_path(_i.path),
2543 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002544 }
2545}
David Tolnay8c81f622018-07-31 23:34:35 -07002546#[cfg(any(feature = "full", feature = "derive"))]
2547#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002548pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002549 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002550}
David Tolnay8c81f622018-07-31 23:34:35 -07002551#[cfg(any(feature = "full", feature = "derive"))]
2552#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002553pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002554 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002555 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002556 }
2557}
David Tolnay8c81f622018-07-31 23:34:35 -07002558#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002559pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002560 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002561 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002562 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002563 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002564 }
2565}
David Tolnay8c81f622018-07-31 23:34:35 -07002566#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002567pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002568 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002569 PathArguments::None => PathArguments::None,
2570 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2571 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2572 ),
2573 PathArguments::Parenthesized(_binding_0) => {
2574 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002575 }
2576 }
2577}
David Tolnay8c81f622018-07-31 23:34:35 -07002578#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002579pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002580 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002581 ident: _visitor.fold_ident(_i.ident),
2582 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002583 }
2584}
David Tolnay8c81f622018-07-31 23:34:35 -07002585#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002586pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002587 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002588 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002589 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002590 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002591 }
2592}
David Tolnay8c81f622018-07-31 23:34:35 -07002593#[cfg(any(feature = "full", feature = "derive"))]
2594pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2595 _visitor: &mut V,
2596 _i: PredicateLifetime,
2597) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002598 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002599 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay1b8e2852018-08-26 08:25:18 -04002600 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002601 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002602 }
2603}
David Tolnay8c81f622018-07-31 23:34:35 -07002604#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002605pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002606 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002607 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2608 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002609 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002610 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002611 }
2612}
David Tolnay8c81f622018-07-31 23:34:35 -07002613#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002614pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002615 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002616 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002617 ty: Box::new(_visitor.fold_type(*_i.ty)),
2618 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002619 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2620 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002621 }
2622}
David Tolnay8c81f622018-07-31 23:34:35 -07002623#[cfg(any(feature = "full", feature = "derive"))]
2624#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002625pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002626 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002627 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002628 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002629 }
David Tolnay8c81f622018-07-31 23:34:35 -07002630 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002631 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002632 }
2633 }
2634}
David Tolnay8c81f622018-07-31 23:34:35 -07002635#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002636pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002637 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002638 ReturnType::Default => ReturnType::Default,
2639 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002640 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002641 Box::new(_visitor.fold_type(*_binding_1)),
2642 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002643 }
2644}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002645pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002646 _i
2647}
David Tolnay8c81f622018-07-31 23:34:35 -07002648#[cfg(any(feature = "full", feature = "derive"))]
2649#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002650pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002651 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002652 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2653 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2654 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2655 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2656 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002657 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002658 ),
Nika Layzell27726662017-10-24 23:16:35 -04002659 }
2660}
David Tolnay8c81f622018-07-31 23:34:35 -07002661#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002662pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002663 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002664 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002665 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2666 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2667 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002668 }
2669}
David Tolnay8c81f622018-07-31 23:34:35 -07002670#[cfg(any(feature = "full", feature = "derive"))]
2671pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2672 _visitor: &mut V,
2673 _i: TraitBoundModifier,
2674) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002675 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002676 TraitBoundModifier::None => TraitBoundModifier::None,
2677 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002678 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002679 }
2680 }
2681}
David Tolnay8c81f622018-07-31 23:34:35 -07002682#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002683pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002684 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002685 TraitItem::Const(_binding_0) => {
2686 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002687 }
David Tolnay8c81f622018-07-31 23:34:35 -07002688 TraitItem::Method(_binding_0) => {
2689 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002690 }
David Tolnay8c81f622018-07-31 23:34:35 -07002691 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2692 TraitItem::Macro(_binding_0) => {
2693 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002694 }
David Tolnay8c81f622018-07-31 23:34:35 -07002695 TraitItem::Verbatim(_binding_0) => {
2696 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002697 }
Nika Layzell27726662017-10-24 23:16:35 -04002698 }
2699}
David Tolnay8c81f622018-07-31 23:34:35 -07002700#[cfg(feature = "full")]
2701pub fn fold_trait_item_const<V: Fold + ?Sized>(
2702 _visitor: &mut V,
2703 _i: TraitItemConst,
2704) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002705 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002706 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002707 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002708 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002709 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002710 ty: _visitor.fold_type(_i.ty),
2711 default: (_i.default).map(|it| {
2712 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002713 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002714 _visitor.fold_expr((it).1),
2715 )
2716 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002717 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002718 }
2719}
David Tolnay8c81f622018-07-31 23:34:35 -07002720#[cfg(feature = "full")]
2721pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2722 _visitor: &mut V,
2723 _i: TraitItemMacro,
2724) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002725 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002726 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2727 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002728 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002729 }
2730}
David Tolnay8c81f622018-07-31 23:34:35 -07002731#[cfg(feature = "full")]
2732pub fn fold_trait_item_method<V: Fold + ?Sized>(
2733 _visitor: &mut V,
2734 _i: TraitItemMethod,
2735) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002736 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002737 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2738 sig: _visitor.fold_method_sig(_i.sig),
2739 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002740 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002741 }
2742}
David Tolnay8c81f622018-07-31 23:34:35 -07002743#[cfg(feature = "full")]
2744pub fn fold_trait_item_type<V: Fold + ?Sized>(
2745 _visitor: &mut V,
2746 _i: TraitItemType,
2747) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002748 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002749 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002750 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002751 ident: _visitor.fold_ident(_i.ident),
2752 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002753 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002754 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2755 default: (_i.default).map(|it| {
2756 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002757 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002758 _visitor.fold_type((it).1),
2759 )
2760 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002761 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002762 }
2763}
David Tolnay8c81f622018-07-31 23:34:35 -07002764#[cfg(feature = "full")]
2765pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2766 _visitor: &mut V,
2767 _i: TraitItemVerbatim,
2768) -> TraitItemVerbatim {
2769 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002770}
David Tolnay8c81f622018-07-31 23:34:35 -07002771#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002772pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002773 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002774 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2775 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2776 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2777 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2778 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2779 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2780 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2781 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2782 Type::TraitObject(_binding_0) => {
2783 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002784 }
David Tolnay8c81f622018-07-31 23:34:35 -07002785 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2786 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2787 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2788 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2789 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2790 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002791 }
2792}
David Tolnay8c81f622018-07-31 23:34:35 -07002793#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002794pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002795 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002796 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002797 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002798 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002799 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002800 }
2801}
David Tolnay8c81f622018-07-31 23:34:35 -07002802#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002803pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002804 TypeBareFn {
David Tolnay3779bb72018-08-26 18:46:07 -07002805 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002806 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002807 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002808 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002809 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002810 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002811 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002812 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002813 }
2814}
David Tolnay8c81f622018-07-31 23:34:35 -07002815#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002816pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002817 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002818 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002819 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002820 }
2821}
David Tolnay8c81f622018-07-31 23:34:35 -07002822#[cfg(any(feature = "full", feature = "derive"))]
2823pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2824 _visitor: &mut V,
2825 _i: TypeImplTrait,
2826) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002827 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002828 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002829 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002830 }
2831}
David Tolnay8c81f622018-07-31 23:34:35 -07002832#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002833pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002834 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002835 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002836 }
2837}
David Tolnay8c81f622018-07-31 23:34:35 -07002838#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002839pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002840 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002841 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002842 }
2843}
David Tolnay8c81f622018-07-31 23:34:35 -07002844#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002845pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002846 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002847 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002848 }
2849}
David Tolnay8c81f622018-07-31 23:34:35 -07002850#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002851pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002852 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002853 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2854 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002855 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002856 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002857 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002858 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002859 }
2860}
David Tolnay8c81f622018-07-31 23:34:35 -07002861#[cfg(any(feature = "full", feature = "derive"))]
2862pub fn fold_type_param_bound<V: Fold + ?Sized>(
2863 _visitor: &mut V,
2864 _i: TypeParamBound,
2865) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002866 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002867 TypeParamBound::Trait(_binding_0) => {
2868 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002869 }
David Tolnay8c81f622018-07-31 23:34:35 -07002870 TypeParamBound::Lifetime(_binding_0) => {
2871 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002872 }
2873 }
2874}
David Tolnay8c81f622018-07-31 23:34:35 -07002875#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002876pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002877 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002878 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002879 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002880 }
2881}
David Tolnay8c81f622018-07-31 23:34:35 -07002882#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002883pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002884 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002885 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2886 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002887 }
2888}
David Tolnay8c81f622018-07-31 23:34:35 -07002889#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002890pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002891 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002892 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2893 const_token: (_i.const_token)
2894 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2895 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002896 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002897 }
2898}
David Tolnay8c81f622018-07-31 23:34:35 -07002899#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002900pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002901 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002902 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002903 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002904 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002905 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002906 }
2907}
David Tolnay8c81f622018-07-31 23:34:35 -07002908#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002909pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002910 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002911 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002912 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002913 }
2914}
David Tolnay8c81f622018-07-31 23:34:35 -07002915#[cfg(any(feature = "full", feature = "derive"))]
2916pub fn fold_type_trait_object<V: Fold + ?Sized>(
2917 _visitor: &mut V,
2918 _i: TypeTraitObject,
2919) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002920 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002921 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002922 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002923 }
2924}
David Tolnay8c81f622018-07-31 23:34:35 -07002925#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002926pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002927 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002928 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002929 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002930 }
2931}
David Tolnay8c81f622018-07-31 23:34:35 -07002932#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002933pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002934 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002935}
David Tolnay8c81f622018-07-31 23:34:35 -07002936#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002937pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002938 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002939 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002940 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002941 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002942 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2943 UnOp::Neg(_binding_0) => {
2944 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2945 }
Nika Layzell27726662017-10-24 23:16:35 -04002946 }
2947}
David Tolnay8c81f622018-07-31 23:34:35 -07002948#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002949pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002950 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002951 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002952 }
2953}
David Tolnay8c81f622018-07-31 23:34:35 -07002954#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002955pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2956 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002957 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002958 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002959 }
2960}
David Tolnay8c81f622018-07-31 23:34:35 -07002961#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002962pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2963 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002964 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002965 }
2966}
David Tolnay8c81f622018-07-31 23:34:35 -07002967#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002968pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002969 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002970 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002971 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002972 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002973 }
2974}
David Tolnay8c81f622018-07-31 23:34:35 -07002975#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002976pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2977 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002978 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002979 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002980 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002981 }
2982}
David Tolnay8c81f622018-07-31 23:34:35 -07002983#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002984pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002985 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002986 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2987 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2988 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2989 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2990 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002991 }
2992}
David Tolnay8c81f622018-07-31 23:34:35 -07002993#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002994pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002995 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002996 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2997 ident: _visitor.fold_ident(_i.ident),
2998 fields: _visitor.fold_fields(_i.fields),
2999 discriminant: (_i.discriminant).map(|it| {
3000 (
David Tolnay7ac699c2018-08-24 14:00:58 -04003001 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07003002 _visitor.fold_expr((it).1),
3003 )
3004 }),
Nika Layzell27726662017-10-24 23:16:35 -04003005 }
3006}
David Tolnay8c81f622018-07-31 23:34:35 -07003007#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003008pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04003009 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04003010 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04003011 }
3012}
David Tolnay8c81f622018-07-31 23:34:35 -07003013#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003014pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04003015 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04003016 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04003017 }
3018}
David Tolnay8c81f622018-07-31 23:34:35 -07003019#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003020pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04003021 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04003022 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
3023 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
3024 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07003025 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04003026 }
3027}
David Tolnay8c81f622018-07-31 23:34:35 -07003028#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003029pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04003030 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003031 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
3032 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
3033 Visibility::Restricted(_binding_0) => {
3034 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003035 }
David Tolnay8c81f622018-07-31 23:34:35 -07003036 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04003037 }
3038}
David Tolnay8c81f622018-07-31 23:34:35 -07003039#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003040pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04003041 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04003042 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07003043 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04003044 }
3045}
David Tolnay8c81f622018-07-31 23:34:35 -07003046#[cfg(any(feature = "full", feature = "derive"))]
3047pub fn fold_where_predicate<V: Fold + ?Sized>(
3048 _visitor: &mut V,
3049 _i: WherePredicate,
3050) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04003051 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003052 WherePredicate::Type(_binding_0) => {
3053 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003054 }
David Tolnay8c81f622018-07-31 23:34:35 -07003055 WherePredicate::Lifetime(_binding_0) => {
3056 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003057 }
David Tolnay8c81f622018-07-31 23:34:35 -07003058 WherePredicate::Eq(_binding_0) => {
3059 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003060 }
3061 }
3062}