blob: 198587777c78dedee4aa0dcdb30ec421a4023259 [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// Unreachable code is generated sometimes without the full feature.
4#![allow(unreachable_code)]
David Tolnayf0d63bf2017-12-26 12:29:47 -05005#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
Nika Layzell27726662017-10-24 23:16:35 -04006
David Tolnay0a0d78c2018-01-05 15:24:01 -08007#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05008use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07009use proc_macro2::Span;
10#[cfg(any(feature = "full", feature = "derive"))]
11use token::{Brace, Bracket, Group, Paren};
12use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040013
14#[cfg(feature = "full")]
15macro_rules! full {
David Tolnay8c81f622018-07-31 23:34:35 -070016 ($e:expr) => {
17 $e
18 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040019}
20
David Tolnay0a0d78c2018-01-05 15:24:01 -080021#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040022macro_rules! full {
David Tolnay8c81f622018-07-31 23:34:35 -070023 ($e:expr) => {
24 unreachable!()
25 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040026}
27
David Tolnayded2d682018-01-06 18:53:53 -080028/// Syntax tree traversal to transform the nodes of an owned syntax tree.
Nika Layzell27726662017-10-24 23:16:35 -040029///
David Tolnayded2d682018-01-06 18:53:53 -080030/// See the [module documentation] for details.
Nika Layzell27726662017-10-24 23:16:35 -040031///
David Tolnayded2d682018-01-06 18:53:53 -080032/// [module documentation]: index.html
David Tolnay12374262018-01-07 12:38:34 -080033///
34/// *This trait is available if Syn is built with the `"fold"` feature.*
David Tolnay4b4c4b62018-01-06 13:48:05 -080035pub trait Fold {
David Tolnay8c81f622018-07-31 23:34:35 -070036 #[cfg(any(feature = "full", feature = "derive"))]
37 fn fold_abi(&mut self, i: Abi) -> Abi {
38 fold_abi(self, i)
39 }
40 #[cfg(any(feature = "full", feature = "derive"))]
41 fn fold_angle_bracketed_generic_arguments(
42 &mut self,
43 i: AngleBracketedGenericArguments,
44 ) -> AngleBracketedGenericArguments {
45 fold_angle_bracketed_generic_arguments(self, i)
46 }
47 #[cfg(feature = "full")]
48 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
49 fold_arg_captured(self, i)
50 }
51 #[cfg(feature = "full")]
52 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
53 fold_arg_self(self, i)
54 }
55 #[cfg(feature = "full")]
56 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
57 fold_arg_self_ref(self, i)
58 }
59 #[cfg(any(feature = "full", feature = "derive"))]
60 #[cfg(feature = "full")]
61 fn fold_arm(&mut self, i: Arm) -> Arm {
62 fold_arm(self, i)
63 }
64 #[cfg(any(feature = "full", feature = "derive"))]
65 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
66 fold_attr_style(self, i)
67 }
68 #[cfg(any(feature = "full", feature = "derive"))]
69 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
70 fold_attribute(self, i)
71 }
72 #[cfg(any(feature = "full", feature = "derive"))]
73 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
74 fold_bare_fn_arg(self, i)
75 }
76 #[cfg(any(feature = "full", feature = "derive"))]
77 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
78 fold_bare_fn_arg_name(self, i)
79 }
80 #[cfg(any(feature = "full", feature = "derive"))]
81 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
82 fold_bin_op(self, i)
83 }
84 #[cfg(any(feature = "full", feature = "derive"))]
85 fn fold_binding(&mut self, i: Binding) -> Binding {
86 fold_binding(self, i)
87 }
88 #[cfg(any(feature = "full", feature = "derive"))]
89 #[cfg(feature = "full")]
90 fn fold_block(&mut self, i: Block) -> Block {
91 fold_block(self, i)
92 }
93 #[cfg(any(feature = "full", feature = "derive"))]
94 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
95 fold_bound_lifetimes(self, i)
96 }
97 #[cfg(any(feature = "full", feature = "derive"))]
98 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
99 fold_const_param(self, i)
100 }
101 #[cfg(feature = "derive")]
102 fn fold_data(&mut self, i: Data) -> Data {
103 fold_data(self, i)
104 }
105 #[cfg(feature = "derive")]
106 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
107 fold_data_enum(self, i)
108 }
109 #[cfg(feature = "derive")]
110 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
111 fold_data_struct(self, i)
112 }
113 #[cfg(feature = "derive")]
114 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
115 fold_data_union(self, i)
116 }
117 #[cfg(feature = "derive")]
118 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
119 fold_derive_input(self, i)
120 }
121 #[cfg(any(feature = "full", feature = "derive"))]
122 fn fold_expr(&mut self, i: Expr) -> Expr {
123 fold_expr(self, i)
124 }
125 #[cfg(feature = "full")]
126 #[cfg(any(feature = "full", feature = "derive"))]
127 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
128 fold_expr_array(self, i)
129 }
130 #[cfg(feature = "full")]
131 #[cfg(any(feature = "full", feature = "derive"))]
132 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
133 fold_expr_assign(self, i)
134 }
135 #[cfg(feature = "full")]
136 #[cfg(any(feature = "full", feature = "derive"))]
137 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
138 fold_expr_assign_op(self, i)
139 }
140 #[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"))]
169 fn fold_expr_catch(&mut self, i: ExprCatch) -> ExprCatch {
170 fold_expr_catch(self, i)
171 }
172 #[cfg(feature = "full")]
173 #[cfg(any(feature = "full", feature = "derive"))]
174 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
175 fold_expr_closure(self, i)
176 }
177 #[cfg(feature = "full")]
178 #[cfg(any(feature = "full", feature = "derive"))]
179 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
180 fold_expr_continue(self, i)
181 }
182 #[cfg(any(feature = "full", feature = "derive"))]
183 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
184 fold_expr_field(self, i)
185 }
186 #[cfg(feature = "full")]
187 #[cfg(any(feature = "full", feature = "derive"))]
188 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
189 fold_expr_for_loop(self, i)
190 }
191 #[cfg(feature = "full")]
192 #[cfg(any(feature = "full", feature = "derive"))]
193 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
194 fold_expr_group(self, i)
195 }
196 #[cfg(feature = "full")]
197 #[cfg(any(feature = "full", feature = "derive"))]
198 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
199 fold_expr_if(self, i)
200 }
201 #[cfg(feature = "full")]
202 #[cfg(any(feature = "full", feature = "derive"))]
203 fn fold_expr_if_let(&mut self, i: ExprIfLet) -> ExprIfLet {
204 fold_expr_if_let(self, i)
205 }
206 #[cfg(feature = "full")]
207 #[cfg(any(feature = "full", feature = "derive"))]
208 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
209 fold_expr_in_place(self, i)
210 }
211 #[cfg(any(feature = "full", feature = "derive"))]
212 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
213 fold_expr_index(self, i)
214 }
215 #[cfg(any(feature = "full", feature = "derive"))]
216 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
217 fold_expr_lit(self, i)
218 }
219 #[cfg(feature = "full")]
220 #[cfg(any(feature = "full", feature = "derive"))]
221 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
222 fold_expr_loop(self, i)
223 }
224 #[cfg(feature = "full")]
225 #[cfg(any(feature = "full", feature = "derive"))]
226 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
227 fold_expr_macro(self, i)
228 }
229 #[cfg(feature = "full")]
230 #[cfg(any(feature = "full", feature = "derive"))]
231 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
232 fold_expr_match(self, i)
233 }
234 #[cfg(feature = "full")]
235 #[cfg(any(feature = "full", feature = "derive"))]
236 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
237 fold_expr_method_call(self, i)
238 }
239 #[cfg(any(feature = "full", feature = "derive"))]
240 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
241 fold_expr_paren(self, i)
242 }
243 #[cfg(any(feature = "full", feature = "derive"))]
244 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
245 fold_expr_path(self, i)
246 }
247 #[cfg(feature = "full")]
248 #[cfg(any(feature = "full", feature = "derive"))]
249 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
250 fold_expr_range(self, i)
251 }
252 #[cfg(feature = "full")]
253 #[cfg(any(feature = "full", feature = "derive"))]
254 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
255 fold_expr_reference(self, i)
256 }
257 #[cfg(feature = "full")]
258 #[cfg(any(feature = "full", feature = "derive"))]
259 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
260 fold_expr_repeat(self, i)
261 }
262 #[cfg(feature = "full")]
263 #[cfg(any(feature = "full", feature = "derive"))]
264 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
265 fold_expr_return(self, i)
266 }
267 #[cfg(feature = "full")]
268 #[cfg(any(feature = "full", feature = "derive"))]
269 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
270 fold_expr_struct(self, i)
271 }
272 #[cfg(feature = "full")]
273 #[cfg(any(feature = "full", feature = "derive"))]
274 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
275 fold_expr_try(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg(any(feature = "full", feature = "derive"))]
279 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")]
362 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
363 fold_foreign_item_static(self, i)
364 }
365 #[cfg(feature = "full")]
366 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
367 fold_foreign_item_type(self, i)
368 }
369 #[cfg(feature = "full")]
370 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
371 fold_foreign_item_verbatim(self, i)
372 }
373 #[cfg(any(feature = "full", feature = "derive"))]
374 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
375 fold_generic_argument(self, i)
376 }
377 #[cfg(any(feature = "full", feature = "derive"))]
378 #[cfg(feature = "full")]
379 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
380 fold_generic_method_argument(self, i)
381 }
382 #[cfg(any(feature = "full", feature = "derive"))]
383 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
384 fold_generic_param(self, i)
385 }
386 #[cfg(any(feature = "full", feature = "derive"))]
387 fn fold_generics(&mut self, i: Generics) -> Generics {
388 fold_generics(self, i)
389 }
Alex Crichtond261d092018-05-18 13:47:35 -0700390
David Tolnay8c81f622018-07-31 23:34:35 -0700391 fn fold_ident(&mut self, i: Ident) -> Ident {
392 fold_ident(self, i)
393 }
394 #[cfg(feature = "full")]
395 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
396 fold_impl_item(self, i)
397 }
398 #[cfg(feature = "full")]
399 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
400 fold_impl_item_const(self, i)
401 }
402 #[cfg(feature = "full")]
403 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
404 fold_impl_item_macro(self, i)
405 }
406 #[cfg(feature = "full")]
407 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
408 fold_impl_item_method(self, i)
409 }
410 #[cfg(feature = "full")]
411 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
412 fold_impl_item_type(self, i)
413 }
414 #[cfg(feature = "full")]
415 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
416 fold_impl_item_verbatim(self, i)
417 }
418 #[cfg(any(feature = "full", feature = "derive"))]
419 fn fold_index(&mut self, i: Index) -> Index {
420 fold_index(self, i)
421 }
422 #[cfg(feature = "full")]
423 fn fold_item(&mut self, i: Item) -> Item {
424 fold_item(self, i)
425 }
426 #[cfg(feature = "full")]
427 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
428 fold_item_const(self, i)
429 }
430 #[cfg(feature = "full")]
431 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
432 fold_item_enum(self, i)
433 }
434 #[cfg(feature = "full")]
435 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
436 fold_item_extern_crate(self, i)
437 }
438 #[cfg(feature = "full")]
439 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
440 fold_item_fn(self, i)
441 }
442 #[cfg(feature = "full")]
443 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
444 fold_item_foreign_mod(self, i)
445 }
446 #[cfg(feature = "full")]
447 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
448 fold_item_impl(self, i)
449 }
450 #[cfg(feature = "full")]
451 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
452 fold_item_macro(self, i)
453 }
454 #[cfg(feature = "full")]
455 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
456 fold_item_macro2(self, i)
457 }
458 #[cfg(feature = "full")]
459 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
460 fold_item_mod(self, i)
461 }
462 #[cfg(feature = "full")]
463 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
464 fold_item_static(self, i)
465 }
466 #[cfg(feature = "full")]
467 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
468 fold_item_struct(self, i)
469 }
470 #[cfg(feature = "full")]
471 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
472 fold_item_trait(self, i)
473 }
474 #[cfg(feature = "full")]
475 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
476 fold_item_type(self, i)
477 }
478 #[cfg(feature = "full")]
479 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
480 fold_item_union(self, i)
481 }
482 #[cfg(feature = "full")]
483 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
484 fold_item_use(self, i)
485 }
486 #[cfg(feature = "full")]
487 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
488 fold_item_verbatim(self, i)
489 }
490 #[cfg(any(feature = "full", feature = "derive"))]
491 #[cfg(feature = "full")]
492 fn fold_label(&mut self, i: Label) -> Label {
493 fold_label(self, i)
494 }
495 #[cfg(any(feature = "full", feature = "derive"))]
496 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
497 fold_lifetime(self, i)
498 }
499 #[cfg(any(feature = "full", feature = "derive"))]
500 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
501 fold_lifetime_def(self, i)
502 }
503 #[cfg(any(feature = "full", feature = "derive"))]
504 fn fold_lit(&mut self, i: Lit) -> Lit {
505 fold_lit(self, i)
506 }
507 #[cfg(any(feature = "full", feature = "derive"))]
508 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
509 fold_lit_bool(self, i)
510 }
511 #[cfg(any(feature = "full", feature = "derive"))]
512 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
513 fold_lit_byte(self, i)
514 }
515 #[cfg(any(feature = "full", feature = "derive"))]
516 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
517 fold_lit_byte_str(self, i)
518 }
519 #[cfg(any(feature = "full", feature = "derive"))]
520 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
521 fold_lit_char(self, i)
522 }
523 #[cfg(any(feature = "full", feature = "derive"))]
524 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
525 fold_lit_float(self, i)
526 }
527 #[cfg(any(feature = "full", feature = "derive"))]
528 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
529 fold_lit_int(self, i)
530 }
531 #[cfg(any(feature = "full", feature = "derive"))]
532 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
533 fold_lit_str(self, i)
534 }
535 #[cfg(any(feature = "full", feature = "derive"))]
536 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
537 fold_lit_verbatim(self, i)
538 }
539 #[cfg(any(feature = "full", feature = "derive"))]
540 #[cfg(feature = "full")]
541 fn fold_local(&mut self, i: Local) -> Local {
542 fold_local(self, i)
543 }
544 #[cfg(any(feature = "full", feature = "derive"))]
545 fn fold_macro(&mut self, i: Macro) -> Macro {
546 fold_macro(self, i)
547 }
548 #[cfg(any(feature = "full", feature = "derive"))]
549 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
550 fold_macro_delimiter(self, i)
551 }
552 #[cfg(any(feature = "full", feature = "derive"))]
553 fn fold_member(&mut self, i: Member) -> Member {
554 fold_member(self, i)
555 }
556 #[cfg(any(feature = "full", feature = "derive"))]
557 fn fold_meta(&mut self, i: Meta) -> Meta {
558 fold_meta(self, i)
559 }
560 #[cfg(any(feature = "full", feature = "derive"))]
561 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
562 fold_meta_list(self, i)
563 }
564 #[cfg(any(feature = "full", feature = "derive"))]
565 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
566 fold_meta_name_value(self, i)
567 }
568 #[cfg(feature = "full")]
569 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
570 fold_method_sig(self, i)
571 }
572 #[cfg(any(feature = "full", feature = "derive"))]
573 #[cfg(feature = "full")]
574 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
575 fold_method_turbofish(self, i)
576 }
577 #[cfg(any(feature = "full", feature = "derive"))]
578 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
579 fold_nested_meta(self, i)
580 }
581 #[cfg(any(feature = "full", feature = "derive"))]
582 fn fold_parenthesized_generic_arguments(
583 &mut self,
584 i: ParenthesizedGenericArguments,
585 ) -> ParenthesizedGenericArguments {
586 fold_parenthesized_generic_arguments(self, i)
587 }
588 #[cfg(any(feature = "full", feature = "derive"))]
589 #[cfg(feature = "full")]
590 fn fold_pat(&mut self, i: Pat) -> Pat {
591 fold_pat(self, i)
592 }
593 #[cfg(any(feature = "full", feature = "derive"))]
594 #[cfg(feature = "full")]
595 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
596 fold_pat_box(self, i)
597 }
598 #[cfg(any(feature = "full", feature = "derive"))]
599 #[cfg(feature = "full")]
600 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
601 fold_pat_ident(self, i)
602 }
603 #[cfg(any(feature = "full", feature = "derive"))]
604 #[cfg(feature = "full")]
605 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
606 fold_pat_lit(self, i)
607 }
608 #[cfg(any(feature = "full", feature = "derive"))]
609 #[cfg(feature = "full")]
610 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
611 fold_pat_macro(self, i)
612 }
613 #[cfg(any(feature = "full", feature = "derive"))]
614 #[cfg(feature = "full")]
615 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
616 fold_pat_path(self, i)
617 }
618 #[cfg(any(feature = "full", feature = "derive"))]
619 #[cfg(feature = "full")]
620 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
621 fold_pat_range(self, i)
622 }
623 #[cfg(any(feature = "full", feature = "derive"))]
624 #[cfg(feature = "full")]
625 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
626 fold_pat_ref(self, i)
627 }
628 #[cfg(any(feature = "full", feature = "derive"))]
629 #[cfg(feature = "full")]
630 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
631 fold_pat_slice(self, i)
632 }
633 #[cfg(any(feature = "full", feature = "derive"))]
634 #[cfg(feature = "full")]
635 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
636 fold_pat_struct(self, i)
637 }
638 #[cfg(any(feature = "full", feature = "derive"))]
639 #[cfg(feature = "full")]
640 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
641 fold_pat_tuple(self, i)
642 }
643 #[cfg(any(feature = "full", feature = "derive"))]
644 #[cfg(feature = "full")]
645 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
646 fold_pat_tuple_struct(self, i)
647 }
648 #[cfg(any(feature = "full", feature = "derive"))]
649 #[cfg(feature = "full")]
650 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
651 fold_pat_verbatim(self, i)
652 }
653 #[cfg(any(feature = "full", feature = "derive"))]
654 #[cfg(feature = "full")]
655 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
656 fold_pat_wild(self, i)
657 }
658 #[cfg(any(feature = "full", feature = "derive"))]
659 fn fold_path(&mut self, i: Path) -> Path {
660 fold_path(self, i)
661 }
662 #[cfg(any(feature = "full", feature = "derive"))]
663 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
664 fold_path_arguments(self, i)
665 }
666 #[cfg(any(feature = "full", feature = "derive"))]
667 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
668 fold_path_segment(self, i)
669 }
670 #[cfg(any(feature = "full", feature = "derive"))]
671 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
672 fold_predicate_eq(self, i)
673 }
674 #[cfg(any(feature = "full", feature = "derive"))]
675 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
676 fold_predicate_lifetime(self, i)
677 }
678 #[cfg(any(feature = "full", feature = "derive"))]
679 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
680 fold_predicate_type(self, i)
681 }
682 #[cfg(any(feature = "full", feature = "derive"))]
683 fn fold_qself(&mut self, i: QSelf) -> QSelf {
684 fold_qself(self, i)
685 }
686 #[cfg(any(feature = "full", feature = "derive"))]
687 #[cfg(feature = "full")]
688 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
689 fold_range_limits(self, i)
690 }
691 #[cfg(any(feature = "full", feature = "derive"))]
692 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
693 fold_return_type(self, i)
694 }
Nika Layzellefb83ba2017-12-19 18:23:55 -0500695
David Tolnay8c81f622018-07-31 23:34:35 -0700696 fn fold_span(&mut self, i: Span) -> Span {
697 fold_span(self, i)
698 }
699 #[cfg(any(feature = "full", feature = "derive"))]
700 #[cfg(feature = "full")]
701 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
702 fold_stmt(self, i)
703 }
704 #[cfg(any(feature = "full", feature = "derive"))]
705 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
706 fold_trait_bound(self, i)
707 }
708 #[cfg(any(feature = "full", feature = "derive"))]
709 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
710 fold_trait_bound_modifier(self, i)
711 }
712 #[cfg(feature = "full")]
713 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
714 fold_trait_item(self, i)
715 }
716 #[cfg(feature = "full")]
717 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
718 fold_trait_item_const(self, i)
719 }
720 #[cfg(feature = "full")]
721 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
722 fold_trait_item_macro(self, i)
723 }
724 #[cfg(feature = "full")]
725 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
726 fold_trait_item_method(self, i)
727 }
728 #[cfg(feature = "full")]
729 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
730 fold_trait_item_type(self, i)
731 }
732 #[cfg(feature = "full")]
733 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
734 fold_trait_item_verbatim(self, i)
735 }
736 #[cfg(any(feature = "full", feature = "derive"))]
737 fn fold_type(&mut self, i: Type) -> Type {
738 fold_type(self, i)
739 }
740 #[cfg(any(feature = "full", feature = "derive"))]
741 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
742 fold_type_array(self, i)
743 }
744 #[cfg(any(feature = "full", feature = "derive"))]
745 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
746 fold_type_bare_fn(self, i)
747 }
748 #[cfg(any(feature = "full", feature = "derive"))]
749 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
750 fold_type_group(self, i)
751 }
752 #[cfg(any(feature = "full", feature = "derive"))]
753 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
754 fold_type_impl_trait(self, i)
755 }
756 #[cfg(any(feature = "full", feature = "derive"))]
757 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
758 fold_type_infer(self, i)
759 }
760 #[cfg(any(feature = "full", feature = "derive"))]
761 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
762 fold_type_macro(self, i)
763 }
764 #[cfg(any(feature = "full", feature = "derive"))]
765 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
766 fold_type_never(self, i)
767 }
768 #[cfg(any(feature = "full", feature = "derive"))]
769 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
770 fold_type_param(self, i)
771 }
772 #[cfg(any(feature = "full", feature = "derive"))]
773 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
774 fold_type_param_bound(self, i)
775 }
776 #[cfg(any(feature = "full", feature = "derive"))]
777 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
778 fold_type_paren(self, i)
779 }
780 #[cfg(any(feature = "full", feature = "derive"))]
781 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
782 fold_type_path(self, i)
783 }
784 #[cfg(any(feature = "full", feature = "derive"))]
785 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
786 fold_type_ptr(self, i)
787 }
788 #[cfg(any(feature = "full", feature = "derive"))]
789 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
790 fold_type_reference(self, i)
791 }
792 #[cfg(any(feature = "full", feature = "derive"))]
793 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
794 fold_type_slice(self, i)
795 }
796 #[cfg(any(feature = "full", feature = "derive"))]
797 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
798 fold_type_trait_object(self, i)
799 }
800 #[cfg(any(feature = "full", feature = "derive"))]
801 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
802 fold_type_tuple(self, i)
803 }
804 #[cfg(any(feature = "full", feature = "derive"))]
805 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
806 fold_type_verbatim(self, i)
807 }
808 #[cfg(any(feature = "full", feature = "derive"))]
809 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
810 fold_un_op(self, i)
811 }
812 #[cfg(feature = "full")]
813 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
814 fold_use_glob(self, i)
815 }
816 #[cfg(feature = "full")]
817 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
818 fold_use_group(self, i)
819 }
820 #[cfg(feature = "full")]
821 fn fold_use_name(&mut self, i: UseName) -> UseName {
822 fold_use_name(self, i)
823 }
824 #[cfg(feature = "full")]
825 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
826 fold_use_path(self, i)
827 }
828 #[cfg(feature = "full")]
829 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
830 fold_use_rename(self, i)
831 }
832 #[cfg(feature = "full")]
833 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
834 fold_use_tree(self, i)
835 }
836 #[cfg(any(feature = "full", feature = "derive"))]
837 fn fold_variant(&mut self, i: Variant) -> Variant {
838 fold_variant(self, i)
839 }
840 #[cfg(any(feature = "full", feature = "derive"))]
841 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
842 fold_vis_crate(self, i)
843 }
844 #[cfg(any(feature = "full", feature = "derive"))]
845 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
846 fold_vis_public(self, i)
847 }
848 #[cfg(any(feature = "full", feature = "derive"))]
849 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
850 fold_vis_restricted(self, i)
851 }
852 #[cfg(any(feature = "full", feature = "derive"))]
853 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
854 fold_visibility(self, i)
855 }
856 #[cfg(any(feature = "full", feature = "derive"))]
857 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
858 fold_where_clause(self, i)
859 }
860 #[cfg(any(feature = "full", feature = "derive"))]
861 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
862 fold_where_predicate(self, i)
863 }
Nika Layzell27726662017-10-24 23:16:35 -0400864}
865
David Tolnayd3f32142018-05-20 20:21:12 -0700866#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800867macro_rules! fold_span_only {
868 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800869 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700870 let span = _visitor.fold_span(_i.span());
871 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800872 _i
873 }
David Tolnay8c81f622018-07-31 23:34:35 -0700874 };
David Tolnayd0adf522017-12-29 01:30:07 -0500875}
876
David Tolnay360efd22018-01-04 23:35:26 -0800877#[cfg(any(feature = "full", feature = "derive"))]
878fold_span_only!(fold_lit_byte: LitByte);
879#[cfg(any(feature = "full", feature = "derive"))]
880fold_span_only!(fold_lit_byte_str: LitByteStr);
881#[cfg(any(feature = "full", feature = "derive"))]
882fold_span_only!(fold_lit_char: LitChar);
883#[cfg(any(feature = "full", feature = "derive"))]
884fold_span_only!(fold_lit_float: LitFloat);
885#[cfg(any(feature = "full", feature = "derive"))]
886fold_span_only!(fold_lit_int: LitInt);
887#[cfg(any(feature = "full", feature = "derive"))]
888fold_span_only!(fold_lit_str: LitStr);
David Tolnayd0adf522017-12-29 01:30:07 -0500889
David Tolnay8c81f622018-07-31 23:34:35 -0700890#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800891pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400892 Abi {
David Tolnay8c81f622018-07-31 23:34:35 -0700893 extern_token: Token![extern](tokens_helper(_visitor, &(_i.extern_token).0)),
894 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400895 }
896}
David Tolnay8c81f622018-07-31 23:34:35 -0700897#[cfg(any(feature = "full", feature = "derive"))]
898pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
899 _visitor: &mut V,
900 _i: AngleBracketedGenericArguments,
901) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500902 AngleBracketedGenericArguments {
David Tolnay8c81f622018-07-31 23:34:35 -0700903 colon2_token: (_i.colon2_token).map(|it| Token ! [ :: ](tokens_helper(_visitor, &(it).0))),
904 lt_token: Token ! [ < ](tokens_helper(_visitor, &(_i.lt_token).0)),
905 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
906 gt_token: Token ! [ > ](tokens_helper(_visitor, &(_i.gt_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -0400907 }
908}
David Tolnay8c81f622018-07-31 23:34:35 -0700909#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800910pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400911 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700912 pat: _visitor.fold_pat(_i.pat),
913 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
914 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400915 }
916}
David Tolnay8c81f622018-07-31 23:34:35 -0700917#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800918pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400919 ArgSelf {
David Tolnay8c81f622018-07-31 23:34:35 -0700920 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &(it).0))),
921 self_token: Token![self](tokens_helper(_visitor, &(_i.self_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -0400922 }
923}
David Tolnay8c81f622018-07-31 23:34:35 -0700924#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800925pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400926 ArgSelfRef {
David Tolnay8c81f622018-07-31 23:34:35 -0700927 and_token: Token ! [ & ](tokens_helper(_visitor, &(_i.and_token).0)),
928 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
929 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &(it).0))),
930 self_token: Token![self](tokens_helper(_visitor, &(_i.self_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -0400931 }
932}
David Tolnay8c81f622018-07-31 23:34:35 -0700933#[cfg(any(feature = "full", feature = "derive"))]
934#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800935pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400936 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700937 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
938 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &(it).0))),
939 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
940 guard: (_i.guard).map(|it| {
941 (
942 Token ! [ if ](tokens_helper(_visitor, &((it).0).0)),
943 Box::new(_visitor.fold_expr(*(it).1)),
944 )
945 }),
946 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &(_i.fat_arrow_token).0)),
947 body: Box::new(_visitor.fold_expr(*_i.body)),
948 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &(it).0))),
Nika Layzell27726662017-10-24 23:16:35 -0400949 }
950}
David Tolnay8c81f622018-07-31 23:34:35 -0700951#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800952pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400953 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700954 AttrStyle::Outer => AttrStyle::Outer,
955 AttrStyle::Inner(_binding_0) => {
956 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -0400957 }
958 }
959}
David Tolnay8c81f622018-07-31 23:34:35 -0700960#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800961pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400962 Attribute {
David Tolnay8c81f622018-07-31 23:34:35 -0700963 pound_token: Token ! [ # ](tokens_helper(_visitor, &(_i.pound_token).0)),
964 style: _visitor.fold_attr_style(_i.style),
965 bracket_token: Bracket(tokens_helper(_visitor, &(_i.bracket_token).0)),
966 path: _visitor.fold_path(_i.path),
967 tts: _i.tts,
968 is_sugared_doc: _i.is_sugared_doc,
Nika Layzell27726662017-10-24 23:16:35 -0400969 }
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_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400973 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700974 name: (_i.name).map(|it| {
975 (
976 _visitor.fold_bare_fn_arg_name((it).0),
977 Token ! [ : ](tokens_helper(_visitor, &((it).1).0)),
978 )
979 }),
980 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400981 }
982}
David Tolnay8c81f622018-07-31 23:34:35 -0700983#[cfg(any(feature = "full", feature = "derive"))]
984pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
985 _visitor: &mut V,
986 _i: BareFnArgName,
987) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400988 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700989 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
990 BareFnArgName::Wild(_binding_0) => {
991 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -0400992 }
993 }
994}
David Tolnay8c81f622018-07-31 23:34:35 -0700995#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800996pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -0400997 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700998 BinOp::Add(_binding_0) => {
999 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001000 }
David Tolnay8c81f622018-07-31 23:34:35 -07001001 BinOp::Sub(_binding_0) => {
1002 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001003 }
David Tolnay8c81f622018-07-31 23:34:35 -07001004 BinOp::Mul(_binding_0) => {
1005 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001006 }
David Tolnay8c81f622018-07-31 23:34:35 -07001007 BinOp::Div(_binding_0) => {
1008 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001009 }
David Tolnay8c81f622018-07-31 23:34:35 -07001010 BinOp::Rem(_binding_0) => {
1011 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001012 }
David Tolnay8c81f622018-07-31 23:34:35 -07001013 BinOp::And(_binding_0) => {
1014 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001015 }
David Tolnay8c81f622018-07-31 23:34:35 -07001016 BinOp::Or(_binding_0) => {
1017 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001018 }
David Tolnay8c81f622018-07-31 23:34:35 -07001019 BinOp::BitXor(_binding_0) => {
1020 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001021 }
David Tolnay8c81f622018-07-31 23:34:35 -07001022 BinOp::BitAnd(_binding_0) => {
1023 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001024 }
David Tolnay8c81f622018-07-31 23:34:35 -07001025 BinOp::BitOr(_binding_0) => {
1026 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001027 }
David Tolnay8c81f622018-07-31 23:34:35 -07001028 BinOp::Shl(_binding_0) => {
1029 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001030 }
David Tolnay8c81f622018-07-31 23:34:35 -07001031 BinOp::Shr(_binding_0) => {
1032 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001033 }
David Tolnay8c81f622018-07-31 23:34:35 -07001034 BinOp::Eq(_binding_0) => {
1035 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001036 }
David Tolnay8c81f622018-07-31 23:34:35 -07001037 BinOp::Lt(_binding_0) => BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &(_binding_0).0))),
1038 BinOp::Le(_binding_0) => {
1039 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001040 }
David Tolnay8c81f622018-07-31 23:34:35 -07001041 BinOp::Ne(_binding_0) => {
1042 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001043 }
David Tolnay8c81f622018-07-31 23:34:35 -07001044 BinOp::Ge(_binding_0) => {
1045 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001046 }
David Tolnay8c81f622018-07-31 23:34:35 -07001047 BinOp::Gt(_binding_0) => BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &(_binding_0).0))),
1048 BinOp::AddEq(_binding_0) => {
1049 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001050 }
David Tolnay8c81f622018-07-31 23:34:35 -07001051 BinOp::SubEq(_binding_0) => {
1052 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001053 }
David Tolnay8c81f622018-07-31 23:34:35 -07001054 BinOp::MulEq(_binding_0) => {
1055 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001056 }
David Tolnay8c81f622018-07-31 23:34:35 -07001057 BinOp::DivEq(_binding_0) => {
1058 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001059 }
David Tolnay8c81f622018-07-31 23:34:35 -07001060 BinOp::RemEq(_binding_0) => {
1061 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001062 }
David Tolnay8c81f622018-07-31 23:34:35 -07001063 BinOp::BitXorEq(_binding_0) => {
1064 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001065 }
David Tolnay8c81f622018-07-31 23:34:35 -07001066 BinOp::BitAndEq(_binding_0) => {
1067 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001068 }
David Tolnay8c81f622018-07-31 23:34:35 -07001069 BinOp::BitOrEq(_binding_0) => {
1070 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001071 }
David Tolnay8c81f622018-07-31 23:34:35 -07001072 BinOp::ShlEq(_binding_0) => {
1073 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001074 }
David Tolnay8c81f622018-07-31 23:34:35 -07001075 BinOp::ShrEq(_binding_0) => {
1076 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04001077 }
1078 }
1079}
David Tolnay8c81f622018-07-31 23:34:35 -07001080#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001081pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001082 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001083 ident: _visitor.fold_ident(_i.ident),
1084 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
1085 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001086 }
1087}
David Tolnay8c81f622018-07-31 23:34:35 -07001088#[cfg(any(feature = "full", feature = "derive"))]
1089#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001090pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001091 Block {
David Tolnay8c81f622018-07-31 23:34:35 -07001092 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
1093 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001094 }
1095}
David Tolnay8c81f622018-07-31 23:34:35 -07001096#[cfg(any(feature = "full", feature = "derive"))]
1097pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1098 _visitor: &mut V,
1099 _i: BoundLifetimes,
1100) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001101 BoundLifetimes {
David Tolnay8c81f622018-07-31 23:34:35 -07001102 for_token: Token ! [ for ](tokens_helper(_visitor, &(_i.for_token).0)),
1103 lt_token: Token ! [ < ](tokens_helper(_visitor, &(_i.lt_token).0)),
1104 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
1105 gt_token: Token ! [ > ](tokens_helper(_visitor, &(_i.gt_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04001106 }
1107}
David Tolnay8c81f622018-07-31 23:34:35 -07001108#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001109pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001110 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001111 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1112 const_token: Token ! [ const ](tokens_helper(_visitor, &(_i.const_token).0)),
1113 ident: _visitor.fold_ident(_i.ident),
1114 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
1115 ty: _visitor.fold_type(_i.ty),
1116 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &(it).0))),
1117 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001118 }
1119}
David Tolnay8c81f622018-07-31 23:34:35 -07001120#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001121pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001122 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001123 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1124 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1125 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001126 }
1127}
David Tolnay8c81f622018-07-31 23:34:35 -07001128#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001129pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001130 DataEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001131 enum_token: Token ! [ enum ](tokens_helper(_visitor, &(_i.enum_token).0)),
1132 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
1133 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001134 }
1135}
David Tolnay8c81f622018-07-31 23:34:35 -07001136#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001137pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001138 DataStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001139 struct_token: Token ! [ struct ](tokens_helper(_visitor, &(_i.struct_token).0)),
1140 fields: _visitor.fold_fields(_i.fields),
1141 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &(it).0))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001142 }
1143}
David Tolnay8c81f622018-07-31 23:34:35 -07001144#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001145pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001146 DataUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07001147 union_token: Token![union](tokens_helper(_visitor, &(_i.union_token).0)),
1148 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001149 }
1150}
David Tolnay8c81f622018-07-31 23:34:35 -07001151#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001152pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001153 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001154 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1155 vis: _visitor.fold_visibility(_i.vis),
1156 ident: _visitor.fold_ident(_i.ident),
1157 generics: _visitor.fold_generics(_i.generics),
1158 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001159 }
1160}
David Tolnay8c81f622018-07-31 23:34:35 -07001161#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001162pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001163 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001164 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1165 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1166 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1167 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1168 Expr::MethodCall(_binding_0) => {
1169 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001170 }
David Tolnay8c81f622018-07-31 23:34:35 -07001171 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1172 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1173 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1174 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1175 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1176 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
1177 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
1178 Expr::IfLet(_binding_0) => Expr::IfLet(full!(_visitor.fold_expr_if_let(_binding_0))),
1179 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
1180 Expr::WhileLet(_binding_0) => {
1181 Expr::WhileLet(full!(_visitor.fold_expr_while_let(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001182 }
David Tolnay8c81f622018-07-31 23:34:35 -07001183 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1184 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1185 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1186 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1187 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1188 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1189 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1190 Expr::AssignOp(_binding_0) => {
1191 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001192 }
David Tolnay8c81f622018-07-31 23:34:35 -07001193 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1194 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1195 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1196 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1197 Expr::Reference(_binding_0) => {
1198 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001199 }
David Tolnay8c81f622018-07-31 23:34:35 -07001200 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1201 Expr::Continue(_binding_0) => {
1202 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001203 }
David Tolnay8c81f622018-07-31 23:34:35 -07001204 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1205 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1206 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1207 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1208 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1209 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1210 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
1211 Expr::Catch(_binding_0) => Expr::Catch(full!(_visitor.fold_expr_catch(_binding_0))),
1212 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1213 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001214 }
1215}
David Tolnay8c81f622018-07-31 23:34:35 -07001216#[cfg(feature = "full")]
1217#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001218pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001219 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001220 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1221 bracket_token: Bracket(tokens_helper(_visitor, &(_i.bracket_token).0)),
1222 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001223 }
1224}
David Tolnay8c81f622018-07-31 23:34:35 -07001225#[cfg(feature = "full")]
1226#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001227pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001228 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001229 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1230 left: Box::new(_visitor.fold_expr(*_i.left)),
1231 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
1232 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001233 }
1234}
David Tolnay8c81f622018-07-31 23:34:35 -07001235#[cfg(feature = "full")]
1236#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001237pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001238 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001239 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1240 left: Box::new(_visitor.fold_expr(*_i.left)),
1241 op: _visitor.fold_bin_op(_i.op),
1242 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001243 }
1244}
David Tolnay8c81f622018-07-31 23:34:35 -07001245#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001246pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001247 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001248 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1249 left: Box::new(_visitor.fold_expr(*_i.left)),
1250 op: _visitor.fold_bin_op(_i.op),
1251 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001252 }
1253}
David Tolnay8c81f622018-07-31 23:34:35 -07001254#[cfg(feature = "full")]
1255#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001256pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001257 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001258 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1259 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001260 }
1261}
David Tolnay8c81f622018-07-31 23:34:35 -07001262#[cfg(feature = "full")]
1263#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001264pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001265 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001266 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1267 box_token: Token ! [ box ](tokens_helper(_visitor, &(_i.box_token).0)),
1268 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001269 }
1270}
David Tolnay8c81f622018-07-31 23:34:35 -07001271#[cfg(feature = "full")]
1272#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001273pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001274 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001275 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1276 break_token: Token![break](tokens_helper(_visitor, &(_i.break_token).0)),
1277 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1278 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001279 }
1280}
David Tolnay8c81f622018-07-31 23:34:35 -07001281#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001282pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001283 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001284 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1285 func: Box::new(_visitor.fold_expr(*_i.func)),
1286 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
1287 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001288 }
1289}
David Tolnay8c81f622018-07-31 23:34:35 -07001290#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001291pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001292 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001293 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1294 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1295 as_token: Token ! [ as ](tokens_helper(_visitor, &(_i.as_token).0)),
1296 ty: Box::new(_visitor.fold_type(*_i.ty)),
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_catch<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCatch) -> ExprCatch {
David Tolnay8c91b882017-12-28 23:04:32 -05001302 ExprCatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001303 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1304 do_token: Token ! [ do ](tokens_helper(_visitor, &(_i.do_token).0)),
1305 catch_token: Token![catch](tokens_helper(_visitor, &(_i.catch_token).0)),
1306 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001307 }
1308}
David Tolnay8c81f622018-07-31 23:34:35 -07001309#[cfg(feature = "full")]
1310#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001311pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001312 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001313 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1314 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &(it).0))),
1315 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &(it).0))),
1316 or1_token: Token ! [ | ](tokens_helper(_visitor, &(_i.or1_token).0)),
1317 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
1318 or2_token: Token ! [ | ](tokens_helper(_visitor, &(_i.or2_token).0)),
1319 output: _visitor.fold_return_type(_i.output),
1320 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001321 }
1322}
David Tolnay8c81f622018-07-31 23:34:35 -07001323#[cfg(feature = "full")]
1324#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001325pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001326 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001327 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1328 continue_token: Token![continue](tokens_helper(_visitor, &(_i.continue_token).0)),
1329 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001330 }
1331}
David Tolnay8c81f622018-07-31 23:34:35 -07001332#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001333pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001334 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001335 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1336 base: Box::new(_visitor.fold_expr(*_i.base)),
1337 dot_token: Token ! [ . ](tokens_helper(_visitor, &(_i.dot_token).0)),
1338 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001339 }
1340}
David Tolnay8c81f622018-07-31 23:34:35 -07001341#[cfg(feature = "full")]
1342#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001343pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001344 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001345 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1346 label: (_i.label).map(|it| _visitor.fold_label(it)),
1347 for_token: Token ! [ for ](tokens_helper(_visitor, &(_i.for_token).0)),
1348 pat: Box::new(_visitor.fold_pat(*_i.pat)),
1349 in_token: Token ! [ in ](tokens_helper(_visitor, &(_i.in_token).0)),
1350 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1351 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001352 }
1353}
David Tolnay8c81f622018-07-31 23:34:35 -07001354#[cfg(feature = "full")]
1355#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001356pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001357 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001358 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1359 group_token: Group(tokens_helper(_visitor, &(_i.group_token).0)),
1360 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001361 }
1362}
David Tolnay8c81f622018-07-31 23:34:35 -07001363#[cfg(feature = "full")]
1364#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001365pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001366 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001367 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1368 if_token: Token ! [ if ](tokens_helper(_visitor, &(_i.if_token).0)),
1369 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1370 then_branch: _visitor.fold_block(_i.then_branch),
1371 else_branch: (_i.else_branch).map(|it| {
1372 (
1373 Token ! [ else ](tokens_helper(_visitor, &((it).0).0)),
1374 Box::new(_visitor.fold_expr(*(it).1)),
1375 )
1376 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001377 }
1378}
David Tolnay8c81f622018-07-31 23:34:35 -07001379#[cfg(feature = "full")]
1380#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001381pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001382 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001383 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1384 if_token: Token ! [ if ](tokens_helper(_visitor, &(_i.if_token).0)),
1385 let_token: Token ! [ let ](tokens_helper(_visitor, &(_i.let_token).0)),
1386 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
1387 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
1388 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1389 then_branch: _visitor.fold_block(_i.then_branch),
1390 else_branch: (_i.else_branch).map(|it| {
1391 (
1392 Token ! [ else ](tokens_helper(_visitor, &((it).0).0)),
1393 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_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001401 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001402 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1403 place: Box::new(_visitor.fold_expr(*_i.place)),
1404 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &(_i.arrow_token).0)),
1405 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001406 }
1407}
David Tolnay8c81f622018-07-31 23:34:35 -07001408#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001409pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001410 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001411 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1412 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1413 bracket_token: Bracket(tokens_helper(_visitor, &(_i.bracket_token).0)),
1414 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001415 }
1416}
David Tolnay8c81f622018-07-31 23:34:35 -07001417#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001418pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001419 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001420 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1421 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001422 }
1423}
David Tolnay8c81f622018-07-31 23:34:35 -07001424#[cfg(feature = "full")]
1425#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001426pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001427 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001428 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1429 label: (_i.label).map(|it| _visitor.fold_label(it)),
1430 loop_token: Token ! [ loop ](tokens_helper(_visitor, &(_i.loop_token).0)),
1431 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001432 }
1433}
David Tolnay8c81f622018-07-31 23:34:35 -07001434#[cfg(feature = "full")]
1435#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001436pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001437 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001438 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1439 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001440 }
1441}
David Tolnay8c81f622018-07-31 23:34:35 -07001442#[cfg(feature = "full")]
1443#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001444pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001445 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001446 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1447 match_token: Token ! [ match ](tokens_helper(_visitor, &(_i.match_token).0)),
1448 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1449 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
1450 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
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"))]
1455pub fn fold_expr_method_call<V: Fold + ?Sized>(
1456 _visitor: &mut V,
1457 _i: ExprMethodCall,
1458) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001459 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001460 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1461 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
1462 dot_token: Token ! [ . ](tokens_helper(_visitor, &(_i.dot_token).0)),
1463 method: _visitor.fold_ident(_i.method),
1464 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
1465 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
1466 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001467 }
1468}
David Tolnay8c81f622018-07-31 23:34:35 -07001469#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001470pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001471 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001472 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1473 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
1474 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001475 }
1476}
David Tolnay8c81f622018-07-31 23:34:35 -07001477#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001478pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001479 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001480 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1481 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1482 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001483 }
1484}
David Tolnay8c81f622018-07-31 23:34:35 -07001485#[cfg(feature = "full")]
1486#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001487pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001488 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001489 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1490 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1491 limits: _visitor.fold_range_limits(_i.limits),
1492 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001493 }
1494}
David Tolnay8c81f622018-07-31 23:34:35 -07001495#[cfg(feature = "full")]
1496#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001497pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1498 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001499 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1500 and_token: Token ! [ & ](tokens_helper(_visitor, &(_i.and_token).0)),
1501 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &(it).0))),
1502 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001503 }
1504}
David Tolnay8c81f622018-07-31 23:34:35 -07001505#[cfg(feature = "full")]
1506#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001507pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001508 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001509 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1510 bracket_token: Bracket(tokens_helper(_visitor, &(_i.bracket_token).0)),
1511 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1512 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
1513 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001514 }
1515}
David Tolnay8c81f622018-07-31 23:34:35 -07001516#[cfg(feature = "full")]
1517#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001518pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001519 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001520 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1521 return_token: Token![return](tokens_helper(_visitor, &(_i.return_token).0)),
1522 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001523 }
1524}
David Tolnay8c81f622018-07-31 23:34:35 -07001525#[cfg(feature = "full")]
1526#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001527pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001528 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001529 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1530 path: _visitor.fold_path(_i.path),
1531 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
1532 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
1533 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &(it).0))),
1534 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001535 }
1536}
David Tolnay8c81f622018-07-31 23:34:35 -07001537#[cfg(feature = "full")]
1538#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001539pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001540 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001541 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1542 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1543 question_token: Token ! [ ? ](tokens_helper(_visitor, &(_i.question_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04001544 }
1545}
David Tolnay8c81f622018-07-31 23:34:35 -07001546#[cfg(feature = "full")]
1547#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001548pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001549 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001550 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1551 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
1552 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001553 }
1554}
David Tolnay8c81f622018-07-31 23:34:35 -07001555#[cfg(feature = "full")]
1556#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001557pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001558 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001559 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1560 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1561 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
1562 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001563 }
1564}
David Tolnay8c81f622018-07-31 23:34:35 -07001565#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001566pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001567 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001568 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1569 op: _visitor.fold_un_op(_i.op),
1570 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001571 }
1572}
David Tolnay8c81f622018-07-31 23:34:35 -07001573#[cfg(feature = "full")]
1574#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001575pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001576 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001577 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1578 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &(_i.unsafe_token).0)),
1579 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001580 }
1581}
David Tolnay8c81f622018-07-31 23:34:35 -07001582#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001583pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001584 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001585}
David Tolnay8c81f622018-07-31 23:34:35 -07001586#[cfg(feature = "full")]
1587#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001588pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001589 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001590 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1591 label: (_i.label).map(|it| _visitor.fold_label(it)),
1592 while_token: Token ! [ while ](tokens_helper(_visitor, &(_i.while_token).0)),
1593 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1594 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001595 }
1596}
David Tolnay8c81f622018-07-31 23:34:35 -07001597#[cfg(feature = "full")]
1598#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001599pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001600 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001601 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1602 label: (_i.label).map(|it| _visitor.fold_label(it)),
1603 while_token: Token ! [ while ](tokens_helper(_visitor, &(_i.while_token).0)),
1604 let_token: Token ! [ let ](tokens_helper(_visitor, &(_i.let_token).0)),
1605 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
1606 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
1607 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1608 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001609 }
1610}
David Tolnay8c81f622018-07-31 23:34:35 -07001611#[cfg(feature = "full")]
1612#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001613pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001614 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001615 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1616 yield_token: Token![yield](tokens_helper(_visitor, &(_i.yield_token).0)),
1617 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001618 }
1619}
David Tolnay8c81f622018-07-31 23:34:35 -07001620#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001621pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001622 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001623 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1624 vis: _visitor.fold_visibility(_i.vis),
1625 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
1626 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &(it).0))),
1627 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001628 }
1629}
David Tolnay8c81f622018-07-31 23:34:35 -07001630#[cfg(any(feature = "full", feature = "derive"))]
1631#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001632pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001633 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001634 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1635 member: _visitor.fold_member(_i.member),
1636 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &(it).0))),
1637 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001638 }
1639}
David Tolnay8c81f622018-07-31 23:34:35 -07001640#[cfg(any(feature = "full", feature = "derive"))]
1641#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001642pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001643 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001644 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1645 member: _visitor.fold_member(_i.member),
1646 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &(it).0))),
1647 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001648 }
1649}
David Tolnay8c81f622018-07-31 23:34:35 -07001650#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001651pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001652 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001653 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1654 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1655 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001656 }
1657}
David Tolnay8c81f622018-07-31 23:34:35 -07001658#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001659pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001660 FieldsNamed {
David Tolnay8c81f622018-07-31 23:34:35 -07001661 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
1662 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001663 }
1664}
David Tolnay8c81f622018-07-31 23:34:35 -07001665#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001666pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001667 FieldsUnnamed {
David Tolnay8c81f622018-07-31 23:34:35 -07001668 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
1669 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001670 }
1671}
David Tolnay8c81f622018-07-31 23:34:35 -07001672#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001673pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001674 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001675 shebang: _i.shebang,
1676 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1677 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001678 }
1679}
David Tolnay8c81f622018-07-31 23:34:35 -07001680#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001681pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001682 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001683 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1684 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1685 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1686 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1687 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001688 }
1689}
David Tolnay8c81f622018-07-31 23:34:35 -07001690#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001691pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001692 FnDecl {
David Tolnay8c81f622018-07-31 23:34:35 -07001693 fn_token: Token ! [ fn ](tokens_helper(_visitor, &(_i.fn_token).0)),
1694 generics: _visitor.fold_generics(_i.generics),
1695 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
1696 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
1697 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &(it).0))),
1698 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001699 }
1700}
David Tolnay8c81f622018-07-31 23:34:35 -07001701#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001702pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001703 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001704 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1705 ForeignItem::Static(_binding_0) => {
1706 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001707 }
David Tolnay8c81f622018-07-31 23:34:35 -07001708 ForeignItem::Type(_binding_0) => {
1709 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001710 }
David Tolnay8c81f622018-07-31 23:34:35 -07001711 ForeignItem::Verbatim(_binding_0) => {
1712 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001713 }
Nika Layzell27726662017-10-24 23:16:35 -04001714 }
1715}
David Tolnay8c81f622018-07-31 23:34:35 -07001716#[cfg(feature = "full")]
1717pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1718 _visitor: &mut V,
1719 _i: ForeignItemFn,
1720) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001721 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001722 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1723 vis: _visitor.fold_visibility(_i.vis),
1724 ident: _visitor.fold_ident(_i.ident),
1725 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
1726 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
David Tolnay8894f602017-11-11 12:11:04 -08001727 }
1728}
David Tolnay8c81f622018-07-31 23:34:35 -07001729#[cfg(feature = "full")]
1730pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1731 _visitor: &mut V,
1732 _i: ForeignItemStatic,
1733) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001734 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001735 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1736 vis: _visitor.fold_visibility(_i.vis),
1737 static_token: Token ! [ static ](tokens_helper(_visitor, &(_i.static_token).0)),
1738 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &(it).0))),
1739 ident: _visitor.fold_ident(_i.ident),
1740 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
1741 ty: Box::new(_visitor.fold_type(*_i.ty)),
1742 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04001743 }
1744}
David Tolnay8c81f622018-07-31 23:34:35 -07001745#[cfg(feature = "full")]
1746pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1747 _visitor: &mut V,
1748 _i: ForeignItemType,
1749) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001750 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001751 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1752 vis: _visitor.fold_visibility(_i.vis),
1753 type_token: Token ! [ type ](tokens_helper(_visitor, &(_i.type_token).0)),
1754 ident: _visitor.fold_ident(_i.ident),
1755 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001756 }
1757}
David Tolnay8c81f622018-07-31 23:34:35 -07001758#[cfg(feature = "full")]
1759pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1760 _visitor: &mut V,
1761 _i: ForeignItemVerbatim,
1762) -> ForeignItemVerbatim {
1763 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001764}
David Tolnay8c81f622018-07-31 23:34:35 -07001765#[cfg(any(feature = "full", feature = "derive"))]
1766pub fn fold_generic_argument<V: Fold + ?Sized>(
1767 _visitor: &mut V,
1768 _i: GenericArgument,
1769) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001770 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001771 GenericArgument::Lifetime(_binding_0) => {
1772 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001773 }
David Tolnay8c81f622018-07-31 23:34:35 -07001774 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1775 GenericArgument::Binding(_binding_0) => {
1776 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001777 }
David Tolnay8c81f622018-07-31 23:34:35 -07001778 GenericArgument::Const(_binding_0) => {
1779 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001780 }
Nika Layzell357885a2017-12-04 15:47:07 -05001781 }
1782}
David Tolnay8c81f622018-07-31 23:34:35 -07001783#[cfg(any(feature = "full", feature = "derive"))]
1784#[cfg(feature = "full")]
1785pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1786 _visitor: &mut V,
1787 _i: GenericMethodArgument,
1788) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001789 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001790 GenericMethodArgument::Type(_binding_0) => {
1791 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001792 }
David Tolnay8c81f622018-07-31 23:34:35 -07001793 GenericMethodArgument::Const(_binding_0) => {
1794 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001795 }
1796 }
1797}
David Tolnay8c81f622018-07-31 23:34:35 -07001798#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001799pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001800 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001801 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1802 GenericParam::Lifetime(_binding_0) => {
1803 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001804 }
David Tolnay8c81f622018-07-31 23:34:35 -07001805 GenericParam::Const(_binding_0) => {
1806 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001807 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001808 }
1809}
David Tolnay8c81f622018-07-31 23:34:35 -07001810#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001811pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001812 Generics {
David Tolnay8c81f622018-07-31 23:34:35 -07001813 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &(it).0))),
1814 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
1815 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &(it).0))),
1816 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001817 }
1818}
Alex Crichtond261d092018-05-18 13:47:35 -07001819
1820pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001821 let mut _i = _i;
1822 let span = _visitor.fold_span(_i.span());
1823 _i.set_span(span);
1824 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001825}
David Tolnay8c81f622018-07-31 23:34:35 -07001826#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001827pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001828 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001829 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1830 ImplItem::Method(_binding_0) => {
1831 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001832 }
David Tolnay8c81f622018-07-31 23:34:35 -07001833 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
1834 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1835 ImplItem::Verbatim(_binding_0) => {
1836 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001837 }
Nika Layzell27726662017-10-24 23:16:35 -04001838 }
1839}
David Tolnay8c81f622018-07-31 23:34:35 -07001840#[cfg(feature = "full")]
1841pub fn fold_impl_item_const<V: Fold + ?Sized>(
1842 _visitor: &mut V,
1843 _i: ImplItemConst,
1844) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001845 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001846 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1847 vis: _visitor.fold_visibility(_i.vis),
1848 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &(it).0))),
1849 const_token: Token ! [ const ](tokens_helper(_visitor, &(_i.const_token).0)),
1850 ident: _visitor.fold_ident(_i.ident),
1851 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
1852 ty: _visitor.fold_type(_i.ty),
1853 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
1854 expr: _visitor.fold_expr(_i.expr),
1855 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
David Tolnay857628c2017-11-11 12:25:31 -08001856 }
1857}
David Tolnay8c81f622018-07-31 23:34:35 -07001858#[cfg(feature = "full")]
1859pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1860 _visitor: &mut V,
1861 _i: ImplItemMacro,
1862) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001863 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001864 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1865 mac: _visitor.fold_macro(_i.mac),
1866 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &(it).0))),
David Tolnay857628c2017-11-11 12:25:31 -08001867 }
1868}
David Tolnay8c81f622018-07-31 23:34:35 -07001869#[cfg(feature = "full")]
1870pub fn fold_impl_item_method<V: Fold + ?Sized>(
1871 _visitor: &mut V,
1872 _i: ImplItemMethod,
1873) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001874 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001875 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1876 vis: _visitor.fold_visibility(_i.vis),
1877 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &(it).0))),
1878 sig: _visitor.fold_method_sig(_i.sig),
1879 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001880 }
1881}
David Tolnay8c81f622018-07-31 23:34:35 -07001882#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001883pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001884 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001885 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1886 vis: _visitor.fold_visibility(_i.vis),
1887 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &(it).0))),
1888 type_token: Token ! [ type ](tokens_helper(_visitor, &(_i.type_token).0)),
1889 ident: _visitor.fold_ident(_i.ident),
1890 generics: _visitor.fold_generics(_i.generics),
1891 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
1892 ty: _visitor.fold_type(_i.ty),
1893 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04001894 }
1895}
David Tolnay8c81f622018-07-31 23:34:35 -07001896#[cfg(feature = "full")]
1897pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1898 _visitor: &mut V,
1899 _i: ImplItemVerbatim,
1900) -> ImplItemVerbatim {
1901 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001902}
David Tolnay8c81f622018-07-31 23:34:35 -07001903#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001904pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001905 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001906 index: _i.index,
1907 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001908 }
1909}
David Tolnay8c81f622018-07-31 23:34:35 -07001910#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001911pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001912 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001913 Item::ExternCrate(_binding_0) => {
1914 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001915 }
David Tolnay8c81f622018-07-31 23:34:35 -07001916 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1917 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1918 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1919 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1920 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1921 Item::ForeignMod(_binding_0) => {
1922 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001923 }
David Tolnay8c81f622018-07-31 23:34:35 -07001924 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
1925 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1926 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1927 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1928 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
1929 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1930 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1931 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1932 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001933 }
1934}
David Tolnay8c81f622018-07-31 23:34:35 -07001935#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001936pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001937 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001938 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1939 vis: _visitor.fold_visibility(_i.vis),
1940 const_token: Token ! [ const ](tokens_helper(_visitor, &(_i.const_token).0)),
1941 ident: _visitor.fold_ident(_i.ident),
1942 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
1943 ty: Box::new(_visitor.fold_type(*_i.ty)),
1944 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
1945 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1946 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001947 }
1948}
David Tolnay8c81f622018-07-31 23:34:35 -07001949#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001950pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001951 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001952 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1953 vis: _visitor.fold_visibility(_i.vis),
1954 enum_token: Token ! [ enum ](tokens_helper(_visitor, &(_i.enum_token).0)),
1955 ident: _visitor.fold_ident(_i.ident),
1956 generics: _visitor.fold_generics(_i.generics),
1957 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
1958 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001959 }
1960}
David Tolnay8c81f622018-07-31 23:34:35 -07001961#[cfg(feature = "full")]
1962pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1963 _visitor: &mut V,
1964 _i: ItemExternCrate,
1965) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001966 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001967 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1968 vis: _visitor.fold_visibility(_i.vis),
1969 extern_token: Token![extern](tokens_helper(_visitor, &(_i.extern_token).0)),
1970 crate_token: Token![crate](tokens_helper(_visitor, &(_i.crate_token).0)),
1971 ident: _visitor.fold_ident(_i.ident),
1972 rename: (_i.rename).map(|it| {
1973 (
1974 Token ! [ as ](tokens_helper(_visitor, &((it).0).0)),
1975 _visitor.fold_ident((it).1),
1976 )
1977 }),
1978 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001979 }
1980}
David Tolnay8c81f622018-07-31 23:34:35 -07001981#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001982pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001983 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001984 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1985 vis: _visitor.fold_visibility(_i.vis),
1986 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &(it).0))),
1987 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &(it).0))),
1988 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
1989 ident: _visitor.fold_ident(_i.ident),
1990 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
1991 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001992 }
1993}
David Tolnay8c81f622018-07-31 23:34:35 -07001994#[cfg(feature = "full")]
1995pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
1996 _visitor: &mut V,
1997 _i: ItemForeignMod,
1998) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001999 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002000 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2001 abi: _visitor.fold_abi(_i.abi),
2002 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
2003 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002004 }
2005}
David Tolnay8c81f622018-07-31 23:34:35 -07002006#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002007pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002008 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002009 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2010 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &(it).0))),
2011 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &(it).0))),
2012 impl_token: Token![impl ](tokens_helper(_visitor, &(_i.impl_token).0)),
2013 generics: _visitor.fold_generics(_i.generics),
2014 trait_: (_i.trait_).map(|it| {
2015 (
2016 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &(it).0))),
2017 _visitor.fold_path((it).1),
2018 Token ! [ for ](tokens_helper(_visitor, &((it).2).0)),
2019 )
2020 }),
2021 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
2022 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
2023 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002024 }
2025}
David Tolnay8c81f622018-07-31 23:34:35 -07002026#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002027pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002028 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002029 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2030 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2031 mac: _visitor.fold_macro(_i.mac),
2032 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &(it).0))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002033 }
2034}
David Tolnay8c81f622018-07-31 23:34:35 -07002035#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002036pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002037 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002038 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2039 vis: _visitor.fold_visibility(_i.vis),
2040 macro_token: Token ! [ macro ](tokens_helper(_visitor, &(_i.macro_token).0)),
2041 ident: _visitor.fold_ident(_i.ident),
2042 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
2043 args: _i.args,
2044 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
2045 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002046 }
2047}
David Tolnay8c81f622018-07-31 23:34:35 -07002048#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002049pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002050 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002051 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2052 vis: _visitor.fold_visibility(_i.vis),
2053 mod_token: Token ! [ mod ](tokens_helper(_visitor, &(_i.mod_token).0)),
2054 ident: _visitor.fold_ident(_i.ident),
2055 content: (_i.content).map(|it| {
2056 (
2057 Brace(tokens_helper(_visitor, &((it).0).0)),
2058 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2059 )
2060 }),
2061 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &(it).0))),
Nika Layzell27726662017-10-24 23:16:35 -04002062 }
2063}
David Tolnay8c81f622018-07-31 23:34:35 -07002064#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002065pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002066 ItemStatic {
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),
2069 static_token: Token ! [ static ](tokens_helper(_visitor, &(_i.static_token).0)),
2070 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &(it).0))),
2071 ident: _visitor.fold_ident(_i.ident),
2072 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
2073 ty: Box::new(_visitor.fold_type(*_i.ty)),
2074 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
2075 expr: Box::new(_visitor.fold_expr(*_i.expr)),
2076 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002077 }
2078}
David Tolnay8c81f622018-07-31 23:34:35 -07002079#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002080pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002081 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002082 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2083 vis: _visitor.fold_visibility(_i.vis),
2084 struct_token: Token ! [ struct ](tokens_helper(_visitor, &(_i.struct_token).0)),
2085 ident: _visitor.fold_ident(_i.ident),
2086 generics: _visitor.fold_generics(_i.generics),
2087 fields: _visitor.fold_fields(_i.fields),
2088 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &(it).0))),
Nika Layzell27726662017-10-24 23:16:35 -04002089 }
2090}
David Tolnay8c81f622018-07-31 23:34:35 -07002091#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002092pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002093 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002094 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2095 vis: _visitor.fold_visibility(_i.vis),
2096 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &(it).0))),
2097 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &(it).0))),
2098 trait_token: Token ! [ trait ](tokens_helper(_visitor, &(_i.trait_token).0)),
2099 ident: _visitor.fold_ident(_i.ident),
2100 generics: _visitor.fold_generics(_i.generics),
2101 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &(it).0))),
2102 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
2103 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
2104 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002105 }
2106}
David Tolnay8c81f622018-07-31 23:34:35 -07002107#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002108pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002109 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002110 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2111 vis: _visitor.fold_visibility(_i.vis),
2112 type_token: Token ! [ type ](tokens_helper(_visitor, &(_i.type_token).0)),
2113 ident: _visitor.fold_ident(_i.ident),
2114 generics: _visitor.fold_generics(_i.generics),
2115 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
2116 ty: Box::new(_visitor.fold_type(*_i.ty)),
2117 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002118 }
2119}
David Tolnay8c81f622018-07-31 23:34:35 -07002120#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002121pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002122 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002123 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2124 vis: _visitor.fold_visibility(_i.vis),
2125 union_token: Token![union](tokens_helper(_visitor, &(_i.union_token).0)),
2126 ident: _visitor.fold_ident(_i.ident),
2127 generics: _visitor.fold_generics(_i.generics),
2128 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002129 }
2130}
David Tolnay8c81f622018-07-31 23:34:35 -07002131#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002132pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002133 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002134 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2135 vis: _visitor.fold_visibility(_i.vis),
2136 use_token: Token ! [ use ](tokens_helper(_visitor, &(_i.use_token).0)),
2137 leading_colon: (_i.leading_colon)
2138 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &(it).0))),
2139 tree: _visitor.fold_use_tree(_i.tree),
2140 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002141 }
2142}
David Tolnay8c81f622018-07-31 23:34:35 -07002143#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002144pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002145 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002146}
David Tolnay8c81f622018-07-31 23:34:35 -07002147#[cfg(any(feature = "full", feature = "derive"))]
2148#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002149pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002150 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002151 name: _visitor.fold_lifetime(_i.name),
2152 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002153 }
2154}
David Tolnay8c81f622018-07-31 23:34:35 -07002155#[cfg(any(feature = "full", feature = "derive"))]
Alex Crichton131308c2018-05-18 14:00:24 -07002156pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2157 Lifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002158 apostrophe: _i.apostrophe,
2159 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002160 }
2161}
David Tolnay8c81f622018-07-31 23:34:35 -07002162#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002163pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002164 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002165 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2166 lifetime: _visitor.fold_lifetime(_i.lifetime),
2167 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &(it).0))),
2168 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002169 }
2170}
David Tolnay8c81f622018-07-31 23:34:35 -07002171#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002172pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002173 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002174 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2175 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2176 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2177 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2178 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2179 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2180 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2181 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002182 }
2183}
David Tolnay8c81f622018-07-31 23:34:35 -07002184#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002185pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002186 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002187 value: _i.value,
2188 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002189 }
2190}
David Tolnay8c81f622018-07-31 23:34:35 -07002191#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002192pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002193 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002194}
David Tolnay8c81f622018-07-31 23:34:35 -07002195#[cfg(any(feature = "full", feature = "derive"))]
2196#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002197pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002198 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002199 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2200 let_token: Token ! [ let ](tokens_helper(_visitor, &(_i.let_token).0)),
2201 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2202 ty: (_i.ty).map(|it| {
2203 (
2204 Token ! [ : ](tokens_helper(_visitor, &((it).0).0)),
2205 Box::new(_visitor.fold_type(*(it).1)),
2206 )
2207 }),
2208 init: (_i.init).map(|it| {
2209 (
2210 Token ! [ = ](tokens_helper(_visitor, &((it).0).0)),
2211 Box::new(_visitor.fold_expr(*(it).1)),
2212 )
2213 }),
2214 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002215 }
2216}
David Tolnay8c81f622018-07-31 23:34:35 -07002217#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002218pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002219 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002220 path: _visitor.fold_path(_i.path),
2221 bang_token: Token![!](tokens_helper(_visitor, &(_i.bang_token).0)),
2222 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2223 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002224 }
2225}
David Tolnay8c81f622018-07-31 23:34:35 -07002226#[cfg(any(feature = "full", feature = "derive"))]
2227pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2228 _visitor: &mut V,
2229 _i: MacroDelimiter,
2230) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002231 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002232 MacroDelimiter::Paren(_binding_0) => {
2233 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &(_binding_0).0)))
David Tolnayab919512017-12-30 23:31:51 -05002234 }
David Tolnay8c81f622018-07-31 23:34:35 -07002235 MacroDelimiter::Brace(_binding_0) => {
2236 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &(_binding_0).0)))
David Tolnayab919512017-12-30 23:31:51 -05002237 }
David Tolnay8c81f622018-07-31 23:34:35 -07002238 MacroDelimiter::Bracket(_binding_0) => {
2239 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &(_binding_0).0)))
David Tolnayab919512017-12-30 23:31:51 -05002240 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002241 }
2242}
David Tolnay8c81f622018-07-31 23:34:35 -07002243#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002244pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002245 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002246 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2247 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002248 }
2249}
David Tolnay8c81f622018-07-31 23:34:35 -07002250#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002251pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002252 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002253 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2254 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2255 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002256 }
2257}
David Tolnay8c81f622018-07-31 23:34:35 -07002258#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002259pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2260 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002261 ident: _visitor.fold_ident(_i.ident),
2262 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
2263 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002264 }
2265}
David Tolnay8c81f622018-07-31 23:34:35 -07002266#[cfg(any(feature = "full", feature = "derive"))]
2267pub fn fold_meta_name_value<V: Fold + ?Sized>(
2268 _visitor: &mut V,
2269 _i: MetaNameValue,
2270) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002271 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002272 ident: _visitor.fold_ident(_i.ident),
2273 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
2274 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002275 }
2276}
David Tolnay8c81f622018-07-31 23:34:35 -07002277#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002278pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002279 MethodSig {
David Tolnay8c81f622018-07-31 23:34:35 -07002280 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &(it).0))),
2281 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &(it).0))),
2282 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2283 ident: _visitor.fold_ident(_i.ident),
2284 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002285 }
2286}
David Tolnay8c81f622018-07-31 23:34:35 -07002287#[cfg(any(feature = "full", feature = "derive"))]
2288#[cfg(feature = "full")]
2289pub fn fold_method_turbofish<V: Fold + ?Sized>(
2290 _visitor: &mut V,
2291 _i: MethodTurbofish,
2292) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002293 MethodTurbofish {
David Tolnay8c81f622018-07-31 23:34:35 -07002294 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &(_i.colon2_token).0)),
2295 lt_token: Token ! [ < ](tokens_helper(_visitor, &(_i.lt_token).0)),
2296 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
2297 gt_token: Token ! [ > ](tokens_helper(_visitor, &(_i.gt_token).0)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002298 }
2299}
David Tolnay8c81f622018-07-31 23:34:35 -07002300#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002301pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002302 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002303 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2304 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002305 }
2306}
David Tolnay8c81f622018-07-31 23:34:35 -07002307#[cfg(any(feature = "full", feature = "derive"))]
2308pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2309 _visitor: &mut V,
2310 _i: ParenthesizedGenericArguments,
2311) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002312 ParenthesizedGenericArguments {
David Tolnay8c81f622018-07-31 23:34:35 -07002313 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
2314 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2315 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002316 }
2317}
David Tolnay8c81f622018-07-31 23:34:35 -07002318#[cfg(any(feature = "full", feature = "derive"))]
2319#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002320pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002321 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002322 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2323 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2324 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2325 Pat::TupleStruct(_binding_0) => {
2326 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002327 }
David Tolnay8c81f622018-07-31 23:34:35 -07002328 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2329 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2330 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2331 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2332 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2333 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2334 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2335 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2336 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002337 }
2338}
David Tolnay8c81f622018-07-31 23:34:35 -07002339#[cfg(any(feature = "full", feature = "derive"))]
2340#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002341pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002342 PatBox {
David Tolnay8c81f622018-07-31 23:34:35 -07002343 box_token: Token ! [ box ](tokens_helper(_visitor, &(_i.box_token).0)),
2344 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002345 }
2346}
David Tolnay8c81f622018-07-31 23:34:35 -07002347#[cfg(any(feature = "full", feature = "derive"))]
2348#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002349pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002350 PatIdent {
David Tolnay8c81f622018-07-31 23:34:35 -07002351 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &(it).0))),
2352 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &(it).0))),
2353 ident: _visitor.fold_ident(_i.ident),
2354 subpat: (_i.subpat).map(|it| {
2355 (
2356 Token ! [ @ ](tokens_helper(_visitor, &((it).0).0)),
2357 Box::new(_visitor.fold_pat(*(it).1)),
2358 )
2359 }),
Nika Layzell27726662017-10-24 23:16:35 -04002360 }
2361}
David Tolnay8c81f622018-07-31 23:34:35 -07002362#[cfg(any(feature = "full", feature = "derive"))]
2363#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002364pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002365 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002366 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002367 }
2368}
David Tolnay8c81f622018-07-31 23:34:35 -07002369#[cfg(any(feature = "full", feature = "derive"))]
2370#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002371pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002372 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002373 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002374 }
2375}
David Tolnay8c81f622018-07-31 23:34:35 -07002376#[cfg(any(feature = "full", feature = "derive"))]
2377#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002378pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002379 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002380 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2381 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002382 }
2383}
David Tolnay8c81f622018-07-31 23:34:35 -07002384#[cfg(any(feature = "full", feature = "derive"))]
2385#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002386pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002387 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002388 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2389 limits: _visitor.fold_range_limits(_i.limits),
2390 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002391 }
2392}
David Tolnay8c81f622018-07-31 23:34:35 -07002393#[cfg(any(feature = "full", feature = "derive"))]
2394#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002395pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002396 PatRef {
David Tolnay8c81f622018-07-31 23:34:35 -07002397 and_token: Token ! [ & ](tokens_helper(_visitor, &(_i.and_token).0)),
2398 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &(it).0))),
2399 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002400 }
2401}
David Tolnay8c81f622018-07-31 23:34:35 -07002402#[cfg(any(feature = "full", feature = "derive"))]
2403#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002404pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002405 PatSlice {
David Tolnay8c81f622018-07-31 23:34:35 -07002406 bracket_token: Bracket(tokens_helper(_visitor, &(_i.bracket_token).0)),
2407 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2408 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
2409 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &(it).0))),
2410 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &(it).0))),
2411 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002412 }
2413}
David Tolnay8c81f622018-07-31 23:34:35 -07002414#[cfg(any(feature = "full", feature = "derive"))]
2415#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002416pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002417 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002418 path: _visitor.fold_path(_i.path),
2419 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
2420 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
2421 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &(it).0))),
Nika Layzell27726662017-10-24 23:16:35 -04002422 }
2423}
David Tolnay8c81f622018-07-31 23:34:35 -07002424#[cfg(any(feature = "full", feature = "derive"))]
2425#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002426pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002427 PatTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07002428 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
2429 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2430 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &(it).0))),
2431 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &(it).0))),
2432 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002433 }
2434}
David Tolnay8c81f622018-07-31 23:34:35 -07002435#[cfg(any(feature = "full", feature = "derive"))]
2436#[cfg(feature = "full")]
2437pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2438 _visitor: &mut V,
2439 _i: PatTupleStruct,
2440) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002441 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002442 path: _visitor.fold_path(_i.path),
2443 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002444 }
2445}
David Tolnay8c81f622018-07-31 23:34:35 -07002446#[cfg(any(feature = "full", feature = "derive"))]
2447#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002448pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002449 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002450}
David Tolnay8c81f622018-07-31 23:34:35 -07002451#[cfg(any(feature = "full", feature = "derive"))]
2452#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002453pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002454 PatWild {
David Tolnay8c81f622018-07-31 23:34:35 -07002455 underscore_token: Token![_](tokens_helper(_visitor, &(_i.underscore_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002456 }
2457}
David Tolnay8c81f622018-07-31 23:34:35 -07002458#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002459pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002460 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002461 leading_colon: (_i.leading_colon)
2462 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &(it).0))),
2463 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002464 }
2465}
David Tolnay8c81f622018-07-31 23:34:35 -07002466#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002467pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002468 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002469 PathArguments::None => PathArguments::None,
2470 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2471 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2472 ),
2473 PathArguments::Parenthesized(_binding_0) => {
2474 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002475 }
2476 }
2477}
David Tolnay8c81f622018-07-31 23:34:35 -07002478#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002479pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002480 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002481 ident: _visitor.fold_ident(_i.ident),
2482 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002483 }
2484}
David Tolnay8c81f622018-07-31 23:34:35 -07002485#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002486pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002487 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002488 lhs_ty: _visitor.fold_type(_i.lhs_ty),
2489 eq_token: Token ! [ = ](tokens_helper(_visitor, &(_i.eq_token).0)),
2490 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002491 }
2492}
David Tolnay8c81f622018-07-31 23:34:35 -07002493#[cfg(any(feature = "full", feature = "derive"))]
2494pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2495 _visitor: &mut V,
2496 _i: PredicateLifetime,
2497) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002498 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002499 lifetime: _visitor.fold_lifetime(_i.lifetime),
2500 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &(it).0))),
2501 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002502 }
2503}
David Tolnay8c81f622018-07-31 23:34:35 -07002504#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002505pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002506 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002507 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2508 bounded_ty: _visitor.fold_type(_i.bounded_ty),
2509 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
2510 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002511 }
2512}
David Tolnay8c81f622018-07-31 23:34:35 -07002513#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002514pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002515 QSelf {
David Tolnay8c81f622018-07-31 23:34:35 -07002516 lt_token: Token ! [ < ](tokens_helper(_visitor, &(_i.lt_token).0)),
2517 ty: Box::new(_visitor.fold_type(*_i.ty)),
2518 position: _i.position,
2519 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &(it).0))),
2520 gt_token: Token ! [ > ](tokens_helper(_visitor, &(_i.gt_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002521 }
2522}
David Tolnay8c81f622018-07-31 23:34:35 -07002523#[cfg(any(feature = "full", feature = "derive"))]
2524#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002525pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002526 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002527 RangeLimits::HalfOpen(_binding_0) => {
2528 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04002529 }
David Tolnay8c81f622018-07-31 23:34:35 -07002530 RangeLimits::Closed(_binding_0) => {
2531 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04002532 }
2533 }
2534}
David Tolnay8c81f622018-07-31 23:34:35 -07002535#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002536pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002537 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002538 ReturnType::Default => ReturnType::Default,
2539 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
2540 Token ! [ -> ](tokens_helper(_visitor, &(_binding_0).0)),
2541 Box::new(_visitor.fold_type(*_binding_1)),
2542 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002543 }
2544}
Nika Layzellefb83ba2017-12-19 18:23:55 -05002545
David Tolnay4b4c4b62018-01-06 13:48:05 -08002546pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002547 _i
2548}
David Tolnay8c81f622018-07-31 23:34:35 -07002549#[cfg(any(feature = "full", feature = "derive"))]
2550#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002551pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002552 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002553 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2554 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2555 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2556 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2557 _visitor.fold_expr(_binding_0),
2558 Token ! [ ; ](tokens_helper(_visitor, &(_binding_1).0)),
2559 ),
Nika Layzell27726662017-10-24 23:16:35 -04002560 }
2561}
David Tolnay8c81f622018-07-31 23:34:35 -07002562#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002563pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002564 TraitBound {
David Tolnay8c81f622018-07-31 23:34:35 -07002565 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &(it).0))),
2566 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2567 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2568 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002569 }
2570}
David Tolnay8c81f622018-07-31 23:34:35 -07002571#[cfg(any(feature = "full", feature = "derive"))]
2572pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2573 _visitor: &mut V,
2574 _i: TraitBoundModifier,
2575) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002576 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002577 TraitBoundModifier::None => TraitBoundModifier::None,
2578 TraitBoundModifier::Maybe(_binding_0) => {
2579 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04002580 }
2581 }
2582}
David Tolnay8c81f622018-07-31 23:34:35 -07002583#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002584pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002585 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002586 TraitItem::Const(_binding_0) => {
2587 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002588 }
David Tolnay8c81f622018-07-31 23:34:35 -07002589 TraitItem::Method(_binding_0) => {
2590 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002591 }
David Tolnay8c81f622018-07-31 23:34:35 -07002592 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2593 TraitItem::Macro(_binding_0) => {
2594 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002595 }
David Tolnay8c81f622018-07-31 23:34:35 -07002596 TraitItem::Verbatim(_binding_0) => {
2597 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002598 }
Nika Layzell27726662017-10-24 23:16:35 -04002599 }
2600}
David Tolnay8c81f622018-07-31 23:34:35 -07002601#[cfg(feature = "full")]
2602pub fn fold_trait_item_const<V: Fold + ?Sized>(
2603 _visitor: &mut V,
2604 _i: TraitItemConst,
2605) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002606 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002607 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2608 const_token: Token ! [ const ](tokens_helper(_visitor, &(_i.const_token).0)),
2609 ident: _visitor.fold_ident(_i.ident),
2610 colon_token: Token ! [ : ](tokens_helper(_visitor, &(_i.colon_token).0)),
2611 ty: _visitor.fold_type(_i.ty),
2612 default: (_i.default).map(|it| {
2613 (
2614 Token ! [ = ](tokens_helper(_visitor, &((it).0).0)),
2615 _visitor.fold_expr((it).1),
2616 )
2617 }),
2618 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
David Tolnayda705bd2017-11-10 21:58:05 -08002619 }
2620}
David Tolnay8c81f622018-07-31 23:34:35 -07002621#[cfg(feature = "full")]
2622pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2623 _visitor: &mut V,
2624 _i: TraitItemMacro,
2625) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002626 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002627 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2628 mac: _visitor.fold_macro(_i.mac),
2629 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &(it).0))),
David Tolnayda705bd2017-11-10 21:58:05 -08002630 }
2631}
David Tolnay8c81f622018-07-31 23:34:35 -07002632#[cfg(feature = "full")]
2633pub fn fold_trait_item_method<V: Fold + ?Sized>(
2634 _visitor: &mut V,
2635 _i: TraitItemMethod,
2636) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002637 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002638 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2639 sig: _visitor.fold_method_sig(_i.sig),
2640 default: (_i.default).map(|it| _visitor.fold_block(it)),
2641 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &(it).0))),
Nika Layzell27726662017-10-24 23:16:35 -04002642 }
2643}
David Tolnay8c81f622018-07-31 23:34:35 -07002644#[cfg(feature = "full")]
2645pub fn fold_trait_item_type<V: Fold + ?Sized>(
2646 _visitor: &mut V,
2647 _i: TraitItemType,
2648) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002649 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002650 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2651 type_token: Token ! [ type ](tokens_helper(_visitor, &(_i.type_token).0)),
2652 ident: _visitor.fold_ident(_i.ident),
2653 generics: _visitor.fold_generics(_i.generics),
2654 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &(it).0))),
2655 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2656 default: (_i.default).map(|it| {
2657 (
2658 Token ! [ = ](tokens_helper(_visitor, &((it).0).0)),
2659 _visitor.fold_type((it).1),
2660 )
2661 }),
2662 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002663 }
2664}
David Tolnay8c81f622018-07-31 23:34:35 -07002665#[cfg(feature = "full")]
2666pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2667 _visitor: &mut V,
2668 _i: TraitItemVerbatim,
2669) -> TraitItemVerbatim {
2670 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002671}
David Tolnay8c81f622018-07-31 23:34:35 -07002672#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002673pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002674 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002675 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2676 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2677 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2678 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2679 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2680 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2681 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2682 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2683 Type::TraitObject(_binding_0) => {
2684 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002685 }
David Tolnay8c81f622018-07-31 23:34:35 -07002686 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2687 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2688 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2689 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2690 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2691 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002692 }
2693}
David Tolnay8c81f622018-07-31 23:34:35 -07002694#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002695pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002696 TypeArray {
David Tolnay8c81f622018-07-31 23:34:35 -07002697 bracket_token: Bracket(tokens_helper(_visitor, &(_i.bracket_token).0)),
2698 elem: Box::new(_visitor.fold_type(*_i.elem)),
2699 semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i.semi_token).0)),
2700 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002701 }
2702}
David Tolnay8c81f622018-07-31 23:34:35 -07002703#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002704pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002705 TypeBareFn {
David Tolnay8c81f622018-07-31 23:34:35 -07002706 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &(it).0))),
2707 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2708 fn_token: Token ! [ fn ](tokens_helper(_visitor, &(_i.fn_token).0)),
2709 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2710 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
2711 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
2712 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &(it).0))),
2713 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002714 }
2715}
David Tolnay8c81f622018-07-31 23:34:35 -07002716#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002717pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002718 TypeGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07002719 group_token: Group(tokens_helper(_visitor, &(_i.group_token).0)),
2720 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002721 }
2722}
David Tolnay8c81f622018-07-31 23:34:35 -07002723#[cfg(any(feature = "full", feature = "derive"))]
2724pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2725 _visitor: &mut V,
2726 _i: TypeImplTrait,
2727) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002728 TypeImplTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002729 impl_token: Token![impl ](tokens_helper(_visitor, &(_i.impl_token).0)),
2730 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002731 }
2732}
David Tolnay8c81f622018-07-31 23:34:35 -07002733#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002734pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002735 TypeInfer {
David Tolnay8c81f622018-07-31 23:34:35 -07002736 underscore_token: Token![_](tokens_helper(_visitor, &(_i.underscore_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002737 }
2738}
David Tolnay8c81f622018-07-31 23:34:35 -07002739#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002740pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002741 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002742 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002743 }
2744}
David Tolnay8c81f622018-07-31 23:34:35 -07002745#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002746pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002747 TypeNever {
David Tolnay8c81f622018-07-31 23:34:35 -07002748 bang_token: Token![!](tokens_helper(_visitor, &(_i.bang_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002749 }
2750}
David Tolnay8c81f622018-07-31 23:34:35 -07002751#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002752pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002753 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002754 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2755 ident: _visitor.fold_ident(_i.ident),
2756 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &(it).0))),
2757 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2758 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &(it).0))),
2759 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002760 }
2761}
David Tolnay8c81f622018-07-31 23:34:35 -07002762#[cfg(any(feature = "full", feature = "derive"))]
2763pub fn fold_type_param_bound<V: Fold + ?Sized>(
2764 _visitor: &mut V,
2765 _i: TypeParamBound,
2766) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002767 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002768 TypeParamBound::Trait(_binding_0) => {
2769 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002770 }
David Tolnay8c81f622018-07-31 23:34:35 -07002771 TypeParamBound::Lifetime(_binding_0) => {
2772 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002773 }
2774 }
2775}
David Tolnay8c81f622018-07-31 23:34:35 -07002776#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002777pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002778 TypeParen {
David Tolnay8c81f622018-07-31 23:34:35 -07002779 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
2780 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002781 }
2782}
David Tolnay8c81f622018-07-31 23:34:35 -07002783#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002784pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002785 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002786 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2787 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002788 }
2789}
David Tolnay8c81f622018-07-31 23:34:35 -07002790#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002791pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002792 TypePtr {
David Tolnay8c81f622018-07-31 23:34:35 -07002793 star_token: Token ! [ * ](tokens_helper(_visitor, &(_i.star_token).0)),
2794 const_token: (_i.const_token).map(|it| Token ! [ const ](tokens_helper(_visitor, &(it).0))),
2795 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &(it).0))),
2796 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002797 }
2798}
David Tolnay8c81f622018-07-31 23:34:35 -07002799#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002800pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002801 TypeReference {
David Tolnay8c81f622018-07-31 23:34:35 -07002802 and_token: Token ! [ & ](tokens_helper(_visitor, &(_i.and_token).0)),
2803 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
2804 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &(it).0))),
2805 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002806 }
2807}
David Tolnay8c81f622018-07-31 23:34:35 -07002808#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002809pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002810 TypeSlice {
David Tolnay8c81f622018-07-31 23:34:35 -07002811 bracket_token: Bracket(tokens_helper(_visitor, &(_i.bracket_token).0)),
2812 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002813 }
2814}
David Tolnay8c81f622018-07-31 23:34:35 -07002815#[cfg(any(feature = "full", feature = "derive"))]
2816pub fn fold_type_trait_object<V: Fold + ?Sized>(
2817 _visitor: &mut V,
2818 _i: TypeTraitObject,
2819) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002820 TypeTraitObject {
David Tolnay8c81f622018-07-31 23:34:35 -07002821 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &(it).0))),
2822 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002823 }
2824}
David Tolnay8c81f622018-07-31 23:34:35 -07002825#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002826pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002827 TypeTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07002828 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
2829 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(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_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002834 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002835}
David Tolnay8c81f622018-07-31 23:34:35 -07002836#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002837pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002838 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002839 UnOp::Deref(_binding_0) => {
2840 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &(_binding_0).0)))
Nika Layzell27726662017-10-24 23:16:35 -04002841 }
David Tolnay8c81f622018-07-31 23:34:35 -07002842 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &(_binding_0).0))),
2843 UnOp::Neg(_binding_0) => UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &(_binding_0).0))),
Nika Layzell27726662017-10-24 23:16:35 -04002844 }
2845}
David Tolnay8c81f622018-07-31 23:34:35 -07002846#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002847pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002848 UseGlob {
David Tolnay8c81f622018-07-31 23:34:35 -07002849 star_token: Token ! [ * ](tokens_helper(_visitor, &(_i.star_token).0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002850 }
2851}
David Tolnay8c81f622018-07-31 23:34:35 -07002852#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002853pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2854 UseGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07002855 brace_token: Brace(tokens_helper(_visitor, &(_i.brace_token).0)),
2856 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002857 }
2858}
David Tolnay8c81f622018-07-31 23:34:35 -07002859#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002860pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2861 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002862 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002863 }
2864}
David Tolnay8c81f622018-07-31 23:34:35 -07002865#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002866pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002867 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002868 ident: _visitor.fold_ident(_i.ident),
2869 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &(_i.colon2_token).0)),
2870 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002871 }
2872}
David Tolnay8c81f622018-07-31 23:34:35 -07002873#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002874pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2875 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002876 ident: _visitor.fold_ident(_i.ident),
2877 as_token: Token ! [ as ](tokens_helper(_visitor, &(_i.as_token).0)),
2878 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002879 }
2880}
David Tolnay8c81f622018-07-31 23:34:35 -07002881#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002882pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002883 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002884 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2885 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2886 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2887 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2888 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002889 }
2890}
David Tolnay8c81f622018-07-31 23:34:35 -07002891#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002892pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002893 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002894 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2895 ident: _visitor.fold_ident(_i.ident),
2896 fields: _visitor.fold_fields(_i.fields),
2897 discriminant: (_i.discriminant).map(|it| {
2898 (
2899 Token ! [ = ](tokens_helper(_visitor, &((it).0).0)),
2900 _visitor.fold_expr((it).1),
2901 )
2902 }),
Nika Layzell27726662017-10-24 23:16:35 -04002903 }
2904}
David Tolnay8c81f622018-07-31 23:34:35 -07002905#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002906pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002907 VisCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07002908 crate_token: Token![crate](tokens_helper(_visitor, &(_i.crate_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002909 }
2910}
David Tolnay8c81f622018-07-31 23:34:35 -07002911#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002912pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002913 VisPublic {
David Tolnay8c81f622018-07-31 23:34:35 -07002914 pub_token: Token ! [ pub ](tokens_helper(_visitor, &(_i.pub_token).0)),
Nika Layzell27726662017-10-24 23:16:35 -04002915 }
2916}
David Tolnay8c81f622018-07-31 23:34:35 -07002917#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002918pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002919 VisRestricted {
David Tolnay8c81f622018-07-31 23:34:35 -07002920 pub_token: Token ! [ pub ](tokens_helper(_visitor, &(_i.pub_token).0)),
2921 paren_token: Paren(tokens_helper(_visitor, &(_i.paren_token).0)),
2922 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &(it).0))),
2923 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002924 }
2925}
David Tolnay8c81f622018-07-31 23:34:35 -07002926#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002927pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002928 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002929 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2930 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2931 Visibility::Restricted(_binding_0) => {
2932 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002933 }
David Tolnay8c81f622018-07-31 23:34:35 -07002934 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04002935 }
2936}
David Tolnay8c81f622018-07-31 23:34:35 -07002937#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002938pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002939 WhereClause {
David Tolnay8c81f622018-07-31 23:34:35 -07002940 where_token: Token ! [ where ](tokens_helper(_visitor, &(_i.where_token).0)),
2941 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002942 }
2943}
David Tolnay8c81f622018-07-31 23:34:35 -07002944#[cfg(any(feature = "full", feature = "derive"))]
2945pub fn fold_where_predicate<V: Fold + ?Sized>(
2946 _visitor: &mut V,
2947 _i: WherePredicate,
2948) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002949 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002950 WherePredicate::Type(_binding_0) => {
2951 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002952 }
David Tolnay8c81f622018-07-31 23:34:35 -07002953 WherePredicate::Lifetime(_binding_0) => {
2954 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002955 }
David Tolnay8c81f622018-07-31 23:34:35 -07002956 WherePredicate::Eq(_binding_0) => {
2957 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002958 }
2959 }
2960}