blob: 450aec98a45949b114c8f28f71b2196da0e9348f [file] [log] [blame]
Nika Layzell27726662017-10-24 23:16:35 -04001// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
2
Nika Layzell27726662017-10-24 23:16:35 -04003#![allow(unreachable_code)]
David Tolnayf0d63bf2017-12-26 12:29:47 -05004#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
David Tolnay0a0d78c2018-01-05 15:24:01 -08005#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05006use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07007use proc_macro2::Span;
8#[cfg(any(feature = "full", feature = "derive"))]
9use token::{Brace, Bracket, Group, Paren};
10use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040011#[cfg(feature = "full")]
12macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070013 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070014 $e
15 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040016}
David Tolnay0a0d78c2018-01-05 15:24:01 -080017#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040018macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070019 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070020 unreachable!()
21 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040022}
David Tolnay6af48992018-08-01 11:16:28 -070023#[doc = r" Syntax tree traversal to transform the nodes of an owned syntax tree."]
24#[doc = r""]
25#[doc = r" See the [module documentation] for details."]
26#[doc = r""]
27#[doc = r" [module documentation]: index.html"]
28#[doc = r""]
29#[doc = r#" *This trait is available if Syn is built with the `"fold"` feature.*"#]
David Tolnay4b4c4b62018-01-06 13:48:05 -080030pub trait Fold {
David Tolnay8c81f622018-07-31 23:34:35 -070031 #[cfg(any(feature = "full", feature = "derive"))]
32 fn fold_abi(&mut self, i: Abi) -> Abi {
33 fold_abi(self, i)
34 }
35 #[cfg(any(feature = "full", feature = "derive"))]
36 fn fold_angle_bracketed_generic_arguments(
37 &mut self,
38 i: AngleBracketedGenericArguments,
39 ) -> AngleBracketedGenericArguments {
40 fold_angle_bracketed_generic_arguments(self, i)
41 }
42 #[cfg(feature = "full")]
43 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
44 fold_arg_captured(self, i)
45 }
46 #[cfg(feature = "full")]
47 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
48 fold_arg_self(self, i)
49 }
50 #[cfg(feature = "full")]
51 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
52 fold_arg_self_ref(self, i)
53 }
54 #[cfg(any(feature = "full", feature = "derive"))]
55 #[cfg(feature = "full")]
56 fn fold_arm(&mut self, i: Arm) -> Arm {
57 fold_arm(self, i)
58 }
59 #[cfg(any(feature = "full", feature = "derive"))]
60 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
61 fold_attr_style(self, i)
62 }
63 #[cfg(any(feature = "full", feature = "derive"))]
64 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
65 fold_attribute(self, i)
66 }
67 #[cfg(any(feature = "full", feature = "derive"))]
68 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
69 fold_bare_fn_arg(self, i)
70 }
71 #[cfg(any(feature = "full", feature = "derive"))]
72 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
73 fold_bare_fn_arg_name(self, i)
74 }
75 #[cfg(any(feature = "full", feature = "derive"))]
76 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
77 fold_bin_op(self, i)
78 }
79 #[cfg(any(feature = "full", feature = "derive"))]
80 fn fold_binding(&mut self, i: Binding) -> Binding {
81 fold_binding(self, i)
82 }
83 #[cfg(any(feature = "full", feature = "derive"))]
84 #[cfg(feature = "full")]
85 fn fold_block(&mut self, i: Block) -> Block {
86 fold_block(self, i)
87 }
88 #[cfg(any(feature = "full", feature = "derive"))]
89 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
90 fold_bound_lifetimes(self, i)
91 }
92 #[cfg(any(feature = "full", feature = "derive"))]
93 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
94 fold_const_param(self, i)
95 }
96 #[cfg(feature = "derive")]
97 fn fold_data(&mut self, i: Data) -> Data {
98 fold_data(self, i)
99 }
100 #[cfg(feature = "derive")]
101 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
102 fold_data_enum(self, i)
103 }
104 #[cfg(feature = "derive")]
105 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
106 fold_data_struct(self, i)
107 }
108 #[cfg(feature = "derive")]
109 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
110 fold_data_union(self, i)
111 }
112 #[cfg(feature = "derive")]
113 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
114 fold_derive_input(self, i)
115 }
116 #[cfg(any(feature = "full", feature = "derive"))]
117 fn fold_expr(&mut self, i: Expr) -> Expr {
118 fold_expr(self, i)
119 }
120 #[cfg(feature = "full")]
121 #[cfg(any(feature = "full", feature = "derive"))]
122 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
123 fold_expr_array(self, i)
124 }
125 #[cfg(feature = "full")]
126 #[cfg(any(feature = "full", feature = "derive"))]
127 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
128 fold_expr_assign(self, i)
129 }
130 #[cfg(feature = "full")]
131 #[cfg(any(feature = "full", feature = "derive"))]
132 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
133 fold_expr_assign_op(self, i)
134 }
135 #[cfg(any(feature = "full", feature = "derive"))]
136 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
137 fold_expr_binary(self, i)
138 }
139 #[cfg(feature = "full")]
140 #[cfg(any(feature = "full", feature = "derive"))]
141 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
142 fold_expr_block(self, i)
143 }
144 #[cfg(feature = "full")]
145 #[cfg(any(feature = "full", feature = "derive"))]
146 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
147 fold_expr_box(self, i)
148 }
149 #[cfg(feature = "full")]
150 #[cfg(any(feature = "full", feature = "derive"))]
151 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
152 fold_expr_break(self, i)
153 }
154 #[cfg(any(feature = "full", feature = "derive"))]
155 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
156 fold_expr_call(self, i)
157 }
158 #[cfg(any(feature = "full", feature = "derive"))]
159 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
160 fold_expr_cast(self, i)
161 }
162 #[cfg(feature = "full")]
163 #[cfg(any(feature = "full", feature = "derive"))]
164 fn fold_expr_catch(&mut self, i: ExprCatch) -> ExprCatch {
165 fold_expr_catch(self, i)
166 }
167 #[cfg(feature = "full")]
168 #[cfg(any(feature = "full", feature = "derive"))]
169 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
170 fold_expr_closure(self, i)
171 }
172 #[cfg(feature = "full")]
173 #[cfg(any(feature = "full", feature = "derive"))]
174 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
175 fold_expr_continue(self, i)
176 }
177 #[cfg(any(feature = "full", feature = "derive"))]
178 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
179 fold_expr_field(self, i)
180 }
181 #[cfg(feature = "full")]
182 #[cfg(any(feature = "full", feature = "derive"))]
183 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
184 fold_expr_for_loop(self, i)
185 }
186 #[cfg(feature = "full")]
187 #[cfg(any(feature = "full", feature = "derive"))]
188 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
189 fold_expr_group(self, i)
190 }
191 #[cfg(feature = "full")]
192 #[cfg(any(feature = "full", feature = "derive"))]
193 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
194 fold_expr_if(self, i)
195 }
196 #[cfg(feature = "full")]
197 #[cfg(any(feature = "full", feature = "derive"))]
198 fn fold_expr_if_let(&mut self, i: ExprIfLet) -> ExprIfLet {
199 fold_expr_if_let(self, i)
200 }
201 #[cfg(feature = "full")]
202 #[cfg(any(feature = "full", feature = "derive"))]
203 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
204 fold_expr_in_place(self, i)
205 }
206 #[cfg(any(feature = "full", feature = "derive"))]
207 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
208 fold_expr_index(self, i)
209 }
210 #[cfg(any(feature = "full", feature = "derive"))]
211 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
212 fold_expr_lit(self, i)
213 }
214 #[cfg(feature = "full")]
215 #[cfg(any(feature = "full", feature = "derive"))]
216 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
217 fold_expr_loop(self, i)
218 }
219 #[cfg(feature = "full")]
220 #[cfg(any(feature = "full", feature = "derive"))]
221 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
222 fold_expr_macro(self, i)
223 }
224 #[cfg(feature = "full")]
225 #[cfg(any(feature = "full", feature = "derive"))]
226 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
227 fold_expr_match(self, i)
228 }
229 #[cfg(feature = "full")]
230 #[cfg(any(feature = "full", feature = "derive"))]
231 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
232 fold_expr_method_call(self, i)
233 }
234 #[cfg(any(feature = "full", feature = "derive"))]
235 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
236 fold_expr_paren(self, i)
237 }
238 #[cfg(any(feature = "full", feature = "derive"))]
239 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
240 fold_expr_path(self, i)
241 }
242 #[cfg(feature = "full")]
243 #[cfg(any(feature = "full", feature = "derive"))]
244 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
245 fold_expr_range(self, i)
246 }
247 #[cfg(feature = "full")]
248 #[cfg(any(feature = "full", feature = "derive"))]
249 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
250 fold_expr_reference(self, i)
251 }
252 #[cfg(feature = "full")]
253 #[cfg(any(feature = "full", feature = "derive"))]
254 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
255 fold_expr_repeat(self, i)
256 }
257 #[cfg(feature = "full")]
258 #[cfg(any(feature = "full", feature = "derive"))]
259 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
260 fold_expr_return(self, i)
261 }
262 #[cfg(feature = "full")]
263 #[cfg(any(feature = "full", feature = "derive"))]
264 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
265 fold_expr_struct(self, i)
266 }
267 #[cfg(feature = "full")]
268 #[cfg(any(feature = "full", feature = "derive"))]
269 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
270 fold_expr_try(self, i)
271 }
272 #[cfg(feature = "full")]
273 #[cfg(any(feature = "full", feature = "derive"))]
274 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
275 fold_expr_tuple(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg(any(feature = "full", feature = "derive"))]
279 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
280 fold_expr_type(self, i)
281 }
282 #[cfg(any(feature = "full", feature = "derive"))]
283 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
284 fold_expr_unary(self, i)
285 }
286 #[cfg(feature = "full")]
287 #[cfg(any(feature = "full", feature = "derive"))]
288 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
289 fold_expr_unsafe(self, i)
290 }
291 #[cfg(any(feature = "full", feature = "derive"))]
292 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
293 fold_expr_verbatim(self, i)
294 }
295 #[cfg(feature = "full")]
296 #[cfg(any(feature = "full", feature = "derive"))]
297 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
298 fold_expr_while(self, i)
299 }
300 #[cfg(feature = "full")]
301 #[cfg(any(feature = "full", feature = "derive"))]
302 fn fold_expr_while_let(&mut self, i: ExprWhileLet) -> ExprWhileLet {
303 fold_expr_while_let(self, i)
304 }
305 #[cfg(feature = "full")]
306 #[cfg(any(feature = "full", feature = "derive"))]
307 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
308 fold_expr_yield(self, i)
309 }
310 #[cfg(any(feature = "full", feature = "derive"))]
311 fn fold_field(&mut self, i: Field) -> Field {
312 fold_field(self, i)
313 }
314 #[cfg(any(feature = "full", feature = "derive"))]
315 #[cfg(feature = "full")]
316 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
317 fold_field_pat(self, i)
318 }
319 #[cfg(any(feature = "full", feature = "derive"))]
320 #[cfg(feature = "full")]
321 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
322 fold_field_value(self, i)
323 }
324 #[cfg(any(feature = "full", feature = "derive"))]
325 fn fold_fields(&mut self, i: Fields) -> Fields {
326 fold_fields(self, i)
327 }
328 #[cfg(any(feature = "full", feature = "derive"))]
329 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
330 fold_fields_named(self, i)
331 }
332 #[cfg(any(feature = "full", feature = "derive"))]
333 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
334 fold_fields_unnamed(self, i)
335 }
336 #[cfg(feature = "full")]
337 fn fold_file(&mut self, i: File) -> File {
338 fold_file(self, i)
339 }
340 #[cfg(feature = "full")]
341 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
342 fold_fn_arg(self, i)
343 }
344 #[cfg(feature = "full")]
345 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
346 fold_fn_decl(self, i)
347 }
348 #[cfg(feature = "full")]
349 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
350 fold_foreign_item(self, i)
351 }
352 #[cfg(feature = "full")]
353 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
354 fold_foreign_item_fn(self, i)
355 }
356 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400357 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
358 fold_foreign_item_macro(self, i)
359 }
360 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700361 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
362 fold_foreign_item_static(self, i)
363 }
364 #[cfg(feature = "full")]
365 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
366 fold_foreign_item_type(self, i)
367 }
368 #[cfg(feature = "full")]
369 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
370 fold_foreign_item_verbatim(self, i)
371 }
372 #[cfg(any(feature = "full", feature = "derive"))]
373 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
374 fold_generic_argument(self, i)
375 }
376 #[cfg(any(feature = "full", feature = "derive"))]
377 #[cfg(feature = "full")]
378 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
379 fold_generic_method_argument(self, i)
380 }
381 #[cfg(any(feature = "full", feature = "derive"))]
382 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
383 fold_generic_param(self, i)
384 }
385 #[cfg(any(feature = "full", feature = "derive"))]
386 fn fold_generics(&mut self, i: Generics) -> Generics {
387 fold_generics(self, i)
388 }
David Tolnay8c81f622018-07-31 23:34:35 -0700389 fn fold_ident(&mut self, i: Ident) -> Ident {
390 fold_ident(self, i)
391 }
392 #[cfg(feature = "full")]
393 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
394 fold_impl_item(self, i)
395 }
396 #[cfg(feature = "full")]
397 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
398 fold_impl_item_const(self, i)
399 }
400 #[cfg(feature = "full")]
401 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
402 fold_impl_item_macro(self, i)
403 }
404 #[cfg(feature = "full")]
405 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
406 fold_impl_item_method(self, i)
407 }
408 #[cfg(feature = "full")]
409 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
410 fold_impl_item_type(self, i)
411 }
412 #[cfg(feature = "full")]
413 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
414 fold_impl_item_verbatim(self, i)
415 }
416 #[cfg(any(feature = "full", feature = "derive"))]
417 fn fold_index(&mut self, i: Index) -> Index {
418 fold_index(self, i)
419 }
420 #[cfg(feature = "full")]
421 fn fold_item(&mut self, i: Item) -> Item {
422 fold_item(self, i)
423 }
424 #[cfg(feature = "full")]
425 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
426 fold_item_const(self, i)
427 }
428 #[cfg(feature = "full")]
429 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
430 fold_item_enum(self, i)
431 }
432 #[cfg(feature = "full")]
433 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
434 fold_item_extern_crate(self, i)
435 }
436 #[cfg(feature = "full")]
437 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
438 fold_item_fn(self, i)
439 }
440 #[cfg(feature = "full")]
441 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
442 fold_item_foreign_mod(self, i)
443 }
444 #[cfg(feature = "full")]
445 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
446 fold_item_impl(self, i)
447 }
448 #[cfg(feature = "full")]
449 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
450 fold_item_macro(self, i)
451 }
452 #[cfg(feature = "full")]
453 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
454 fold_item_macro2(self, i)
455 }
456 #[cfg(feature = "full")]
457 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
458 fold_item_mod(self, i)
459 }
460 #[cfg(feature = "full")]
461 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
462 fold_item_static(self, i)
463 }
464 #[cfg(feature = "full")]
465 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
466 fold_item_struct(self, i)
467 }
468 #[cfg(feature = "full")]
469 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
470 fold_item_trait(self, i)
471 }
472 #[cfg(feature = "full")]
473 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
474 fold_item_type(self, i)
475 }
476 #[cfg(feature = "full")]
477 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
478 fold_item_union(self, i)
479 }
480 #[cfg(feature = "full")]
481 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
482 fold_item_use(self, i)
483 }
484 #[cfg(feature = "full")]
485 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
486 fold_item_verbatim(self, i)
487 }
488 #[cfg(any(feature = "full", feature = "derive"))]
489 #[cfg(feature = "full")]
490 fn fold_label(&mut self, i: Label) -> Label {
491 fold_label(self, i)
492 }
493 #[cfg(any(feature = "full", feature = "derive"))]
494 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
495 fold_lifetime(self, i)
496 }
497 #[cfg(any(feature = "full", feature = "derive"))]
498 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
499 fold_lifetime_def(self, i)
500 }
501 #[cfg(any(feature = "full", feature = "derive"))]
502 fn fold_lit(&mut self, i: Lit) -> Lit {
503 fold_lit(self, i)
504 }
505 #[cfg(any(feature = "full", feature = "derive"))]
506 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
507 fold_lit_bool(self, i)
508 }
509 #[cfg(any(feature = "full", feature = "derive"))]
510 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
511 fold_lit_byte(self, i)
512 }
513 #[cfg(any(feature = "full", feature = "derive"))]
514 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
515 fold_lit_byte_str(self, i)
516 }
517 #[cfg(any(feature = "full", feature = "derive"))]
518 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
519 fold_lit_char(self, i)
520 }
521 #[cfg(any(feature = "full", feature = "derive"))]
522 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
523 fold_lit_float(self, i)
524 }
525 #[cfg(any(feature = "full", feature = "derive"))]
526 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
527 fold_lit_int(self, i)
528 }
529 #[cfg(any(feature = "full", feature = "derive"))]
530 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
531 fold_lit_str(self, i)
532 }
533 #[cfg(any(feature = "full", feature = "derive"))]
534 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
535 fold_lit_verbatim(self, i)
536 }
537 #[cfg(any(feature = "full", feature = "derive"))]
538 #[cfg(feature = "full")]
539 fn fold_local(&mut self, i: Local) -> Local {
540 fold_local(self, i)
541 }
542 #[cfg(any(feature = "full", feature = "derive"))]
543 fn fold_macro(&mut self, i: Macro) -> Macro {
544 fold_macro(self, i)
545 }
546 #[cfg(any(feature = "full", feature = "derive"))]
547 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
548 fold_macro_delimiter(self, i)
549 }
550 #[cfg(any(feature = "full", feature = "derive"))]
551 fn fold_member(&mut self, i: Member) -> Member {
552 fold_member(self, i)
553 }
554 #[cfg(any(feature = "full", feature = "derive"))]
555 fn fold_meta(&mut self, i: Meta) -> Meta {
556 fold_meta(self, i)
557 }
558 #[cfg(any(feature = "full", feature = "derive"))]
559 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
560 fold_meta_list(self, i)
561 }
562 #[cfg(any(feature = "full", feature = "derive"))]
563 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
564 fold_meta_name_value(self, i)
565 }
566 #[cfg(feature = "full")]
567 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
568 fold_method_sig(self, i)
569 }
570 #[cfg(any(feature = "full", feature = "derive"))]
571 #[cfg(feature = "full")]
572 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
573 fold_method_turbofish(self, i)
574 }
575 #[cfg(any(feature = "full", feature = "derive"))]
576 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
577 fold_nested_meta(self, i)
578 }
579 #[cfg(any(feature = "full", feature = "derive"))]
580 fn fold_parenthesized_generic_arguments(
581 &mut self,
582 i: ParenthesizedGenericArguments,
583 ) -> ParenthesizedGenericArguments {
584 fold_parenthesized_generic_arguments(self, i)
585 }
586 #[cfg(any(feature = "full", feature = "derive"))]
587 #[cfg(feature = "full")]
588 fn fold_pat(&mut self, i: Pat) -> Pat {
589 fold_pat(self, i)
590 }
591 #[cfg(any(feature = "full", feature = "derive"))]
592 #[cfg(feature = "full")]
593 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
594 fold_pat_box(self, i)
595 }
596 #[cfg(any(feature = "full", feature = "derive"))]
597 #[cfg(feature = "full")]
598 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
599 fold_pat_ident(self, i)
600 }
601 #[cfg(any(feature = "full", feature = "derive"))]
602 #[cfg(feature = "full")]
603 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
604 fold_pat_lit(self, i)
605 }
606 #[cfg(any(feature = "full", feature = "derive"))]
607 #[cfg(feature = "full")]
608 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
609 fold_pat_macro(self, i)
610 }
611 #[cfg(any(feature = "full", feature = "derive"))]
612 #[cfg(feature = "full")]
613 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
614 fold_pat_path(self, i)
615 }
616 #[cfg(any(feature = "full", feature = "derive"))]
617 #[cfg(feature = "full")]
618 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
619 fold_pat_range(self, i)
620 }
621 #[cfg(any(feature = "full", feature = "derive"))]
622 #[cfg(feature = "full")]
623 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
624 fold_pat_ref(self, i)
625 }
626 #[cfg(any(feature = "full", feature = "derive"))]
627 #[cfg(feature = "full")]
628 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
629 fold_pat_slice(self, i)
630 }
631 #[cfg(any(feature = "full", feature = "derive"))]
632 #[cfg(feature = "full")]
633 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
634 fold_pat_struct(self, i)
635 }
636 #[cfg(any(feature = "full", feature = "derive"))]
637 #[cfg(feature = "full")]
638 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
639 fold_pat_tuple(self, i)
640 }
641 #[cfg(any(feature = "full", feature = "derive"))]
642 #[cfg(feature = "full")]
643 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
644 fold_pat_tuple_struct(self, i)
645 }
646 #[cfg(any(feature = "full", feature = "derive"))]
647 #[cfg(feature = "full")]
648 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
649 fold_pat_verbatim(self, i)
650 }
651 #[cfg(any(feature = "full", feature = "derive"))]
652 #[cfg(feature = "full")]
653 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
654 fold_pat_wild(self, i)
655 }
656 #[cfg(any(feature = "full", feature = "derive"))]
657 fn fold_path(&mut self, i: Path) -> Path {
658 fold_path(self, i)
659 }
660 #[cfg(any(feature = "full", feature = "derive"))]
661 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
662 fold_path_arguments(self, i)
663 }
664 #[cfg(any(feature = "full", feature = "derive"))]
665 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
666 fold_path_segment(self, i)
667 }
668 #[cfg(any(feature = "full", feature = "derive"))]
669 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
670 fold_predicate_eq(self, i)
671 }
672 #[cfg(any(feature = "full", feature = "derive"))]
673 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
674 fold_predicate_lifetime(self, i)
675 }
676 #[cfg(any(feature = "full", feature = "derive"))]
677 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
678 fold_predicate_type(self, i)
679 }
680 #[cfg(any(feature = "full", feature = "derive"))]
681 fn fold_qself(&mut self, i: QSelf) -> QSelf {
682 fold_qself(self, i)
683 }
684 #[cfg(any(feature = "full", feature = "derive"))]
685 #[cfg(feature = "full")]
686 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
687 fold_range_limits(self, i)
688 }
689 #[cfg(any(feature = "full", feature = "derive"))]
690 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
691 fold_return_type(self, i)
692 }
David Tolnay8c81f622018-07-31 23:34:35 -0700693 fn fold_span(&mut self, i: Span) -> Span {
694 fold_span(self, i)
695 }
696 #[cfg(any(feature = "full", feature = "derive"))]
697 #[cfg(feature = "full")]
698 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
699 fold_stmt(self, i)
700 }
701 #[cfg(any(feature = "full", feature = "derive"))]
702 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
703 fold_trait_bound(self, i)
704 }
705 #[cfg(any(feature = "full", feature = "derive"))]
706 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
707 fold_trait_bound_modifier(self, i)
708 }
709 #[cfg(feature = "full")]
710 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
711 fold_trait_item(self, i)
712 }
713 #[cfg(feature = "full")]
714 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
715 fold_trait_item_const(self, i)
716 }
717 #[cfg(feature = "full")]
718 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
719 fold_trait_item_macro(self, i)
720 }
721 #[cfg(feature = "full")]
722 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
723 fold_trait_item_method(self, i)
724 }
725 #[cfg(feature = "full")]
726 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
727 fold_trait_item_type(self, i)
728 }
729 #[cfg(feature = "full")]
730 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
731 fold_trait_item_verbatim(self, i)
732 }
733 #[cfg(any(feature = "full", feature = "derive"))]
734 fn fold_type(&mut self, i: Type) -> Type {
735 fold_type(self, i)
736 }
737 #[cfg(any(feature = "full", feature = "derive"))]
738 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
739 fold_type_array(self, i)
740 }
741 #[cfg(any(feature = "full", feature = "derive"))]
742 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
743 fold_type_bare_fn(self, i)
744 }
745 #[cfg(any(feature = "full", feature = "derive"))]
746 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
747 fold_type_group(self, i)
748 }
749 #[cfg(any(feature = "full", feature = "derive"))]
750 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
751 fold_type_impl_trait(self, i)
752 }
753 #[cfg(any(feature = "full", feature = "derive"))]
754 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
755 fold_type_infer(self, i)
756 }
757 #[cfg(any(feature = "full", feature = "derive"))]
758 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
759 fold_type_macro(self, i)
760 }
761 #[cfg(any(feature = "full", feature = "derive"))]
762 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
763 fold_type_never(self, i)
764 }
765 #[cfg(any(feature = "full", feature = "derive"))]
766 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
767 fold_type_param(self, i)
768 }
769 #[cfg(any(feature = "full", feature = "derive"))]
770 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
771 fold_type_param_bound(self, i)
772 }
773 #[cfg(any(feature = "full", feature = "derive"))]
774 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
775 fold_type_paren(self, i)
776 }
777 #[cfg(any(feature = "full", feature = "derive"))]
778 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
779 fold_type_path(self, i)
780 }
781 #[cfg(any(feature = "full", feature = "derive"))]
782 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
783 fold_type_ptr(self, i)
784 }
785 #[cfg(any(feature = "full", feature = "derive"))]
786 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
787 fold_type_reference(self, i)
788 }
789 #[cfg(any(feature = "full", feature = "derive"))]
790 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
791 fold_type_slice(self, i)
792 }
793 #[cfg(any(feature = "full", feature = "derive"))]
794 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
795 fold_type_trait_object(self, i)
796 }
797 #[cfg(any(feature = "full", feature = "derive"))]
798 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
799 fold_type_tuple(self, i)
800 }
801 #[cfg(any(feature = "full", feature = "derive"))]
802 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
803 fold_type_verbatim(self, i)
804 }
805 #[cfg(any(feature = "full", feature = "derive"))]
806 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
807 fold_un_op(self, i)
808 }
809 #[cfg(feature = "full")]
810 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
811 fold_use_glob(self, i)
812 }
813 #[cfg(feature = "full")]
814 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
815 fold_use_group(self, i)
816 }
817 #[cfg(feature = "full")]
818 fn fold_use_name(&mut self, i: UseName) -> UseName {
819 fold_use_name(self, i)
820 }
821 #[cfg(feature = "full")]
822 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
823 fold_use_path(self, i)
824 }
825 #[cfg(feature = "full")]
826 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
827 fold_use_rename(self, i)
828 }
829 #[cfg(feature = "full")]
830 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
831 fold_use_tree(self, i)
832 }
833 #[cfg(any(feature = "full", feature = "derive"))]
834 fn fold_variant(&mut self, i: Variant) -> Variant {
835 fold_variant(self, i)
836 }
837 #[cfg(any(feature = "full", feature = "derive"))]
838 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
839 fold_vis_crate(self, i)
840 }
841 #[cfg(any(feature = "full", feature = "derive"))]
842 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
843 fold_vis_public(self, i)
844 }
845 #[cfg(any(feature = "full", feature = "derive"))]
846 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
847 fold_vis_restricted(self, i)
848 }
849 #[cfg(any(feature = "full", feature = "derive"))]
850 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
851 fold_visibility(self, i)
852 }
853 #[cfg(any(feature = "full", feature = "derive"))]
854 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
855 fold_where_clause(self, i)
856 }
857 #[cfg(any(feature = "full", feature = "derive"))]
858 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
859 fold_where_predicate(self, i)
860 }
Nika Layzell27726662017-10-24 23:16:35 -0400861}
David Tolnayd3f32142018-05-20 20:21:12 -0700862#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800863macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700864 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800865 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700866 let span = _visitor.fold_span(_i.span());
867 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800868 _i
869 }
David Tolnay8c81f622018-07-31 23:34:35 -0700870 };
David Tolnayd0adf522017-12-29 01:30:07 -0500871}
David Tolnay360efd22018-01-04 23:35:26 -0800872#[cfg(any(feature = "full", feature = "derive"))]
873fold_span_only!(fold_lit_byte: LitByte);
874#[cfg(any(feature = "full", feature = "derive"))]
875fold_span_only!(fold_lit_byte_str: LitByteStr);
876#[cfg(any(feature = "full", feature = "derive"))]
877fold_span_only!(fold_lit_char: LitChar);
878#[cfg(any(feature = "full", feature = "derive"))]
879fold_span_only!(fold_lit_float: LitFloat);
880#[cfg(any(feature = "full", feature = "derive"))]
881fold_span_only!(fold_lit_int: LitInt);
882#[cfg(any(feature = "full", feature = "derive"))]
883fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700884#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800885pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400886 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400887 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700888 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400889 }
890}
David Tolnay8c81f622018-07-31 23:34:35 -0700891#[cfg(any(feature = "full", feature = "derive"))]
892pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
893 _visitor: &mut V,
894 _i: AngleBracketedGenericArguments,
895) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500896 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400897 colon2_token: (_i.colon2_token)
898 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
899 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700900 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400901 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400902 }
903}
David Tolnay8c81f622018-07-31 23:34:35 -0700904#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800905pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400906 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700907 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400908 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700909 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400910 }
911}
David Tolnay8c81f622018-07-31 23:34:35 -0700912#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800913pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400914 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400915 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
916 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400917 }
918}
David Tolnay8c81f622018-07-31 23:34:35 -0700919#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800920pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400921 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400922 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700923 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400924 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
925 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400926 }
927}
David Tolnay8c81f622018-07-31 23:34:35 -0700928#[cfg(any(feature = "full", feature = "derive"))]
929#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800930pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400931 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700932 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400933 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700934 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
935 guard: (_i.guard).map(|it| {
936 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400937 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700938 Box::new(_visitor.fold_expr(*(it).1)),
939 )
940 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400941 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700942 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400943 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400944 }
945}
David Tolnay8c81f622018-07-31 23:34:35 -0700946#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800947pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400948 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700949 AttrStyle::Outer => AttrStyle::Outer,
950 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400951 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400952 }
953 }
954}
David Tolnay8c81f622018-07-31 23:34:35 -0700955#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800956pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400957 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400958 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700959 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400960 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700961 path: _visitor.fold_path(_i.path),
962 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400963 }
964}
David Tolnay8c81f622018-07-31 23:34:35 -0700965#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800966pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400967 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700968 name: (_i.name).map(|it| {
969 (
970 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400971 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700972 )
973 }),
974 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400975 }
976}
David Tolnay8c81f622018-07-31 23:34:35 -0700977#[cfg(any(feature = "full", feature = "derive"))]
978pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
979 _visitor: &mut V,
980 _i: BareFnArgName,
981) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400982 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700983 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
984 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400985 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400986 }
987 }
988}
David Tolnay8c81f622018-07-31 23:34:35 -0700989#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800990pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -0400991 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700992 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400993 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400994 }
David Tolnay8c81f622018-07-31 23:34:35 -0700995 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400996 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400997 }
David Tolnay8c81f622018-07-31 23:34:35 -0700998 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400999 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001000 }
David Tolnay8c81f622018-07-31 23:34:35 -07001001 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001002 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001003 }
David Tolnay8c81f622018-07-31 23:34:35 -07001004 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001005 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001006 }
David Tolnay8c81f622018-07-31 23:34:35 -07001007 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001008 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001009 }
David Tolnay8c81f622018-07-31 23:34:35 -07001010 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001011 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001012 }
David Tolnay8c81f622018-07-31 23:34:35 -07001013 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001014 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001015 }
David Tolnay8c81f622018-07-31 23:34:35 -07001016 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001017 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001018 }
David Tolnay8c81f622018-07-31 23:34:35 -07001019 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001020 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001021 }
David Tolnay8c81f622018-07-31 23:34:35 -07001022 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001023 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001024 }
David Tolnay8c81f622018-07-31 23:34:35 -07001025 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001026 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001027 }
David Tolnay8c81f622018-07-31 23:34:35 -07001028 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001029 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001030 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001031 BinOp::Lt(_binding_0) => {
1032 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1033 }
David Tolnay8c81f622018-07-31 23:34:35 -07001034 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001035 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001036 }
David Tolnay8c81f622018-07-31 23:34:35 -07001037 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001038 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001039 }
David Tolnay8c81f622018-07-31 23:34:35 -07001040 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001041 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001042 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001043 BinOp::Gt(_binding_0) => {
1044 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1045 }
David Tolnay8c81f622018-07-31 23:34:35 -07001046 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001047 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001048 }
David Tolnay8c81f622018-07-31 23:34:35 -07001049 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001050 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001051 }
David Tolnay8c81f622018-07-31 23:34:35 -07001052 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001053 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001054 }
David Tolnay8c81f622018-07-31 23:34:35 -07001055 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001056 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001057 }
David Tolnay8c81f622018-07-31 23:34:35 -07001058 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001059 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001060 }
David Tolnay8c81f622018-07-31 23:34:35 -07001061 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001062 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001063 }
David Tolnay8c81f622018-07-31 23:34:35 -07001064 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001065 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001066 }
David Tolnay8c81f622018-07-31 23:34:35 -07001067 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001068 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001069 }
David Tolnay8c81f622018-07-31 23:34:35 -07001070 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001071 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001072 }
David Tolnay8c81f622018-07-31 23:34:35 -07001073 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001074 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001075 }
1076 }
1077}
David Tolnay8c81f622018-07-31 23:34:35 -07001078#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001079pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001080 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001081 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001082 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001083 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001084 }
1085}
David Tolnay8c81f622018-07-31 23:34:35 -07001086#[cfg(any(feature = "full", feature = "derive"))]
1087#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001088pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001089 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001090 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001091 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001092 }
1093}
David Tolnay8c81f622018-07-31 23:34:35 -07001094#[cfg(any(feature = "full", feature = "derive"))]
1095pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1096 _visitor: &mut V,
1097 _i: BoundLifetimes,
1098) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001099 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001100 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1101 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001102 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001103 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001104 }
1105}
David Tolnay8c81f622018-07-31 23:34:35 -07001106#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001107pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001108 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001109 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001110 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001111 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001112 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001113 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001114 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001115 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001116 }
1117}
David Tolnay8c81f622018-07-31 23:34:35 -07001118#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001119pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001120 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001121 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1122 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1123 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001124 }
1125}
David Tolnay8c81f622018-07-31 23:34:35 -07001126#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001127pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001128 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001129 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1130 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001131 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001132 }
1133}
David Tolnay8c81f622018-07-31 23:34:35 -07001134#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001135pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001136 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001137 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001138 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001139 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001140 }
1141}
David Tolnay8c81f622018-07-31 23:34:35 -07001142#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001143pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001144 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001145 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001146 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001147 }
1148}
David Tolnay8c81f622018-07-31 23:34:35 -07001149#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001150pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001151 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001152 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1153 vis: _visitor.fold_visibility(_i.vis),
1154 ident: _visitor.fold_ident(_i.ident),
1155 generics: _visitor.fold_generics(_i.generics),
1156 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001157 }
1158}
David Tolnay8c81f622018-07-31 23:34:35 -07001159#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001160pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001161 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001162 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1163 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1164 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1165 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1166 Expr::MethodCall(_binding_0) => {
1167 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001168 }
David Tolnay8c81f622018-07-31 23:34:35 -07001169 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1170 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1171 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1172 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1173 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1174 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
1175 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
1176 Expr::IfLet(_binding_0) => Expr::IfLet(full!(_visitor.fold_expr_if_let(_binding_0))),
1177 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
1178 Expr::WhileLet(_binding_0) => {
1179 Expr::WhileLet(full!(_visitor.fold_expr_while_let(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001180 }
David Tolnay8c81f622018-07-31 23:34:35 -07001181 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1182 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1183 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1184 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1185 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1186 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1187 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1188 Expr::AssignOp(_binding_0) => {
1189 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001190 }
David Tolnay8c81f622018-07-31 23:34:35 -07001191 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1192 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1193 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1194 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1195 Expr::Reference(_binding_0) => {
1196 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001197 }
David Tolnay8c81f622018-07-31 23:34:35 -07001198 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1199 Expr::Continue(_binding_0) => {
1200 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001201 }
David Tolnay8c81f622018-07-31 23:34:35 -07001202 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1203 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1204 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1205 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1206 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1207 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1208 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
1209 Expr::Catch(_binding_0) => Expr::Catch(full!(_visitor.fold_expr_catch(_binding_0))),
1210 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1211 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001212 }
1213}
David Tolnay8c81f622018-07-31 23:34:35 -07001214#[cfg(feature = "full")]
1215#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001216pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001217 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001218 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001219 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001220 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001221 }
1222}
David Tolnay8c81f622018-07-31 23:34:35 -07001223#[cfg(feature = "full")]
1224#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001225pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001226 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001227 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1228 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001229 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001230 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001231 }
1232}
David Tolnay8c81f622018-07-31 23:34:35 -07001233#[cfg(feature = "full")]
1234#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001235pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001236 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001237 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1238 left: Box::new(_visitor.fold_expr(*_i.left)),
1239 op: _visitor.fold_bin_op(_i.op),
1240 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001241 }
1242}
David Tolnay8c81f622018-07-31 23:34:35 -07001243#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001244pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001245 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001246 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1247 left: Box::new(_visitor.fold_expr(*_i.left)),
1248 op: _visitor.fold_bin_op(_i.op),
1249 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001250 }
1251}
David Tolnay8c81f622018-07-31 23:34:35 -07001252#[cfg(feature = "full")]
1253#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001254pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001255 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001256 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1257 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001258 }
1259}
David Tolnay8c81f622018-07-31 23:34:35 -07001260#[cfg(feature = "full")]
1261#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001262pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001263 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001264 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001265 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001266 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001267 }
1268}
David Tolnay8c81f622018-07-31 23:34:35 -07001269#[cfg(feature = "full")]
1270#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001271pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001272 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001273 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001274 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001275 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1276 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001277 }
1278}
David Tolnay8c81f622018-07-31 23:34:35 -07001279#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001280pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001281 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001282 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1283 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001284 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001285 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001286 }
1287}
David Tolnay8c81f622018-07-31 23:34:35 -07001288#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001289pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001290 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001291 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1292 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001293 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001294 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001295 }
1296}
David Tolnay8c81f622018-07-31 23:34:35 -07001297#[cfg(feature = "full")]
1298#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001299pub fn fold_expr_catch<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCatch) -> ExprCatch {
David Tolnay8c91b882017-12-28 23:04:32 -05001300 ExprCatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001301 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001302 do_token: Token ! [ do ](tokens_helper(_visitor, &_i.do_token.span)),
1303 catch_token: Token![catch](tokens_helper(_visitor, &_i.catch_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001304 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001305 }
1306}
David Tolnay8c81f622018-07-31 23:34:35 -07001307#[cfg(feature = "full")]
1308#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001309pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001310 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001311 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001312 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001313 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1314 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1315 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001316 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001317 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001318 output: _visitor.fold_return_type(_i.output),
1319 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001320 }
1321}
David Tolnay8c81f622018-07-31 23:34:35 -07001322#[cfg(feature = "full")]
1323#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001324pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001325 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001326 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001327 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001328 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001329 }
1330}
David Tolnay8c81f622018-07-31 23:34:35 -07001331#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001332pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001333 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001334 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1335 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001336 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001337 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001338 }
1339}
David Tolnay8c81f622018-07-31 23:34:35 -07001340#[cfg(feature = "full")]
1341#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001342pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001343 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001344 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1345 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001346 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001347 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001348 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001349 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1350 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001351 }
1352}
David Tolnay8c81f622018-07-31 23:34:35 -07001353#[cfg(feature = "full")]
1354#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001355pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001356 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001357 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001358 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001359 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001360 }
1361}
David Tolnay8c81f622018-07-31 23:34:35 -07001362#[cfg(feature = "full")]
1363#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001364pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001365 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001366 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001367 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001368 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1369 then_branch: _visitor.fold_block(_i.then_branch),
1370 else_branch: (_i.else_branch).map(|it| {
1371 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001372 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001373 Box::new(_visitor.fold_expr(*(it).1)),
1374 )
1375 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001376 }
1377}
David Tolnay8c81f622018-07-31 23:34:35 -07001378#[cfg(feature = "full")]
1379#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001380pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001381 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001382 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001383 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
1384 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001385 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001386 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001387 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1388 then_branch: _visitor.fold_block(_i.then_branch),
1389 else_branch: (_i.else_branch).map(|it| {
1390 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001391 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001392 Box::new(_visitor.fold_expr(*(it).1)),
1393 )
1394 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001395 }
1396}
David Tolnay8c81f622018-07-31 23:34:35 -07001397#[cfg(feature = "full")]
1398#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001399pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001400 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001401 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1402 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001403 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001404 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001405 }
1406}
David Tolnay8c81f622018-07-31 23:34:35 -07001407#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001408pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001409 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001410 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1411 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001412 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001413 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001414 }
1415}
David Tolnay8c81f622018-07-31 23:34:35 -07001416#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001417pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001418 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001419 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1420 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001421 }
1422}
David Tolnay8c81f622018-07-31 23:34:35 -07001423#[cfg(feature = "full")]
1424#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001425pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001426 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001427 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1428 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001429 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001430 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001431 }
1432}
David Tolnay8c81f622018-07-31 23:34:35 -07001433#[cfg(feature = "full")]
1434#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001435pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001436 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001437 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1438 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001439 }
1440}
David Tolnay8c81f622018-07-31 23:34:35 -07001441#[cfg(feature = "full")]
1442#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001443pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001444 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001445 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001446 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001447 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001448 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001449 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001450 }
1451}
David Tolnay8c81f622018-07-31 23:34:35 -07001452#[cfg(feature = "full")]
1453#[cfg(any(feature = "full", feature = "derive"))]
1454pub fn fold_expr_method_call<V: Fold + ?Sized>(
1455 _visitor: &mut V,
1456 _i: ExprMethodCall,
1457) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001458 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001459 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1460 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001461 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001462 method: _visitor.fold_ident(_i.method),
1463 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001464 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001465 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001466 }
1467}
David Tolnay8c81f622018-07-31 23:34:35 -07001468#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001469pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001470 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001471 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001472 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001473 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001474 }
1475}
David Tolnay8c81f622018-07-31 23:34:35 -07001476#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001477pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001478 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001479 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1480 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1481 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001482 }
1483}
David Tolnay8c81f622018-07-31 23:34:35 -07001484#[cfg(feature = "full")]
1485#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001486pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001487 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001488 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1489 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1490 limits: _visitor.fold_range_limits(_i.limits),
1491 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001492 }
1493}
David Tolnay8c81f622018-07-31 23:34:35 -07001494#[cfg(feature = "full")]
1495#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001496pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1497 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001498 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001499 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1500 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001501 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001502 }
1503}
David Tolnay8c81f622018-07-31 23:34:35 -07001504#[cfg(feature = "full")]
1505#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001506pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001507 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001508 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001509 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001510 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001511 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001512 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001513 }
1514}
David Tolnay8c81f622018-07-31 23:34:35 -07001515#[cfg(feature = "full")]
1516#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001517pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001518 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001519 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001520 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001521 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001522 }
1523}
David Tolnay8c81f622018-07-31 23:34:35 -07001524#[cfg(feature = "full")]
1525#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001526pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001527 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001528 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1529 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001530 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001531 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001532 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001533 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001534 }
1535}
David Tolnay8c81f622018-07-31 23:34:35 -07001536#[cfg(feature = "full")]
1537#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001538pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001539 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001540 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1541 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001542 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001543 }
1544}
David Tolnay8c81f622018-07-31 23:34:35 -07001545#[cfg(feature = "full")]
1546#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001547pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001548 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001549 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001550 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001551 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001552 }
1553}
David Tolnay8c81f622018-07-31 23:34:35 -07001554#[cfg(feature = "full")]
1555#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001556pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001557 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001558 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1559 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001560 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001561 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001562 }
1563}
David Tolnay8c81f622018-07-31 23:34:35 -07001564#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001565pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001566 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001567 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1568 op: _visitor.fold_un_op(_i.op),
1569 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001570 }
1571}
David Tolnay8c81f622018-07-31 23:34:35 -07001572#[cfg(feature = "full")]
1573#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001574pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001575 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001576 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001577 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001578 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001579 }
1580}
David Tolnay8c81f622018-07-31 23:34:35 -07001581#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001582pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001583 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001584}
David Tolnay8c81f622018-07-31 23:34:35 -07001585#[cfg(feature = "full")]
1586#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001587pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001588 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001589 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1590 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001591 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001592 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1593 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001594 }
1595}
David Tolnay8c81f622018-07-31 23:34:35 -07001596#[cfg(feature = "full")]
1597#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001598pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001599 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001600 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1601 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001602 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
1603 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001604 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001605 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001606 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1607 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001608 }
1609}
David Tolnay8c81f622018-07-31 23:34:35 -07001610#[cfg(feature = "full")]
1611#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001612pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001613 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001614 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001615 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001616 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001617 }
1618}
David Tolnay8c81f622018-07-31 23:34:35 -07001619#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001620pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001621 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001622 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1623 vis: _visitor.fold_visibility(_i.vis),
1624 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001625 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001626 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001627 }
1628}
David Tolnay8c81f622018-07-31 23:34:35 -07001629#[cfg(any(feature = "full", feature = "derive"))]
1630#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001631pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001632 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001633 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1634 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001635 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001636 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001637 }
1638}
David Tolnay8c81f622018-07-31 23:34:35 -07001639#[cfg(any(feature = "full", feature = "derive"))]
1640#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001641pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001642 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001643 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1644 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001645 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001646 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001647 }
1648}
David Tolnay8c81f622018-07-31 23:34:35 -07001649#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001650pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001651 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001652 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1653 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1654 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001655 }
1656}
David Tolnay8c81f622018-07-31 23:34:35 -07001657#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001658pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001659 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001660 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001661 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001662 }
1663}
David Tolnay8c81f622018-07-31 23:34:35 -07001664#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001665pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001666 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001667 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001668 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001669 }
1670}
David Tolnay8c81f622018-07-31 23:34:35 -07001671#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001672pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001673 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001674 shebang: _i.shebang,
1675 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1676 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001677 }
1678}
David Tolnay8c81f622018-07-31 23:34:35 -07001679#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001680pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001681 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001682 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1683 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1684 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1685 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1686 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001687 }
1688}
David Tolnay8c81f622018-07-31 23:34:35 -07001689#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001690pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001691 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001692 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001693 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001694 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001695 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001696 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001697 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001698 }
1699}
David Tolnay8c81f622018-07-31 23:34:35 -07001700#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001701pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001702 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001703 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1704 ForeignItem::Static(_binding_0) => {
1705 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001706 }
David Tolnay8c81f622018-07-31 23:34:35 -07001707 ForeignItem::Type(_binding_0) => {
1708 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001709 }
David Tolnay435c1782018-08-24 16:15:44 -04001710 ForeignItem::Macro(_binding_0) => {
1711 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1712 }
David Tolnay8c81f622018-07-31 23:34:35 -07001713 ForeignItem::Verbatim(_binding_0) => {
1714 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001715 }
Nika Layzell27726662017-10-24 23:16:35 -04001716 }
1717}
David Tolnay8c81f622018-07-31 23:34:35 -07001718#[cfg(feature = "full")]
1719pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1720 _visitor: &mut V,
1721 _i: ForeignItemFn,
1722) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001723 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001724 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1725 vis: _visitor.fold_visibility(_i.vis),
1726 ident: _visitor.fold_ident(_i.ident),
1727 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001728 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001729 }
1730}
David Tolnay8c81f622018-07-31 23:34:35 -07001731#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001732pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1733 _visitor: &mut V,
1734 _i: ForeignItemMacro,
1735) -> ForeignItemMacro {
1736 ForeignItemMacro {
1737 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1738 mac: _visitor.fold_macro(_i.mac),
1739 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1740 }
1741}
1742#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001743pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1744 _visitor: &mut V,
1745 _i: ForeignItemStatic,
1746) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001747 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001748 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1749 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001750 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1751 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001752 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001753 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001754 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001755 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001756 }
1757}
David Tolnay8c81f622018-07-31 23:34:35 -07001758#[cfg(feature = "full")]
1759pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1760 _visitor: &mut V,
1761 _i: ForeignItemType,
1762) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001763 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001764 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1765 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001766 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001767 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001768 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001769 }
1770}
David Tolnay8c81f622018-07-31 23:34:35 -07001771#[cfg(feature = "full")]
1772pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1773 _visitor: &mut V,
1774 _i: ForeignItemVerbatim,
1775) -> ForeignItemVerbatim {
1776 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001777}
David Tolnay8c81f622018-07-31 23:34:35 -07001778#[cfg(any(feature = "full", feature = "derive"))]
1779pub fn fold_generic_argument<V: Fold + ?Sized>(
1780 _visitor: &mut V,
1781 _i: GenericArgument,
1782) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001783 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001784 GenericArgument::Lifetime(_binding_0) => {
1785 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001786 }
David Tolnay8c81f622018-07-31 23:34:35 -07001787 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1788 GenericArgument::Binding(_binding_0) => {
1789 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001790 }
David Tolnay8c81f622018-07-31 23:34:35 -07001791 GenericArgument::Const(_binding_0) => {
1792 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001793 }
Nika Layzell357885a2017-12-04 15:47:07 -05001794 }
1795}
David Tolnay8c81f622018-07-31 23:34:35 -07001796#[cfg(any(feature = "full", feature = "derive"))]
1797#[cfg(feature = "full")]
1798pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1799 _visitor: &mut V,
1800 _i: GenericMethodArgument,
1801) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001802 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001803 GenericMethodArgument::Type(_binding_0) => {
1804 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001805 }
David Tolnay8c81f622018-07-31 23:34:35 -07001806 GenericMethodArgument::Const(_binding_0) => {
1807 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001808 }
1809 }
1810}
David Tolnay8c81f622018-07-31 23:34:35 -07001811#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001812pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001813 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001814 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1815 GenericParam::Lifetime(_binding_0) => {
1816 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001817 }
David Tolnay8c81f622018-07-31 23:34:35 -07001818 GenericParam::Const(_binding_0) => {
1819 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001820 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001821 }
1822}
David Tolnay8c81f622018-07-31 23:34:35 -07001823#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001824pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001825 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001826 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001827 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001828 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001829 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001830 }
1831}
Alex Crichtond261d092018-05-18 13:47:35 -07001832pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001833 let mut _i = _i;
1834 let span = _visitor.fold_span(_i.span());
1835 _i.set_span(span);
1836 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001837}
David Tolnay8c81f622018-07-31 23:34:35 -07001838#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001839pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001840 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001841 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1842 ImplItem::Method(_binding_0) => {
1843 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001844 }
David Tolnay8c81f622018-07-31 23:34:35 -07001845 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
1846 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1847 ImplItem::Verbatim(_binding_0) => {
1848 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001849 }
Nika Layzell27726662017-10-24 23:16:35 -04001850 }
1851}
David Tolnay8c81f622018-07-31 23:34:35 -07001852#[cfg(feature = "full")]
1853pub fn fold_impl_item_const<V: Fold + ?Sized>(
1854 _visitor: &mut V,
1855 _i: ImplItemConst,
1856) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001857 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001858 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1859 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001860 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1861 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001862 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001863 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001864 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001865 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001866 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001867 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001868 }
1869}
David Tolnay8c81f622018-07-31 23:34:35 -07001870#[cfg(feature = "full")]
1871pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1872 _visitor: &mut V,
1873 _i: ImplItemMacro,
1874) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001875 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001876 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1877 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001878 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001879 }
1880}
David Tolnay8c81f622018-07-31 23:34:35 -07001881#[cfg(feature = "full")]
1882pub fn fold_impl_item_method<V: Fold + ?Sized>(
1883 _visitor: &mut V,
1884 _i: ImplItemMethod,
1885) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001886 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001887 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1888 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001889 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001890 sig: _visitor.fold_method_sig(_i.sig),
1891 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001892 }
1893}
David Tolnay8c81f622018-07-31 23:34:35 -07001894#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001895pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001896 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001897 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1898 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001899 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1900 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001901 ident: _visitor.fold_ident(_i.ident),
1902 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001903 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001904 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001905 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001906 }
1907}
David Tolnay8c81f622018-07-31 23:34:35 -07001908#[cfg(feature = "full")]
1909pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1910 _visitor: &mut V,
1911 _i: ImplItemVerbatim,
1912) -> ImplItemVerbatim {
1913 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001914}
David Tolnay8c81f622018-07-31 23:34:35 -07001915#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001916pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001917 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001918 index: _i.index,
1919 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001920 }
1921}
David Tolnay8c81f622018-07-31 23:34:35 -07001922#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001923pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001924 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001925 Item::ExternCrate(_binding_0) => {
1926 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001927 }
David Tolnay8c81f622018-07-31 23:34:35 -07001928 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1929 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1930 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1931 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1932 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1933 Item::ForeignMod(_binding_0) => {
1934 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001935 }
David Tolnay8c81f622018-07-31 23:34:35 -07001936 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
1937 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1938 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1939 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1940 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
1941 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1942 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1943 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1944 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001945 }
1946}
David Tolnay8c81f622018-07-31 23:34:35 -07001947#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001948pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001949 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001950 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1951 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001952 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001953 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001954 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001955 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001956 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001957 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001958 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001959 }
1960}
David Tolnay8c81f622018-07-31 23:34:35 -07001961#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001962pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001963 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001964 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1965 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001966 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001967 ident: _visitor.fold_ident(_i.ident),
1968 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001969 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001970 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001971 }
1972}
David Tolnay8c81f622018-07-31 23:34:35 -07001973#[cfg(feature = "full")]
1974pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1975 _visitor: &mut V,
1976 _i: ItemExternCrate,
1977) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001978 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001979 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1980 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001981 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
1982 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001983 ident: _visitor.fold_ident(_i.ident),
1984 rename: (_i.rename).map(|it| {
1985 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001986 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001987 _visitor.fold_ident((it).1),
1988 )
1989 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04001990 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001991 }
1992}
David Tolnay8c81f622018-07-31 23:34:35 -07001993#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001994pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001995 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001996 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1997 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001998 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
1999 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002000 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002001 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2002 ident: _visitor.fold_ident(_i.ident),
2003 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2004 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002005 }
2006}
David Tolnay8c81f622018-07-31 23:34:35 -07002007#[cfg(feature = "full")]
2008pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2009 _visitor: &mut V,
2010 _i: ItemForeignMod,
2011) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002012 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002013 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2014 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002015 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002016 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002017 }
2018}
David Tolnay8c81f622018-07-31 23:34:35 -07002019#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002020pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002021 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002022 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002023 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2024 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2025 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002026 generics: _visitor.fold_generics(_i.generics),
2027 trait_: (_i.trait_).map(|it| {
2028 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002029 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002030 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002031 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002032 )
2033 }),
2034 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002035 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002036 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002037 }
2038}
David Tolnay8c81f622018-07-31 23:34:35 -07002039#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002040pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002041 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002042 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2043 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2044 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002045 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002046 }
2047}
David Tolnay8c81f622018-07-31 23:34:35 -07002048#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002049pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002050 ItemMacro2 {
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),
David Tolnay7ac699c2018-08-24 14:00:58 -04002053 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002054 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002055 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002056 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002057 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002058 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002059 }
2060}
David Tolnay8c81f622018-07-31 23:34:35 -07002061#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002062pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002063 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002064 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2065 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002066 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002067 ident: _visitor.fold_ident(_i.ident),
2068 content: (_i.content).map(|it| {
2069 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002070 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002071 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2072 )
2073 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002074 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002075 }
2076}
David Tolnay8c81f622018-07-31 23:34:35 -07002077#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002078pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002079 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002080 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2081 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002082 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2083 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002084 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002085 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002086 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002087 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002088 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002089 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002090 }
2091}
David Tolnay8c81f622018-07-31 23:34:35 -07002092#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002093pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002094 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002095 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2096 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002097 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002098 ident: _visitor.fold_ident(_i.ident),
2099 generics: _visitor.fold_generics(_i.generics),
2100 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002101 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002102 }
2103}
David Tolnay8c81f622018-07-31 23:34:35 -07002104#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002105pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002106 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002107 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2108 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002109 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2110 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2111 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002112 ident: _visitor.fold_ident(_i.ident),
2113 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002114 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002115 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002116 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002117 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
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_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002122 ItemType {
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),
David Tolnay7ac699c2018-08-24 14:00:58 -04002125 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002126 ident: _visitor.fold_ident(_i.ident),
2127 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002128 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002129 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002130 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002131 }
2132}
David Tolnay8c81f622018-07-31 23:34:35 -07002133#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002134pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002135 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002136 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2137 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002138 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002139 ident: _visitor.fold_ident(_i.ident),
2140 generics: _visitor.fold_generics(_i.generics),
2141 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002142 }
2143}
David Tolnay8c81f622018-07-31 23:34:35 -07002144#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002145pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002146 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002147 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2148 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002149 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002150 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002151 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002152 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002153 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002154 }
2155}
David Tolnay8c81f622018-07-31 23:34:35 -07002156#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002157pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002158 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002159}
David Tolnay8c81f622018-07-31 23:34:35 -07002160#[cfg(any(feature = "full", feature = "derive"))]
2161#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002162pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002163 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002164 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002165 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002166 }
2167}
David Tolnay8c81f622018-07-31 23:34:35 -07002168#[cfg(any(feature = "full", feature = "derive"))]
Alex Crichton131308c2018-05-18 14:00:24 -07002169pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2170 Lifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002171 apostrophe: _i.apostrophe,
2172 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002173 }
2174}
David Tolnay8c81f622018-07-31 23:34:35 -07002175#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002176pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002177 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002178 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2179 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002180 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002181 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002182 }
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<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002186 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002187 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2188 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2189 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2190 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2191 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2192 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2193 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2194 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002195 }
2196}
David Tolnay8c81f622018-07-31 23:34:35 -07002197#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002198pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002199 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002200 value: _i.value,
2201 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002202 }
2203}
David Tolnay8c81f622018-07-31 23:34:35 -07002204#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002205pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002206 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002207}
David Tolnay8c81f622018-07-31 23:34:35 -07002208#[cfg(any(feature = "full", feature = "derive"))]
2209#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002210pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002211 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002212 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002213 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002214 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2215 ty: (_i.ty).map(|it| {
2216 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002217 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002218 Box::new(_visitor.fold_type(*(it).1)),
2219 )
2220 }),
2221 init: (_i.init).map(|it| {
2222 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002223 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002224 Box::new(_visitor.fold_expr(*(it).1)),
2225 )
2226 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002227 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002228 }
2229}
David Tolnay8c81f622018-07-31 23:34:35 -07002230#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002231pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002232 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002233 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002234 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002235 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2236 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002237 }
2238}
David Tolnay8c81f622018-07-31 23:34:35 -07002239#[cfg(any(feature = "full", feature = "derive"))]
2240pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2241 _visitor: &mut V,
2242 _i: MacroDelimiter,
2243) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002244 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002245 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002246 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002247 }
David Tolnay8c81f622018-07-31 23:34:35 -07002248 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002249 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002250 }
David Tolnay8c81f622018-07-31 23:34:35 -07002251 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002252 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002253 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002254 }
2255}
David Tolnay8c81f622018-07-31 23:34:35 -07002256#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002257pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002258 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002259 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2260 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002261 }
2262}
David Tolnay8c81f622018-07-31 23:34:35 -07002263#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002264pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002265 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002266 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2267 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2268 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002269 }
2270}
David Tolnay8c81f622018-07-31 23:34:35 -07002271#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002272pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2273 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002274 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002275 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002276 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002277 }
2278}
David Tolnay8c81f622018-07-31 23:34:35 -07002279#[cfg(any(feature = "full", feature = "derive"))]
2280pub fn fold_meta_name_value<V: Fold + ?Sized>(
2281 _visitor: &mut V,
2282 _i: MetaNameValue,
2283) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002284 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002285 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002286 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002287 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002288 }
2289}
David Tolnay8c81f622018-07-31 23:34:35 -07002290#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002291pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002292 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002293 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2294 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002295 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002296 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2297 ident: _visitor.fold_ident(_i.ident),
2298 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002299 }
2300}
David Tolnay8c81f622018-07-31 23:34:35 -07002301#[cfg(any(feature = "full", feature = "derive"))]
2302#[cfg(feature = "full")]
2303pub fn fold_method_turbofish<V: Fold + ?Sized>(
2304 _visitor: &mut V,
2305 _i: MethodTurbofish,
2306) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002307 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002308 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2309 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002310 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002311 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002312 }
2313}
David Tolnay8c81f622018-07-31 23:34:35 -07002314#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002315pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002316 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002317 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2318 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002319 }
2320}
David Tolnay8c81f622018-07-31 23:34:35 -07002321#[cfg(any(feature = "full", feature = "derive"))]
2322pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2323 _visitor: &mut V,
2324 _i: ParenthesizedGenericArguments,
2325) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002326 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002327 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002328 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2329 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002330 }
2331}
David Tolnay8c81f622018-07-31 23:34:35 -07002332#[cfg(any(feature = "full", feature = "derive"))]
2333#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002334pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002335 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002336 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2337 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2338 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2339 Pat::TupleStruct(_binding_0) => {
2340 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002341 }
David Tolnay8c81f622018-07-31 23:34:35 -07002342 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2343 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2344 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2345 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2346 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2347 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2348 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2349 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2350 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002351 }
2352}
David Tolnay8c81f622018-07-31 23:34:35 -07002353#[cfg(any(feature = "full", feature = "derive"))]
2354#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002355pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002356 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002357 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002358 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002359 }
2360}
David Tolnay8c81f622018-07-31 23:34:35 -07002361#[cfg(any(feature = "full", feature = "derive"))]
2362#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002363pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002364 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002365 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2366 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002367 ident: _visitor.fold_ident(_i.ident),
2368 subpat: (_i.subpat).map(|it| {
2369 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002370 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002371 Box::new(_visitor.fold_pat(*(it).1)),
2372 )
2373 }),
Nika Layzell27726662017-10-24 23:16:35 -04002374 }
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_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002379 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002380 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002381 }
2382}
David Tolnay8c81f622018-07-31 23:34:35 -07002383#[cfg(any(feature = "full", feature = "derive"))]
2384#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002385pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002386 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002387 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002388 }
2389}
David Tolnay8c81f622018-07-31 23:34:35 -07002390#[cfg(any(feature = "full", feature = "derive"))]
2391#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002392pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002393 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002394 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2395 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002396 }
2397}
David Tolnay8c81f622018-07-31 23:34:35 -07002398#[cfg(any(feature = "full", feature = "derive"))]
2399#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002400pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002401 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002402 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2403 limits: _visitor.fold_range_limits(_i.limits),
2404 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002405 }
2406}
David Tolnay8c81f622018-07-31 23:34:35 -07002407#[cfg(any(feature = "full", feature = "derive"))]
2408#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002409pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002410 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002411 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2412 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002413 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002414 }
2415}
David Tolnay8c81f622018-07-31 23:34:35 -07002416#[cfg(any(feature = "full", feature = "derive"))]
2417#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002418pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002419 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002420 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002421 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2422 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002423 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2424 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002425 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002426 }
2427}
David Tolnay8c81f622018-07-31 23:34:35 -07002428#[cfg(any(feature = "full", feature = "derive"))]
2429#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002430pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002431 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002432 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002433 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002434 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002435 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002436 }
2437}
David Tolnay8c81f622018-07-31 23:34:35 -07002438#[cfg(any(feature = "full", feature = "derive"))]
2439#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002440pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002441 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002442 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002443 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002444 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2445 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002446 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002447 }
2448}
David Tolnay8c81f622018-07-31 23:34:35 -07002449#[cfg(any(feature = "full", feature = "derive"))]
2450#[cfg(feature = "full")]
2451pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2452 _visitor: &mut V,
2453 _i: PatTupleStruct,
2454) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002455 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002456 path: _visitor.fold_path(_i.path),
2457 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002458 }
2459}
David Tolnay8c81f622018-07-31 23:34:35 -07002460#[cfg(any(feature = "full", feature = "derive"))]
2461#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002462pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002463 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002464}
David Tolnay8c81f622018-07-31 23:34:35 -07002465#[cfg(any(feature = "full", feature = "derive"))]
2466#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002467pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002468 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002469 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002470 }
2471}
David Tolnay8c81f622018-07-31 23:34:35 -07002472#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002473pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002474 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002475 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002476 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002477 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002478 }
2479}
David Tolnay8c81f622018-07-31 23:34:35 -07002480#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002481pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002482 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002483 PathArguments::None => PathArguments::None,
2484 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2485 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2486 ),
2487 PathArguments::Parenthesized(_binding_0) => {
2488 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002489 }
2490 }
2491}
David Tolnay8c81f622018-07-31 23:34:35 -07002492#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002493pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002494 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002495 ident: _visitor.fold_ident(_i.ident),
2496 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002497 }
2498}
David Tolnay8c81f622018-07-31 23:34:35 -07002499#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002500pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002501 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002502 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002503 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002504 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002505 }
2506}
David Tolnay8c81f622018-07-31 23:34:35 -07002507#[cfg(any(feature = "full", feature = "derive"))]
2508pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2509 _visitor: &mut V,
2510 _i: PredicateLifetime,
2511) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002512 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002513 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002514 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002515 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002516 }
2517}
David Tolnay8c81f622018-07-31 23:34:35 -07002518#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002519pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002520 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002521 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2522 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002523 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002524 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002525 }
2526}
David Tolnay8c81f622018-07-31 23:34:35 -07002527#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002528pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002529 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002530 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002531 ty: Box::new(_visitor.fold_type(*_i.ty)),
2532 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002533 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2534 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002535 }
2536}
David Tolnay8c81f622018-07-31 23:34:35 -07002537#[cfg(any(feature = "full", feature = "derive"))]
2538#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002539pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002540 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002541 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002542 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002543 }
David Tolnay8c81f622018-07-31 23:34:35 -07002544 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002545 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002546 }
2547 }
2548}
David Tolnay8c81f622018-07-31 23:34:35 -07002549#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002550pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002551 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002552 ReturnType::Default => ReturnType::Default,
2553 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002554 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002555 Box::new(_visitor.fold_type(*_binding_1)),
2556 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002557 }
2558}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002559pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002560 _i
2561}
David Tolnay8c81f622018-07-31 23:34:35 -07002562#[cfg(any(feature = "full", feature = "derive"))]
2563#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002564pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002565 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002566 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2567 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2568 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2569 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2570 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002571 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002572 ),
Nika Layzell27726662017-10-24 23:16:35 -04002573 }
2574}
David Tolnay8c81f622018-07-31 23:34:35 -07002575#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002576pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002577 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002578 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002579 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2580 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2581 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002582 }
2583}
David Tolnay8c81f622018-07-31 23:34:35 -07002584#[cfg(any(feature = "full", feature = "derive"))]
2585pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2586 _visitor: &mut V,
2587 _i: TraitBoundModifier,
2588) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002589 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002590 TraitBoundModifier::None => TraitBoundModifier::None,
2591 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002592 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002593 }
2594 }
2595}
David Tolnay8c81f622018-07-31 23:34:35 -07002596#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002597pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002598 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002599 TraitItem::Const(_binding_0) => {
2600 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002601 }
David Tolnay8c81f622018-07-31 23:34:35 -07002602 TraitItem::Method(_binding_0) => {
2603 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002604 }
David Tolnay8c81f622018-07-31 23:34:35 -07002605 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2606 TraitItem::Macro(_binding_0) => {
2607 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002608 }
David Tolnay8c81f622018-07-31 23:34:35 -07002609 TraitItem::Verbatim(_binding_0) => {
2610 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002611 }
Nika Layzell27726662017-10-24 23:16:35 -04002612 }
2613}
David Tolnay8c81f622018-07-31 23:34:35 -07002614#[cfg(feature = "full")]
2615pub fn fold_trait_item_const<V: Fold + ?Sized>(
2616 _visitor: &mut V,
2617 _i: TraitItemConst,
2618) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002619 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002620 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002621 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002622 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002623 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002624 ty: _visitor.fold_type(_i.ty),
2625 default: (_i.default).map(|it| {
2626 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002627 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002628 _visitor.fold_expr((it).1),
2629 )
2630 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002631 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002632 }
2633}
David Tolnay8c81f622018-07-31 23:34:35 -07002634#[cfg(feature = "full")]
2635pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2636 _visitor: &mut V,
2637 _i: TraitItemMacro,
2638) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002639 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002640 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2641 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002642 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002643 }
2644}
David Tolnay8c81f622018-07-31 23:34:35 -07002645#[cfg(feature = "full")]
2646pub fn fold_trait_item_method<V: Fold + ?Sized>(
2647 _visitor: &mut V,
2648 _i: TraitItemMethod,
2649) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002650 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002651 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2652 sig: _visitor.fold_method_sig(_i.sig),
2653 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002654 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002655 }
2656}
David Tolnay8c81f622018-07-31 23:34:35 -07002657#[cfg(feature = "full")]
2658pub fn fold_trait_item_type<V: Fold + ?Sized>(
2659 _visitor: &mut V,
2660 _i: TraitItemType,
2661) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002662 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002663 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002664 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002665 ident: _visitor.fold_ident(_i.ident),
2666 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002667 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002668 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2669 default: (_i.default).map(|it| {
2670 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002671 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002672 _visitor.fold_type((it).1),
2673 )
2674 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002675 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002676 }
2677}
David Tolnay8c81f622018-07-31 23:34:35 -07002678#[cfg(feature = "full")]
2679pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2680 _visitor: &mut V,
2681 _i: TraitItemVerbatim,
2682) -> TraitItemVerbatim {
2683 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002684}
David Tolnay8c81f622018-07-31 23:34:35 -07002685#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002686pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002687 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002688 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2689 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2690 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2691 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2692 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2693 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2694 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2695 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2696 Type::TraitObject(_binding_0) => {
2697 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002698 }
David Tolnay8c81f622018-07-31 23:34:35 -07002699 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2700 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2701 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2702 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2703 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2704 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002705 }
2706}
David Tolnay8c81f622018-07-31 23:34:35 -07002707#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002708pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002709 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002710 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002711 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002712 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002713 len: _visitor.fold_expr(_i.len),
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_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002718 TypeBareFn {
David Tolnay7ac699c2018-08-24 14:00:58 -04002719 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002720 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002721 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002722 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002723 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002724 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002725 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002726 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002727 }
2728}
David Tolnay8c81f622018-07-31 23:34:35 -07002729#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002730pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002731 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002732 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002733 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002734 }
2735}
David Tolnay8c81f622018-07-31 23:34:35 -07002736#[cfg(any(feature = "full", feature = "derive"))]
2737pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2738 _visitor: &mut V,
2739 _i: TypeImplTrait,
2740) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002741 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002742 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002743 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002744 }
2745}
David Tolnay8c81f622018-07-31 23:34:35 -07002746#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002747pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002748 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002749 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002750 }
2751}
David Tolnay8c81f622018-07-31 23:34:35 -07002752#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002753pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002754 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002755 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002756 }
2757}
David Tolnay8c81f622018-07-31 23:34:35 -07002758#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002759pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002760 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002761 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002762 }
2763}
David Tolnay8c81f622018-07-31 23:34:35 -07002764#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002765pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002766 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002767 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2768 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002769 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002770 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002771 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002772 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002773 }
2774}
David Tolnay8c81f622018-07-31 23:34:35 -07002775#[cfg(any(feature = "full", feature = "derive"))]
2776pub fn fold_type_param_bound<V: Fold + ?Sized>(
2777 _visitor: &mut V,
2778 _i: TypeParamBound,
2779) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002780 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002781 TypeParamBound::Trait(_binding_0) => {
2782 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002783 }
David Tolnay8c81f622018-07-31 23:34:35 -07002784 TypeParamBound::Lifetime(_binding_0) => {
2785 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002786 }
2787 }
2788}
David Tolnay8c81f622018-07-31 23:34:35 -07002789#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002790pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002791 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002792 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002793 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002794 }
2795}
David Tolnay8c81f622018-07-31 23:34:35 -07002796#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002797pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002798 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002799 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2800 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002801 }
2802}
David Tolnay8c81f622018-07-31 23:34:35 -07002803#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002804pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002805 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002806 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2807 const_token: (_i.const_token)
2808 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2809 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002810 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002811 }
2812}
David Tolnay8c81f622018-07-31 23:34:35 -07002813#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002814pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002815 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002816 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002817 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002818 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002819 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002820 }
2821}
David Tolnay8c81f622018-07-31 23:34:35 -07002822#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002823pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002824 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002825 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002826 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002827 }
2828}
David Tolnay8c81f622018-07-31 23:34:35 -07002829#[cfg(any(feature = "full", feature = "derive"))]
2830pub fn fold_type_trait_object<V: Fold + ?Sized>(
2831 _visitor: &mut V,
2832 _i: TypeTraitObject,
2833) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002834 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002835 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002836 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002837 }
2838}
David Tolnay8c81f622018-07-31 23:34:35 -07002839#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002840pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002841 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002842 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002843 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002844 }
2845}
David Tolnay8c81f622018-07-31 23:34:35 -07002846#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002847pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002848 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002849}
David Tolnay8c81f622018-07-31 23:34:35 -07002850#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002851pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002852 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002853 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002854 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002855 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002856 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2857 UnOp::Neg(_binding_0) => {
2858 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2859 }
Nika Layzell27726662017-10-24 23:16:35 -04002860 }
2861}
David Tolnay8c81f622018-07-31 23:34:35 -07002862#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002863pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002864 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002865 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002866 }
2867}
David Tolnay8c81f622018-07-31 23:34:35 -07002868#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002869pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2870 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002871 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002872 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002873 }
2874}
David Tolnay8c81f622018-07-31 23:34:35 -07002875#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002876pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2877 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002878 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002879 }
2880}
David Tolnay8c81f622018-07-31 23:34:35 -07002881#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002882pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002883 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002884 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002885 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002886 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002887 }
2888}
David Tolnay8c81f622018-07-31 23:34:35 -07002889#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002890pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2891 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002892 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002893 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002894 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002895 }
2896}
David Tolnay8c81f622018-07-31 23:34:35 -07002897#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002898pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002899 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002900 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2901 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2902 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2903 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2904 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002905 }
2906}
David Tolnay8c81f622018-07-31 23:34:35 -07002907#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002908pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002909 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002910 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2911 ident: _visitor.fold_ident(_i.ident),
2912 fields: _visitor.fold_fields(_i.fields),
2913 discriminant: (_i.discriminant).map(|it| {
2914 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002915 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002916 _visitor.fold_expr((it).1),
2917 )
2918 }),
Nika Layzell27726662017-10-24 23:16:35 -04002919 }
2920}
David Tolnay8c81f622018-07-31 23:34:35 -07002921#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002922pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002923 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002924 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002925 }
2926}
David Tolnay8c81f622018-07-31 23:34:35 -07002927#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002928pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002929 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04002930 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002931 }
2932}
David Tolnay8c81f622018-07-31 23:34:35 -07002933#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002934pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002935 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04002936 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
2937 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
2938 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002939 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002940 }
2941}
David Tolnay8c81f622018-07-31 23:34:35 -07002942#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002943pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002944 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002945 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2946 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2947 Visibility::Restricted(_binding_0) => {
2948 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002949 }
David Tolnay8c81f622018-07-31 23:34:35 -07002950 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04002951 }
2952}
David Tolnay8c81f622018-07-31 23:34:35 -07002953#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002954pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002955 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04002956 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002957 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002958 }
2959}
David Tolnay8c81f622018-07-31 23:34:35 -07002960#[cfg(any(feature = "full", feature = "derive"))]
2961pub fn fold_where_predicate<V: Fold + ?Sized>(
2962 _visitor: &mut V,
2963 _i: WherePredicate,
2964) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002965 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002966 WherePredicate::Type(_binding_0) => {
2967 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002968 }
David Tolnay8c81f622018-07-31 23:34:35 -07002969 WherePredicate::Lifetime(_binding_0) => {
2970 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002971 }
David Tolnay8c81f622018-07-31 23:34:35 -07002972 WherePredicate::Eq(_binding_0) => {
2973 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002974 }
2975 }
2976}