blob: f73e64dec5c9489b6b0f7aea3a6f1985f75e5368 [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)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001312 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1313 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1314 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001315 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001316 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001317 output: _visitor.fold_return_type(_i.output),
1318 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001319 }
1320}
David Tolnay8c81f622018-07-31 23:34:35 -07001321#[cfg(feature = "full")]
1322#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001323pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001324 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001325 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001326 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001327 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001328 }
1329}
David Tolnay8c81f622018-07-31 23:34:35 -07001330#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001331pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001332 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001333 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1334 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001335 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001336 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001337 }
1338}
David Tolnay8c81f622018-07-31 23:34:35 -07001339#[cfg(feature = "full")]
1340#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001341pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001342 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001343 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1344 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001345 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001346 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001347 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001348 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1349 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001350 }
1351}
David Tolnay8c81f622018-07-31 23:34:35 -07001352#[cfg(feature = "full")]
1353#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001354pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001355 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001356 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001357 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001358 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001359 }
1360}
David Tolnay8c81f622018-07-31 23:34:35 -07001361#[cfg(feature = "full")]
1362#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001363pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001364 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001365 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001366 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001367 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1368 then_branch: _visitor.fold_block(_i.then_branch),
1369 else_branch: (_i.else_branch).map(|it| {
1370 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001371 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001372 Box::new(_visitor.fold_expr(*(it).1)),
1373 )
1374 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001375 }
1376}
David Tolnay8c81f622018-07-31 23:34:35 -07001377#[cfg(feature = "full")]
1378#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001379pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001380 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001381 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001382 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
1383 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001384 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001385 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001386 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1387 then_branch: _visitor.fold_block(_i.then_branch),
1388 else_branch: (_i.else_branch).map(|it| {
1389 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001390 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001391 Box::new(_visitor.fold_expr(*(it).1)),
1392 )
1393 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001394 }
1395}
David Tolnay8c81f622018-07-31 23:34:35 -07001396#[cfg(feature = "full")]
1397#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001398pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001399 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001400 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1401 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001402 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001403 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001404 }
1405}
David Tolnay8c81f622018-07-31 23:34:35 -07001406#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001407pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001408 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001409 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1410 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001411 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001412 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001413 }
1414}
David Tolnay8c81f622018-07-31 23:34:35 -07001415#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001416pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001417 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001418 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1419 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001420 }
1421}
David Tolnay8c81f622018-07-31 23:34:35 -07001422#[cfg(feature = "full")]
1423#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001424pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001425 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001426 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1427 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001428 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001429 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001430 }
1431}
David Tolnay8c81f622018-07-31 23:34:35 -07001432#[cfg(feature = "full")]
1433#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001434pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001435 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001436 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1437 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001438 }
1439}
David Tolnay8c81f622018-07-31 23:34:35 -07001440#[cfg(feature = "full")]
1441#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001442pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001443 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001444 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001445 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001446 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001447 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001448 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001449 }
1450}
David Tolnay8c81f622018-07-31 23:34:35 -07001451#[cfg(feature = "full")]
1452#[cfg(any(feature = "full", feature = "derive"))]
1453pub fn fold_expr_method_call<V: Fold + ?Sized>(
1454 _visitor: &mut V,
1455 _i: ExprMethodCall,
1456) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001457 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001458 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1459 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001460 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001461 method: _visitor.fold_ident(_i.method),
1462 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001463 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001464 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001465 }
1466}
David Tolnay8c81f622018-07-31 23:34:35 -07001467#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001468pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001469 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001470 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001471 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001472 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001473 }
1474}
David Tolnay8c81f622018-07-31 23:34:35 -07001475#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001476pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001477 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001478 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1479 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1480 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001481 }
1482}
David Tolnay8c81f622018-07-31 23:34:35 -07001483#[cfg(feature = "full")]
1484#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001485pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001486 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001487 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1488 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1489 limits: _visitor.fold_range_limits(_i.limits),
1490 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001491 }
1492}
David Tolnay8c81f622018-07-31 23:34:35 -07001493#[cfg(feature = "full")]
1494#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001495pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1496 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001497 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001498 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1499 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001500 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001501 }
1502}
David Tolnay8c81f622018-07-31 23:34:35 -07001503#[cfg(feature = "full")]
1504#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001505pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001506 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001507 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001508 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001509 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001510 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001511 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001512 }
1513}
David Tolnay8c81f622018-07-31 23:34:35 -07001514#[cfg(feature = "full")]
1515#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001516pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001517 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001518 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001519 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001520 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001521 }
1522}
David Tolnay8c81f622018-07-31 23:34:35 -07001523#[cfg(feature = "full")]
1524#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001525pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001526 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001527 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1528 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001529 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001530 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001531 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001532 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001533 }
1534}
David Tolnay8c81f622018-07-31 23:34:35 -07001535#[cfg(feature = "full")]
1536#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001537pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001538 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001539 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1540 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001541 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001542 }
1543}
David Tolnay8c81f622018-07-31 23:34:35 -07001544#[cfg(feature = "full")]
1545#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001546pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001547 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001548 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001549 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001550 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001551 }
1552}
David Tolnay8c81f622018-07-31 23:34:35 -07001553#[cfg(feature = "full")]
1554#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001555pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001556 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001557 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1558 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001559 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001560 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001561 }
1562}
David Tolnay8c81f622018-07-31 23:34:35 -07001563#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001564pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001565 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001566 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1567 op: _visitor.fold_un_op(_i.op),
1568 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001569 }
1570}
David Tolnay8c81f622018-07-31 23:34:35 -07001571#[cfg(feature = "full")]
1572#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001573pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001574 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001575 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001576 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001577 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001578 }
1579}
David Tolnay8c81f622018-07-31 23:34:35 -07001580#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001581pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001582 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001583}
David Tolnay8c81f622018-07-31 23:34:35 -07001584#[cfg(feature = "full")]
1585#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001586pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001587 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001588 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1589 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001590 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001591 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1592 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001593 }
1594}
David Tolnay8c81f622018-07-31 23:34:35 -07001595#[cfg(feature = "full")]
1596#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001597pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001598 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001599 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1600 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001601 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
1602 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001603 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001604 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001605 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1606 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001607 }
1608}
David Tolnay8c81f622018-07-31 23:34:35 -07001609#[cfg(feature = "full")]
1610#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001611pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001612 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001613 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001614 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001615 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001616 }
1617}
David Tolnay8c81f622018-07-31 23:34:35 -07001618#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001619pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001620 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001621 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1622 vis: _visitor.fold_visibility(_i.vis),
1623 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001624 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001625 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001626 }
1627}
David Tolnay8c81f622018-07-31 23:34:35 -07001628#[cfg(any(feature = "full", feature = "derive"))]
1629#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001630pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001631 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001632 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1633 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001634 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001635 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001636 }
1637}
David Tolnay8c81f622018-07-31 23:34:35 -07001638#[cfg(any(feature = "full", feature = "derive"))]
1639#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001640pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001641 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001642 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1643 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001644 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001645 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001646 }
1647}
David Tolnay8c81f622018-07-31 23:34:35 -07001648#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001649pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001650 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001651 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1652 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1653 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001654 }
1655}
David Tolnay8c81f622018-07-31 23:34:35 -07001656#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001657pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001658 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001659 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001660 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001661 }
1662}
David Tolnay8c81f622018-07-31 23:34:35 -07001663#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001664pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001665 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001666 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001667 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001668 }
1669}
David Tolnay8c81f622018-07-31 23:34:35 -07001670#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001671pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001672 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001673 shebang: _i.shebang,
1674 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1675 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001676 }
1677}
David Tolnay8c81f622018-07-31 23:34:35 -07001678#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001679pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001680 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001681 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1682 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1683 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1684 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1685 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001686 }
1687}
David Tolnay8c81f622018-07-31 23:34:35 -07001688#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001689pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001690 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001691 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001692 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001693 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001694 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001695 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001696 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001697 }
1698}
David Tolnay8c81f622018-07-31 23:34:35 -07001699#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001700pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001701 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001702 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1703 ForeignItem::Static(_binding_0) => {
1704 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001705 }
David Tolnay8c81f622018-07-31 23:34:35 -07001706 ForeignItem::Type(_binding_0) => {
1707 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001708 }
David Tolnay435c1782018-08-24 16:15:44 -04001709 ForeignItem::Macro(_binding_0) => {
1710 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1711 }
David Tolnay8c81f622018-07-31 23:34:35 -07001712 ForeignItem::Verbatim(_binding_0) => {
1713 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001714 }
Nika Layzell27726662017-10-24 23:16:35 -04001715 }
1716}
David Tolnay8c81f622018-07-31 23:34:35 -07001717#[cfg(feature = "full")]
1718pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1719 _visitor: &mut V,
1720 _i: ForeignItemFn,
1721) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001722 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001723 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1724 vis: _visitor.fold_visibility(_i.vis),
1725 ident: _visitor.fold_ident(_i.ident),
1726 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001727 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001728 }
1729}
David Tolnay8c81f622018-07-31 23:34:35 -07001730#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001731pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1732 _visitor: &mut V,
1733 _i: ForeignItemMacro,
1734) -> ForeignItemMacro {
1735 ForeignItemMacro {
1736 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1737 mac: _visitor.fold_macro(_i.mac),
1738 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1739 }
1740}
1741#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001742pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1743 _visitor: &mut V,
1744 _i: ForeignItemStatic,
1745) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001746 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001747 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1748 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001749 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1750 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001751 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001752 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001753 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001754 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001755 }
1756}
David Tolnay8c81f622018-07-31 23:34:35 -07001757#[cfg(feature = "full")]
1758pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1759 _visitor: &mut V,
1760 _i: ForeignItemType,
1761) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001762 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001763 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1764 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001765 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001766 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001767 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001768 }
1769}
David Tolnay8c81f622018-07-31 23:34:35 -07001770#[cfg(feature = "full")]
1771pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1772 _visitor: &mut V,
1773 _i: ForeignItemVerbatim,
1774) -> ForeignItemVerbatim {
1775 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001776}
David Tolnay8c81f622018-07-31 23:34:35 -07001777#[cfg(any(feature = "full", feature = "derive"))]
1778pub fn fold_generic_argument<V: Fold + ?Sized>(
1779 _visitor: &mut V,
1780 _i: GenericArgument,
1781) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001782 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001783 GenericArgument::Lifetime(_binding_0) => {
1784 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001785 }
David Tolnay8c81f622018-07-31 23:34:35 -07001786 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1787 GenericArgument::Binding(_binding_0) => {
1788 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001789 }
David Tolnay8c81f622018-07-31 23:34:35 -07001790 GenericArgument::Const(_binding_0) => {
1791 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001792 }
Nika Layzell357885a2017-12-04 15:47:07 -05001793 }
1794}
David Tolnay8c81f622018-07-31 23:34:35 -07001795#[cfg(any(feature = "full", feature = "derive"))]
1796#[cfg(feature = "full")]
1797pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1798 _visitor: &mut V,
1799 _i: GenericMethodArgument,
1800) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001801 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001802 GenericMethodArgument::Type(_binding_0) => {
1803 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001804 }
David Tolnay8c81f622018-07-31 23:34:35 -07001805 GenericMethodArgument::Const(_binding_0) => {
1806 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001807 }
1808 }
1809}
David Tolnay8c81f622018-07-31 23:34:35 -07001810#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001811pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001812 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001813 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1814 GenericParam::Lifetime(_binding_0) => {
1815 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001816 }
David Tolnay8c81f622018-07-31 23:34:35 -07001817 GenericParam::Const(_binding_0) => {
1818 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001819 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001820 }
1821}
David Tolnay8c81f622018-07-31 23:34:35 -07001822#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001823pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001824 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001825 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001826 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001827 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001828 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001829 }
1830}
Alex Crichtond261d092018-05-18 13:47:35 -07001831pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001832 let mut _i = _i;
1833 let span = _visitor.fold_span(_i.span());
1834 _i.set_span(span);
1835 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001836}
David Tolnay8c81f622018-07-31 23:34:35 -07001837#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001838pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001839 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001840 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1841 ImplItem::Method(_binding_0) => {
1842 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001843 }
David Tolnay8c81f622018-07-31 23:34:35 -07001844 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
1845 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1846 ImplItem::Verbatim(_binding_0) => {
1847 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001848 }
Nika Layzell27726662017-10-24 23:16:35 -04001849 }
1850}
David Tolnay8c81f622018-07-31 23:34:35 -07001851#[cfg(feature = "full")]
1852pub fn fold_impl_item_const<V: Fold + ?Sized>(
1853 _visitor: &mut V,
1854 _i: ImplItemConst,
1855) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001856 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001857 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1858 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001859 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1860 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001861 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001862 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001863 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001864 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001865 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001866 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001867 }
1868}
David Tolnay8c81f622018-07-31 23:34:35 -07001869#[cfg(feature = "full")]
1870pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1871 _visitor: &mut V,
1872 _i: ImplItemMacro,
1873) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001874 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001875 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1876 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001877 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001878 }
1879}
David Tolnay8c81f622018-07-31 23:34:35 -07001880#[cfg(feature = "full")]
1881pub fn fold_impl_item_method<V: Fold + ?Sized>(
1882 _visitor: &mut V,
1883 _i: ImplItemMethod,
1884) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001885 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001886 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1887 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001888 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001889 sig: _visitor.fold_method_sig(_i.sig),
1890 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001891 }
1892}
David Tolnay8c81f622018-07-31 23:34:35 -07001893#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001894pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001895 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001896 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1897 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001898 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1899 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001900 ident: _visitor.fold_ident(_i.ident),
1901 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001902 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001903 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001904 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001905 }
1906}
David Tolnay8c81f622018-07-31 23:34:35 -07001907#[cfg(feature = "full")]
1908pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1909 _visitor: &mut V,
1910 _i: ImplItemVerbatim,
1911) -> ImplItemVerbatim {
1912 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001913}
David Tolnay8c81f622018-07-31 23:34:35 -07001914#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001915pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001916 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001917 index: _i.index,
1918 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001919 }
1920}
David Tolnay8c81f622018-07-31 23:34:35 -07001921#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001922pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001923 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001924 Item::ExternCrate(_binding_0) => {
1925 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001926 }
David Tolnay8c81f622018-07-31 23:34:35 -07001927 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1928 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1929 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1930 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1931 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1932 Item::ForeignMod(_binding_0) => {
1933 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001934 }
David Tolnay8c81f622018-07-31 23:34:35 -07001935 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
1936 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1937 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1938 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1939 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
1940 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1941 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1942 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1943 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001944 }
1945}
David Tolnay8c81f622018-07-31 23:34:35 -07001946#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001947pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001948 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001949 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1950 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001951 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001952 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001953 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001954 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001955 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001956 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001957 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001958 }
1959}
David Tolnay8c81f622018-07-31 23:34:35 -07001960#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001961pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001962 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001963 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1964 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001965 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001966 ident: _visitor.fold_ident(_i.ident),
1967 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001968 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001969 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001970 }
1971}
David Tolnay8c81f622018-07-31 23:34:35 -07001972#[cfg(feature = "full")]
1973pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1974 _visitor: &mut V,
1975 _i: ItemExternCrate,
1976) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001977 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001978 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1979 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001980 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
1981 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001982 ident: _visitor.fold_ident(_i.ident),
1983 rename: (_i.rename).map(|it| {
1984 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001985 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001986 _visitor.fold_ident((it).1),
1987 )
1988 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04001989 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001990 }
1991}
David Tolnay8c81f622018-07-31 23:34:35 -07001992#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001993pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001994 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001995 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1996 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001997 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
1998 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09001999 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002000 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2001 ident: _visitor.fold_ident(_i.ident),
2002 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2003 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002004 }
2005}
David Tolnay8c81f622018-07-31 23:34:35 -07002006#[cfg(feature = "full")]
2007pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2008 _visitor: &mut V,
2009 _i: ItemForeignMod,
2010) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002011 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002012 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2013 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002014 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002015 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002016 }
2017}
David Tolnay8c81f622018-07-31 23:34:35 -07002018#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002019pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002020 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002021 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002022 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2023 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2024 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002025 generics: _visitor.fold_generics(_i.generics),
2026 trait_: (_i.trait_).map(|it| {
2027 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002028 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002029 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002030 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002031 )
2032 }),
2033 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002034 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002035 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002036 }
2037}
David Tolnay8c81f622018-07-31 23:34:35 -07002038#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002039pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002040 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002041 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2042 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2043 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002044 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002045 }
2046}
David Tolnay8c81f622018-07-31 23:34:35 -07002047#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002048pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002049 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002050 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2051 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002052 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002053 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002054 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002055 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002056 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002057 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002058 }
2059}
David Tolnay8c81f622018-07-31 23:34:35 -07002060#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002061pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002062 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002063 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2064 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002065 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002066 ident: _visitor.fold_ident(_i.ident),
2067 content: (_i.content).map(|it| {
2068 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002069 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002070 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2071 )
2072 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002073 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002074 }
2075}
David Tolnay8c81f622018-07-31 23:34:35 -07002076#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002077pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002078 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002079 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2080 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002081 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2082 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002083 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002084 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002085 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002086 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002087 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002088 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002089 }
2090}
David Tolnay8c81f622018-07-31 23:34:35 -07002091#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002092pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002093 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002094 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2095 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002096 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002097 ident: _visitor.fold_ident(_i.ident),
2098 generics: _visitor.fold_generics(_i.generics),
2099 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002100 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002101 }
2102}
David Tolnay8c81f622018-07-31 23:34:35 -07002103#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002104pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002105 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002106 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2107 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002108 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2109 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2110 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002111 ident: _visitor.fold_ident(_i.ident),
2112 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002113 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002114 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002115 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002116 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002117 }
2118}
David Tolnay8c81f622018-07-31 23:34:35 -07002119#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002120pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002121 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002122 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2123 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002124 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002125 ident: _visitor.fold_ident(_i.ident),
2126 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002127 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002128 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002129 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002130 }
2131}
David Tolnay8c81f622018-07-31 23:34:35 -07002132#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002133pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002134 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002135 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2136 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002137 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002138 ident: _visitor.fold_ident(_i.ident),
2139 generics: _visitor.fold_generics(_i.generics),
2140 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002141 }
2142}
David Tolnay8c81f622018-07-31 23:34:35 -07002143#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002144pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002145 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002146 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2147 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002148 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002149 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002150 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002151 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002152 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002153 }
2154}
David Tolnay8c81f622018-07-31 23:34:35 -07002155#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002156pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002157 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002158}
David Tolnay8c81f622018-07-31 23:34:35 -07002159#[cfg(any(feature = "full", feature = "derive"))]
2160#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002161pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002162 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002163 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002164 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002165 }
2166}
David Tolnay8c81f622018-07-31 23:34:35 -07002167#[cfg(any(feature = "full", feature = "derive"))]
Alex Crichton131308c2018-05-18 14:00:24 -07002168pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2169 Lifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002170 apostrophe: _i.apostrophe,
2171 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002172 }
2173}
David Tolnay8c81f622018-07-31 23:34:35 -07002174#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002175pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002176 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002177 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2178 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002179 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002180 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002181 }
2182}
David Tolnay8c81f622018-07-31 23:34:35 -07002183#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002184pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002185 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002186 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2187 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2188 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2189 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2190 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2191 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2192 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2193 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002194 }
2195}
David Tolnay8c81f622018-07-31 23:34:35 -07002196#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002197pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002198 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002199 value: _i.value,
2200 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002201 }
2202}
David Tolnay8c81f622018-07-31 23:34:35 -07002203#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002204pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002205 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002206}
David Tolnay8c81f622018-07-31 23:34:35 -07002207#[cfg(any(feature = "full", feature = "derive"))]
2208#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002209pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002210 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002211 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002212 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002213 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2214 ty: (_i.ty).map(|it| {
2215 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002216 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002217 Box::new(_visitor.fold_type(*(it).1)),
2218 )
2219 }),
2220 init: (_i.init).map(|it| {
2221 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002222 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002223 Box::new(_visitor.fold_expr(*(it).1)),
2224 )
2225 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002226 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002227 }
2228}
David Tolnay8c81f622018-07-31 23:34:35 -07002229#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002230pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002231 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002232 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002233 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002234 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2235 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002236 }
2237}
David Tolnay8c81f622018-07-31 23:34:35 -07002238#[cfg(any(feature = "full", feature = "derive"))]
2239pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2240 _visitor: &mut V,
2241 _i: MacroDelimiter,
2242) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002243 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002244 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002245 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002246 }
David Tolnay8c81f622018-07-31 23:34:35 -07002247 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002248 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002249 }
David Tolnay8c81f622018-07-31 23:34:35 -07002250 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002251 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002252 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002253 }
2254}
David Tolnay8c81f622018-07-31 23:34:35 -07002255#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002256pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002257 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002258 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2259 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002260 }
2261}
David Tolnay8c81f622018-07-31 23:34:35 -07002262#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002263pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002264 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002265 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2266 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2267 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002268 }
2269}
David Tolnay8c81f622018-07-31 23:34:35 -07002270#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002271pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2272 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002273 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002274 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002275 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002276 }
2277}
David Tolnay8c81f622018-07-31 23:34:35 -07002278#[cfg(any(feature = "full", feature = "derive"))]
2279pub fn fold_meta_name_value<V: Fold + ?Sized>(
2280 _visitor: &mut V,
2281 _i: MetaNameValue,
2282) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002283 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002284 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002285 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002286 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002287 }
2288}
David Tolnay8c81f622018-07-31 23:34:35 -07002289#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002290pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002291 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002292 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2293 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002294 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002295 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2296 ident: _visitor.fold_ident(_i.ident),
2297 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002298 }
2299}
David Tolnay8c81f622018-07-31 23:34:35 -07002300#[cfg(any(feature = "full", feature = "derive"))]
2301#[cfg(feature = "full")]
2302pub fn fold_method_turbofish<V: Fold + ?Sized>(
2303 _visitor: &mut V,
2304 _i: MethodTurbofish,
2305) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002306 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002307 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2308 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002309 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002310 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002311 }
2312}
David Tolnay8c81f622018-07-31 23:34:35 -07002313#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002314pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002315 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002316 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2317 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002318 }
2319}
David Tolnay8c81f622018-07-31 23:34:35 -07002320#[cfg(any(feature = "full", feature = "derive"))]
2321pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2322 _visitor: &mut V,
2323 _i: ParenthesizedGenericArguments,
2324) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002325 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002326 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002327 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2328 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002329 }
2330}
David Tolnay8c81f622018-07-31 23:34:35 -07002331#[cfg(any(feature = "full", feature = "derive"))]
2332#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002333pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002334 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002335 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2336 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2337 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2338 Pat::TupleStruct(_binding_0) => {
2339 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002340 }
David Tolnay8c81f622018-07-31 23:34:35 -07002341 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2342 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2343 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2344 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2345 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2346 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2347 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2348 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2349 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002350 }
2351}
David Tolnay8c81f622018-07-31 23:34:35 -07002352#[cfg(any(feature = "full", feature = "derive"))]
2353#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002354pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002355 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002356 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002357 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002358 }
2359}
David Tolnay8c81f622018-07-31 23:34:35 -07002360#[cfg(any(feature = "full", feature = "derive"))]
2361#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002362pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002363 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002364 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2365 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002366 ident: _visitor.fold_ident(_i.ident),
2367 subpat: (_i.subpat).map(|it| {
2368 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002369 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002370 Box::new(_visitor.fold_pat(*(it).1)),
2371 )
2372 }),
Nika Layzell27726662017-10-24 23:16:35 -04002373 }
2374}
David Tolnay8c81f622018-07-31 23:34:35 -07002375#[cfg(any(feature = "full", feature = "derive"))]
2376#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002377pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002378 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002379 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002380 }
2381}
David Tolnay8c81f622018-07-31 23:34:35 -07002382#[cfg(any(feature = "full", feature = "derive"))]
2383#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002384pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002385 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002386 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002387 }
2388}
David Tolnay8c81f622018-07-31 23:34:35 -07002389#[cfg(any(feature = "full", feature = "derive"))]
2390#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002391pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002392 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002393 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2394 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002395 }
2396}
David Tolnay8c81f622018-07-31 23:34:35 -07002397#[cfg(any(feature = "full", feature = "derive"))]
2398#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002399pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002400 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002401 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2402 limits: _visitor.fold_range_limits(_i.limits),
2403 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002404 }
2405}
David Tolnay8c81f622018-07-31 23:34:35 -07002406#[cfg(any(feature = "full", feature = "derive"))]
2407#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002408pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002409 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002410 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2411 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002412 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002413 }
2414}
David Tolnay8c81f622018-07-31 23:34:35 -07002415#[cfg(any(feature = "full", feature = "derive"))]
2416#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002417pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002418 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002419 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002420 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2421 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002422 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2423 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002424 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002425 }
2426}
David Tolnay8c81f622018-07-31 23:34:35 -07002427#[cfg(any(feature = "full", feature = "derive"))]
2428#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002429pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002430 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002431 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002432 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002433 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002434 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002435 }
2436}
David Tolnay8c81f622018-07-31 23:34:35 -07002437#[cfg(any(feature = "full", feature = "derive"))]
2438#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002439pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002440 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002441 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002442 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002443 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2444 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002445 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002446 }
2447}
David Tolnay8c81f622018-07-31 23:34:35 -07002448#[cfg(any(feature = "full", feature = "derive"))]
2449#[cfg(feature = "full")]
2450pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2451 _visitor: &mut V,
2452 _i: PatTupleStruct,
2453) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002454 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002455 path: _visitor.fold_path(_i.path),
2456 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002457 }
2458}
David Tolnay8c81f622018-07-31 23:34:35 -07002459#[cfg(any(feature = "full", feature = "derive"))]
2460#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002461pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002462 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002463}
David Tolnay8c81f622018-07-31 23:34:35 -07002464#[cfg(any(feature = "full", feature = "derive"))]
2465#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002466pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002467 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002468 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002469 }
2470}
David Tolnay8c81f622018-07-31 23:34:35 -07002471#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002472pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002473 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002474 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002475 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002476 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002477 }
2478}
David Tolnay8c81f622018-07-31 23:34:35 -07002479#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002480pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002481 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002482 PathArguments::None => PathArguments::None,
2483 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2484 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2485 ),
2486 PathArguments::Parenthesized(_binding_0) => {
2487 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002488 }
2489 }
2490}
David Tolnay8c81f622018-07-31 23:34:35 -07002491#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002492pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002493 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002494 ident: _visitor.fold_ident(_i.ident),
2495 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002496 }
2497}
David Tolnay8c81f622018-07-31 23:34:35 -07002498#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002499pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002500 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002501 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002502 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002503 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002504 }
2505}
David Tolnay8c81f622018-07-31 23:34:35 -07002506#[cfg(any(feature = "full", feature = "derive"))]
2507pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2508 _visitor: &mut V,
2509 _i: PredicateLifetime,
2510) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002511 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002512 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002513 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002514 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002515 }
2516}
David Tolnay8c81f622018-07-31 23:34:35 -07002517#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002518pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002519 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002520 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2521 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002522 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002523 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002524 }
2525}
David Tolnay8c81f622018-07-31 23:34:35 -07002526#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002527pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002528 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002529 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002530 ty: Box::new(_visitor.fold_type(*_i.ty)),
2531 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002532 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2533 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002534 }
2535}
David Tolnay8c81f622018-07-31 23:34:35 -07002536#[cfg(any(feature = "full", feature = "derive"))]
2537#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002538pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002539 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002540 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002541 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002542 }
David Tolnay8c81f622018-07-31 23:34:35 -07002543 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002544 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002545 }
2546 }
2547}
David Tolnay8c81f622018-07-31 23:34:35 -07002548#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002549pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002550 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002551 ReturnType::Default => ReturnType::Default,
2552 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002553 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002554 Box::new(_visitor.fold_type(*_binding_1)),
2555 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002556 }
2557}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002558pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002559 _i
2560}
David Tolnay8c81f622018-07-31 23:34:35 -07002561#[cfg(any(feature = "full", feature = "derive"))]
2562#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002563pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002564 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002565 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2566 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2567 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2568 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2569 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002570 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002571 ),
Nika Layzell27726662017-10-24 23:16:35 -04002572 }
2573}
David Tolnay8c81f622018-07-31 23:34:35 -07002574#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002575pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002576 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002577 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002578 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2579 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2580 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002581 }
2582}
David Tolnay8c81f622018-07-31 23:34:35 -07002583#[cfg(any(feature = "full", feature = "derive"))]
2584pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2585 _visitor: &mut V,
2586 _i: TraitBoundModifier,
2587) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002588 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002589 TraitBoundModifier::None => TraitBoundModifier::None,
2590 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002591 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002592 }
2593 }
2594}
David Tolnay8c81f622018-07-31 23:34:35 -07002595#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002596pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002597 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002598 TraitItem::Const(_binding_0) => {
2599 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002600 }
David Tolnay8c81f622018-07-31 23:34:35 -07002601 TraitItem::Method(_binding_0) => {
2602 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002603 }
David Tolnay8c81f622018-07-31 23:34:35 -07002604 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2605 TraitItem::Macro(_binding_0) => {
2606 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002607 }
David Tolnay8c81f622018-07-31 23:34:35 -07002608 TraitItem::Verbatim(_binding_0) => {
2609 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002610 }
Nika Layzell27726662017-10-24 23:16:35 -04002611 }
2612}
David Tolnay8c81f622018-07-31 23:34:35 -07002613#[cfg(feature = "full")]
2614pub fn fold_trait_item_const<V: Fold + ?Sized>(
2615 _visitor: &mut V,
2616 _i: TraitItemConst,
2617) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002618 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002619 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002620 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002621 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002622 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002623 ty: _visitor.fold_type(_i.ty),
2624 default: (_i.default).map(|it| {
2625 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002626 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002627 _visitor.fold_expr((it).1),
2628 )
2629 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002630 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002631 }
2632}
David Tolnay8c81f622018-07-31 23:34:35 -07002633#[cfg(feature = "full")]
2634pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2635 _visitor: &mut V,
2636 _i: TraitItemMacro,
2637) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002638 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002639 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2640 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002641 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002642 }
2643}
David Tolnay8c81f622018-07-31 23:34:35 -07002644#[cfg(feature = "full")]
2645pub fn fold_trait_item_method<V: Fold + ?Sized>(
2646 _visitor: &mut V,
2647 _i: TraitItemMethod,
2648) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002649 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002650 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2651 sig: _visitor.fold_method_sig(_i.sig),
2652 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002653 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002654 }
2655}
David Tolnay8c81f622018-07-31 23:34:35 -07002656#[cfg(feature = "full")]
2657pub fn fold_trait_item_type<V: Fold + ?Sized>(
2658 _visitor: &mut V,
2659 _i: TraitItemType,
2660) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002661 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002662 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002663 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002664 ident: _visitor.fold_ident(_i.ident),
2665 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002666 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002667 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2668 default: (_i.default).map(|it| {
2669 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002670 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002671 _visitor.fold_type((it).1),
2672 )
2673 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002674 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002675 }
2676}
David Tolnay8c81f622018-07-31 23:34:35 -07002677#[cfg(feature = "full")]
2678pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2679 _visitor: &mut V,
2680 _i: TraitItemVerbatim,
2681) -> TraitItemVerbatim {
2682 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002683}
David Tolnay8c81f622018-07-31 23:34:35 -07002684#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002685pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002686 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002687 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2688 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2689 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2690 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2691 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2692 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2693 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2694 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2695 Type::TraitObject(_binding_0) => {
2696 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002697 }
David Tolnay8c81f622018-07-31 23:34:35 -07002698 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2699 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2700 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2701 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2702 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2703 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002704 }
2705}
David Tolnay8c81f622018-07-31 23:34:35 -07002706#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002707pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002708 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002709 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002710 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002711 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002712 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002713 }
2714}
David Tolnay8c81f622018-07-31 23:34:35 -07002715#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002716pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002717 TypeBareFn {
David Tolnay7ac699c2018-08-24 14:00:58 -04002718 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002719 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002720 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002721 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002722 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002723 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002724 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002725 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002726 }
2727}
David Tolnay8c81f622018-07-31 23:34:35 -07002728#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002729pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002730 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002731 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002732 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002733 }
2734}
David Tolnay8c81f622018-07-31 23:34:35 -07002735#[cfg(any(feature = "full", feature = "derive"))]
2736pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2737 _visitor: &mut V,
2738 _i: TypeImplTrait,
2739) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002740 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002741 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002742 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002743 }
2744}
David Tolnay8c81f622018-07-31 23:34:35 -07002745#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002746pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002747 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002748 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002749 }
2750}
David Tolnay8c81f622018-07-31 23:34:35 -07002751#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002752pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002753 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002754 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002755 }
2756}
David Tolnay8c81f622018-07-31 23:34:35 -07002757#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002758pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002759 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002760 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002761 }
2762}
David Tolnay8c81f622018-07-31 23:34:35 -07002763#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002764pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002765 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002766 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2767 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002768 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002769 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002770 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002771 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002772 }
2773}
David Tolnay8c81f622018-07-31 23:34:35 -07002774#[cfg(any(feature = "full", feature = "derive"))]
2775pub fn fold_type_param_bound<V: Fold + ?Sized>(
2776 _visitor: &mut V,
2777 _i: TypeParamBound,
2778) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002779 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002780 TypeParamBound::Trait(_binding_0) => {
2781 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002782 }
David Tolnay8c81f622018-07-31 23:34:35 -07002783 TypeParamBound::Lifetime(_binding_0) => {
2784 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002785 }
2786 }
2787}
David Tolnay8c81f622018-07-31 23:34:35 -07002788#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002789pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002790 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002791 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002792 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002793 }
2794}
David Tolnay8c81f622018-07-31 23:34:35 -07002795#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002796pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002797 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002798 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2799 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002800 }
2801}
David Tolnay8c81f622018-07-31 23:34:35 -07002802#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002803pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002804 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002805 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2806 const_token: (_i.const_token)
2807 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2808 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002809 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002810 }
2811}
David Tolnay8c81f622018-07-31 23:34:35 -07002812#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002813pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002814 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002815 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002816 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002817 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002818 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002819 }
2820}
David Tolnay8c81f622018-07-31 23:34:35 -07002821#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002822pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002823 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002824 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002825 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002826 }
2827}
David Tolnay8c81f622018-07-31 23:34:35 -07002828#[cfg(any(feature = "full", feature = "derive"))]
2829pub fn fold_type_trait_object<V: Fold + ?Sized>(
2830 _visitor: &mut V,
2831 _i: TypeTraitObject,
2832) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002833 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002834 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002835 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002836 }
2837}
David Tolnay8c81f622018-07-31 23:34:35 -07002838#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002839pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002840 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002841 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002842 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002843 }
2844}
David Tolnay8c81f622018-07-31 23:34:35 -07002845#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002846pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002847 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002848}
David Tolnay8c81f622018-07-31 23:34:35 -07002849#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002850pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002851 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002852 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002853 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002854 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002855 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2856 UnOp::Neg(_binding_0) => {
2857 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2858 }
Nika Layzell27726662017-10-24 23:16:35 -04002859 }
2860}
David Tolnay8c81f622018-07-31 23:34:35 -07002861#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002862pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002863 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002864 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002865 }
2866}
David Tolnay8c81f622018-07-31 23:34:35 -07002867#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002868pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2869 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002870 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002871 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002872 }
2873}
David Tolnay8c81f622018-07-31 23:34:35 -07002874#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002875pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2876 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002877 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002878 }
2879}
David Tolnay8c81f622018-07-31 23:34:35 -07002880#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002881pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002882 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002883 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002884 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002885 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002886 }
2887}
David Tolnay8c81f622018-07-31 23:34:35 -07002888#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002889pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2890 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002891 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002892 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002893 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002894 }
2895}
David Tolnay8c81f622018-07-31 23:34:35 -07002896#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002897pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002898 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002899 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2900 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2901 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2902 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2903 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002904 }
2905}
David Tolnay8c81f622018-07-31 23:34:35 -07002906#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002907pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002908 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002909 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2910 ident: _visitor.fold_ident(_i.ident),
2911 fields: _visitor.fold_fields(_i.fields),
2912 discriminant: (_i.discriminant).map(|it| {
2913 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002914 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002915 _visitor.fold_expr((it).1),
2916 )
2917 }),
Nika Layzell27726662017-10-24 23:16:35 -04002918 }
2919}
David Tolnay8c81f622018-07-31 23:34:35 -07002920#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002921pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002922 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002923 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002924 }
2925}
David Tolnay8c81f622018-07-31 23:34:35 -07002926#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002927pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002928 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04002929 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002930 }
2931}
David Tolnay8c81f622018-07-31 23:34:35 -07002932#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002933pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002934 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04002935 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
2936 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
2937 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002938 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002939 }
2940}
David Tolnay8c81f622018-07-31 23:34:35 -07002941#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002942pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002943 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002944 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2945 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2946 Visibility::Restricted(_binding_0) => {
2947 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002948 }
David Tolnay8c81f622018-07-31 23:34:35 -07002949 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04002950 }
2951}
David Tolnay8c81f622018-07-31 23:34:35 -07002952#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002953pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002954 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04002955 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002956 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002957 }
2958}
David Tolnay8c81f622018-07-31 23:34:35 -07002959#[cfg(any(feature = "full", feature = "derive"))]
2960pub fn fold_where_predicate<V: Fold + ?Sized>(
2961 _visitor: &mut V,
2962 _i: WherePredicate,
2963) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002964 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002965 WherePredicate::Type(_binding_0) => {
2966 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002967 }
David Tolnay8c81f622018-07-31 23:34:35 -07002968 WherePredicate::Lifetime(_binding_0) => {
2969 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002970 }
David Tolnay8c81f622018-07-31 23:34:35 -07002971 WherePredicate::Eq(_binding_0) => {
2972 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002973 }
2974 }
2975}