blob: 3eb18753e9bf65ee1066c4dbc9921aa40c6438e0 [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 Tolnay0a0d78c2018-01-05 15:24:01 -08004#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05005use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07006use proc_macro2::Span;
7#[cfg(any(feature = "full", feature = "derive"))]
8use token::{Brace, Bracket, Group, Paren};
9use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040010#[cfg(feature = "full")]
11macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070012 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070013 $e
14 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040015}
David Tolnay0a0d78c2018-01-05 15:24:01 -080016#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040017macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070018 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070019 unreachable!()
20 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040021}
David Tolnay6af48992018-08-01 11:16:28 -070022#[doc = r" Syntax tree traversal to transform the nodes of an owned syntax tree."]
23#[doc = r""]
24#[doc = r" See the [module documentation] for details."]
25#[doc = r""]
26#[doc = r" [module documentation]: index.html"]
27#[doc = r""]
28#[doc = r#" *This trait is available if Syn is built with the `"fold"` feature.*"#]
David Tolnay4b4c4b62018-01-06 13:48:05 -080029pub trait Fold {
David Tolnay8c81f622018-07-31 23:34:35 -070030 #[cfg(any(feature = "full", feature = "derive"))]
31 fn fold_abi(&mut self, i: Abi) -> Abi {
32 fold_abi(self, i)
33 }
34 #[cfg(any(feature = "full", feature = "derive"))]
35 fn fold_angle_bracketed_generic_arguments(
36 &mut self,
37 i: AngleBracketedGenericArguments,
38 ) -> AngleBracketedGenericArguments {
39 fold_angle_bracketed_generic_arguments(self, i)
40 }
41 #[cfg(feature = "full")]
42 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
43 fold_arg_captured(self, i)
44 }
45 #[cfg(feature = "full")]
46 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
47 fold_arg_self(self, i)
48 }
49 #[cfg(feature = "full")]
50 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
51 fold_arg_self_ref(self, i)
52 }
53 #[cfg(any(feature = "full", feature = "derive"))]
54 #[cfg(feature = "full")]
55 fn fold_arm(&mut self, i: Arm) -> Arm {
56 fold_arm(self, i)
57 }
58 #[cfg(any(feature = "full", feature = "derive"))]
59 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
60 fold_attr_style(self, i)
61 }
62 #[cfg(any(feature = "full", feature = "derive"))]
63 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
64 fold_attribute(self, i)
65 }
66 #[cfg(any(feature = "full", feature = "derive"))]
67 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
68 fold_bare_fn_arg(self, i)
69 }
70 #[cfg(any(feature = "full", feature = "derive"))]
71 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
72 fold_bare_fn_arg_name(self, i)
73 }
74 #[cfg(any(feature = "full", feature = "derive"))]
75 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
76 fold_bin_op(self, i)
77 }
78 #[cfg(any(feature = "full", feature = "derive"))]
79 fn fold_binding(&mut self, i: Binding) -> Binding {
80 fold_binding(self, i)
81 }
82 #[cfg(any(feature = "full", feature = "derive"))]
83 #[cfg(feature = "full")]
84 fn fold_block(&mut self, i: Block) -> Block {
85 fold_block(self, i)
86 }
87 #[cfg(any(feature = "full", feature = "derive"))]
88 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
89 fold_bound_lifetimes(self, i)
90 }
91 #[cfg(any(feature = "full", feature = "derive"))]
92 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
93 fold_const_param(self, i)
94 }
David Tolnay9d0882a2018-09-01 19:49:14 -070095 #[cfg(any(feature = "full", feature = "derive"))]
96 fn fold_constraint(&mut self, i: Constraint) -> Constraint {
97 fold_constraint(self, i)
98 }
David Tolnay8c81f622018-07-31 23:34:35 -070099 #[cfg(feature = "derive")]
100 fn fold_data(&mut self, i: Data) -> Data {
101 fold_data(self, i)
102 }
103 #[cfg(feature = "derive")]
104 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
105 fold_data_enum(self, i)
106 }
107 #[cfg(feature = "derive")]
108 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
109 fold_data_struct(self, i)
110 }
111 #[cfg(feature = "derive")]
112 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
113 fold_data_union(self, i)
114 }
115 #[cfg(feature = "derive")]
116 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
117 fold_derive_input(self, i)
118 }
119 #[cfg(any(feature = "full", feature = "derive"))]
120 fn fold_expr(&mut self, i: Expr) -> Expr {
121 fold_expr(self, i)
122 }
123 #[cfg(feature = "full")]
124 #[cfg(any(feature = "full", feature = "derive"))]
125 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
126 fold_expr_array(self, i)
127 }
128 #[cfg(feature = "full")]
129 #[cfg(any(feature = "full", feature = "derive"))]
130 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
131 fold_expr_assign(self, i)
132 }
133 #[cfg(feature = "full")]
134 #[cfg(any(feature = "full", feature = "derive"))]
135 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
136 fold_expr_assign_op(self, i)
137 }
David Tolnay02a9c6f2018-08-24 18:58:45 -0400138 #[cfg(feature = "full")]
139 #[cfg(any(feature = "full", feature = "derive"))]
140 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
141 fold_expr_async(self, i)
142 }
David Tolnay8c81f622018-07-31 23:34:35 -0700143 #[cfg(any(feature = "full", feature = "derive"))]
144 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
145 fold_expr_binary(self, i)
146 }
147 #[cfg(feature = "full")]
148 #[cfg(any(feature = "full", feature = "derive"))]
149 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
150 fold_expr_block(self, i)
151 }
152 #[cfg(feature = "full")]
153 #[cfg(any(feature = "full", feature = "derive"))]
154 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
155 fold_expr_box(self, i)
156 }
157 #[cfg(feature = "full")]
158 #[cfg(any(feature = "full", feature = "derive"))]
159 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
160 fold_expr_break(self, i)
161 }
162 #[cfg(any(feature = "full", feature = "derive"))]
163 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
164 fold_expr_call(self, i)
165 }
166 #[cfg(any(feature = "full", feature = "derive"))]
167 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
168 fold_expr_cast(self, i)
169 }
170 #[cfg(feature = "full")]
171 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700172 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
173 fold_expr_closure(self, i)
174 }
175 #[cfg(feature = "full")]
176 #[cfg(any(feature = "full", feature = "derive"))]
177 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
178 fold_expr_continue(self, i)
179 }
180 #[cfg(any(feature = "full", feature = "derive"))]
181 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
182 fold_expr_field(self, i)
183 }
184 #[cfg(feature = "full")]
185 #[cfg(any(feature = "full", feature = "derive"))]
186 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
187 fold_expr_for_loop(self, i)
188 }
189 #[cfg(feature = "full")]
190 #[cfg(any(feature = "full", feature = "derive"))]
191 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
192 fold_expr_group(self, i)
193 }
194 #[cfg(feature = "full")]
195 #[cfg(any(feature = "full", feature = "derive"))]
196 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
197 fold_expr_if(self, i)
198 }
199 #[cfg(feature = "full")]
200 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700201 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
202 fold_expr_in_place(self, i)
203 }
204 #[cfg(any(feature = "full", feature = "derive"))]
205 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
206 fold_expr_index(self, i)
207 }
David Tolnay9c119122018-09-01 18:47:02 -0700208 #[cfg(feature = "full")]
209 #[cfg(any(feature = "full", feature = "derive"))]
210 fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet {
211 fold_expr_let(self, i)
212 }
David Tolnay8c81f622018-07-31 23:34:35 -0700213 #[cfg(any(feature = "full", feature = "derive"))]
214 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
215 fold_expr_lit(self, i)
216 }
217 #[cfg(feature = "full")]
218 #[cfg(any(feature = "full", feature = "derive"))]
219 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
220 fold_expr_loop(self, i)
221 }
222 #[cfg(feature = "full")]
223 #[cfg(any(feature = "full", feature = "derive"))]
224 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
225 fold_expr_macro(self, i)
226 }
227 #[cfg(feature = "full")]
228 #[cfg(any(feature = "full", feature = "derive"))]
229 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
230 fold_expr_match(self, i)
231 }
232 #[cfg(feature = "full")]
233 #[cfg(any(feature = "full", feature = "derive"))]
234 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
235 fold_expr_method_call(self, i)
236 }
237 #[cfg(any(feature = "full", feature = "derive"))]
238 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
239 fold_expr_paren(self, i)
240 }
241 #[cfg(any(feature = "full", feature = "derive"))]
242 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
243 fold_expr_path(self, i)
244 }
245 #[cfg(feature = "full")]
246 #[cfg(any(feature = "full", feature = "derive"))]
247 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
248 fold_expr_range(self, i)
249 }
250 #[cfg(feature = "full")]
251 #[cfg(any(feature = "full", feature = "derive"))]
252 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
253 fold_expr_reference(self, i)
254 }
255 #[cfg(feature = "full")]
256 #[cfg(any(feature = "full", feature = "derive"))]
257 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
258 fold_expr_repeat(self, i)
259 }
260 #[cfg(feature = "full")]
261 #[cfg(any(feature = "full", feature = "derive"))]
262 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
263 fold_expr_return(self, i)
264 }
265 #[cfg(feature = "full")]
266 #[cfg(any(feature = "full", feature = "derive"))]
267 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
268 fold_expr_struct(self, i)
269 }
270 #[cfg(feature = "full")]
271 #[cfg(any(feature = "full", feature = "derive"))]
272 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
273 fold_expr_try(self, i)
274 }
275 #[cfg(feature = "full")]
276 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -0400277 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
278 fold_expr_try_block(self, i)
279 }
280 #[cfg(feature = "full")]
281 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700282 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
283 fold_expr_tuple(self, i)
284 }
285 #[cfg(feature = "full")]
286 #[cfg(any(feature = "full", feature = "derive"))]
287 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
288 fold_expr_type(self, i)
289 }
290 #[cfg(any(feature = "full", feature = "derive"))]
291 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
292 fold_expr_unary(self, i)
293 }
294 #[cfg(feature = "full")]
295 #[cfg(any(feature = "full", feature = "derive"))]
296 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
297 fold_expr_unsafe(self, i)
298 }
299 #[cfg(any(feature = "full", feature = "derive"))]
300 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
301 fold_expr_verbatim(self, i)
302 }
303 #[cfg(feature = "full")]
304 #[cfg(any(feature = "full", feature = "derive"))]
305 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
306 fold_expr_while(self, i)
307 }
308 #[cfg(feature = "full")]
309 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700310 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
311 fold_expr_yield(self, i)
312 }
313 #[cfg(any(feature = "full", feature = "derive"))]
314 fn fold_field(&mut self, i: Field) -> Field {
315 fold_field(self, i)
316 }
317 #[cfg(any(feature = "full", feature = "derive"))]
318 #[cfg(feature = "full")]
319 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
320 fold_field_pat(self, i)
321 }
322 #[cfg(any(feature = "full", feature = "derive"))]
323 #[cfg(feature = "full")]
324 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
325 fold_field_value(self, i)
326 }
327 #[cfg(any(feature = "full", feature = "derive"))]
328 fn fold_fields(&mut self, i: Fields) -> Fields {
329 fold_fields(self, i)
330 }
331 #[cfg(any(feature = "full", feature = "derive"))]
332 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
333 fold_fields_named(self, i)
334 }
335 #[cfg(any(feature = "full", feature = "derive"))]
336 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
337 fold_fields_unnamed(self, i)
338 }
339 #[cfg(feature = "full")]
340 fn fold_file(&mut self, i: File) -> File {
341 fold_file(self, i)
342 }
343 #[cfg(feature = "full")]
344 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
345 fold_fn_arg(self, i)
346 }
347 #[cfg(feature = "full")]
348 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
349 fold_fn_decl(self, i)
350 }
351 #[cfg(feature = "full")]
352 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
353 fold_foreign_item(self, i)
354 }
355 #[cfg(feature = "full")]
356 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
357 fold_foreign_item_fn(self, i)
358 }
359 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400360 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
361 fold_foreign_item_macro(self, i)
362 }
363 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700364 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
365 fold_foreign_item_static(self, i)
366 }
367 #[cfg(feature = "full")]
368 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
369 fold_foreign_item_type(self, i)
370 }
371 #[cfg(feature = "full")]
372 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
373 fold_foreign_item_verbatim(self, i)
374 }
375 #[cfg(any(feature = "full", feature = "derive"))]
376 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
377 fold_generic_argument(self, i)
378 }
379 #[cfg(any(feature = "full", feature = "derive"))]
380 #[cfg(feature = "full")]
381 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
382 fold_generic_method_argument(self, i)
383 }
384 #[cfg(any(feature = "full", feature = "derive"))]
385 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
386 fold_generic_param(self, i)
387 }
388 #[cfg(any(feature = "full", feature = "derive"))]
389 fn fold_generics(&mut self, i: Generics) -> Generics {
390 fold_generics(self, i)
391 }
David Tolnay8c81f622018-07-31 23:34:35 -0700392 fn fold_ident(&mut self, i: Ident) -> Ident {
393 fold_ident(self, i)
394 }
395 #[cfg(feature = "full")]
396 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
397 fold_impl_item(self, i)
398 }
399 #[cfg(feature = "full")]
400 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
401 fold_impl_item_const(self, i)
402 }
403 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400404 fn fold_impl_item_existential(&mut self, i: ImplItemExistential) -> ImplItemExistential {
405 fold_impl_item_existential(self, i)
406 }
407 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700408 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
409 fold_impl_item_macro(self, i)
410 }
411 #[cfg(feature = "full")]
412 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
413 fold_impl_item_method(self, i)
414 }
415 #[cfg(feature = "full")]
416 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
417 fold_impl_item_type(self, i)
418 }
419 #[cfg(feature = "full")]
420 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
421 fold_impl_item_verbatim(self, i)
422 }
423 #[cfg(any(feature = "full", feature = "derive"))]
424 fn fold_index(&mut self, i: Index) -> Index {
425 fold_index(self, i)
426 }
427 #[cfg(feature = "full")]
428 fn fold_item(&mut self, i: Item) -> Item {
429 fold_item(self, i)
430 }
431 #[cfg(feature = "full")]
432 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
433 fold_item_const(self, i)
434 }
435 #[cfg(feature = "full")]
436 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
437 fold_item_enum(self, i)
438 }
439 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400440 fn fold_item_existential(&mut self, i: ItemExistential) -> ItemExistential {
441 fold_item_existential(self, i)
442 }
443 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700444 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
445 fold_item_extern_crate(self, i)
446 }
447 #[cfg(feature = "full")]
448 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
449 fold_item_fn(self, i)
450 }
451 #[cfg(feature = "full")]
452 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
453 fold_item_foreign_mod(self, i)
454 }
455 #[cfg(feature = "full")]
456 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
457 fold_item_impl(self, i)
458 }
459 #[cfg(feature = "full")]
460 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
461 fold_item_macro(self, i)
462 }
463 #[cfg(feature = "full")]
464 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
465 fold_item_macro2(self, i)
466 }
467 #[cfg(feature = "full")]
468 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
469 fold_item_mod(self, i)
470 }
471 #[cfg(feature = "full")]
472 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
473 fold_item_static(self, i)
474 }
475 #[cfg(feature = "full")]
476 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
477 fold_item_struct(self, i)
478 }
479 #[cfg(feature = "full")]
480 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
481 fold_item_trait(self, i)
482 }
483 #[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -0700484 fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias {
485 fold_item_trait_alias(self, i)
486 }
487 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700488 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
489 fold_item_type(self, i)
490 }
491 #[cfg(feature = "full")]
492 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
493 fold_item_union(self, i)
494 }
495 #[cfg(feature = "full")]
496 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
497 fold_item_use(self, i)
498 }
499 #[cfg(feature = "full")]
500 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
501 fold_item_verbatim(self, i)
502 }
503 #[cfg(any(feature = "full", feature = "derive"))]
504 #[cfg(feature = "full")]
505 fn fold_label(&mut self, i: Label) -> Label {
506 fold_label(self, i)
507 }
David Tolnay8c81f622018-07-31 23:34:35 -0700508 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
509 fold_lifetime(self, i)
510 }
511 #[cfg(any(feature = "full", feature = "derive"))]
512 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
513 fold_lifetime_def(self, i)
514 }
515 #[cfg(any(feature = "full", feature = "derive"))]
516 fn fold_lit(&mut self, i: Lit) -> Lit {
517 fold_lit(self, i)
518 }
519 #[cfg(any(feature = "full", feature = "derive"))]
520 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
521 fold_lit_bool(self, i)
522 }
523 #[cfg(any(feature = "full", feature = "derive"))]
524 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
525 fold_lit_byte(self, i)
526 }
527 #[cfg(any(feature = "full", feature = "derive"))]
528 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
529 fold_lit_byte_str(self, i)
530 }
531 #[cfg(any(feature = "full", feature = "derive"))]
532 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
533 fold_lit_char(self, i)
534 }
535 #[cfg(any(feature = "full", feature = "derive"))]
536 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
537 fold_lit_float(self, i)
538 }
539 #[cfg(any(feature = "full", feature = "derive"))]
540 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
541 fold_lit_int(self, i)
542 }
543 #[cfg(any(feature = "full", feature = "derive"))]
544 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
545 fold_lit_str(self, i)
546 }
547 #[cfg(any(feature = "full", feature = "derive"))]
548 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
549 fold_lit_verbatim(self, i)
550 }
551 #[cfg(any(feature = "full", feature = "derive"))]
552 #[cfg(feature = "full")]
553 fn fold_local(&mut self, i: Local) -> Local {
554 fold_local(self, i)
555 }
556 #[cfg(any(feature = "full", feature = "derive"))]
557 fn fold_macro(&mut self, i: Macro) -> Macro {
558 fold_macro(self, i)
559 }
560 #[cfg(any(feature = "full", feature = "derive"))]
561 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
562 fold_macro_delimiter(self, i)
563 }
564 #[cfg(any(feature = "full", feature = "derive"))]
565 fn fold_member(&mut self, i: Member) -> Member {
566 fold_member(self, i)
567 }
568 #[cfg(any(feature = "full", feature = "derive"))]
569 fn fold_meta(&mut self, i: Meta) -> Meta {
570 fold_meta(self, i)
571 }
572 #[cfg(any(feature = "full", feature = "derive"))]
573 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
574 fold_meta_list(self, i)
575 }
576 #[cfg(any(feature = "full", feature = "derive"))]
577 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
578 fold_meta_name_value(self, i)
579 }
580 #[cfg(feature = "full")]
581 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
582 fold_method_sig(self, i)
583 }
584 #[cfg(any(feature = "full", feature = "derive"))]
585 #[cfg(feature = "full")]
586 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
587 fold_method_turbofish(self, i)
588 }
589 #[cfg(any(feature = "full", feature = "derive"))]
590 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
591 fold_nested_meta(self, i)
592 }
593 #[cfg(any(feature = "full", feature = "derive"))]
594 fn fold_parenthesized_generic_arguments(
595 &mut self,
596 i: ParenthesizedGenericArguments,
597 ) -> ParenthesizedGenericArguments {
598 fold_parenthesized_generic_arguments(self, i)
599 }
600 #[cfg(any(feature = "full", feature = "derive"))]
601 #[cfg(feature = "full")]
602 fn fold_pat(&mut self, i: Pat) -> Pat {
603 fold_pat(self, i)
604 }
605 #[cfg(any(feature = "full", feature = "derive"))]
606 #[cfg(feature = "full")]
607 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
608 fold_pat_box(self, i)
609 }
610 #[cfg(any(feature = "full", feature = "derive"))]
611 #[cfg(feature = "full")]
612 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
613 fold_pat_ident(self, i)
614 }
615 #[cfg(any(feature = "full", feature = "derive"))]
616 #[cfg(feature = "full")]
617 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
618 fold_pat_lit(self, i)
619 }
620 #[cfg(any(feature = "full", feature = "derive"))]
621 #[cfg(feature = "full")]
622 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
623 fold_pat_macro(self, i)
624 }
625 #[cfg(any(feature = "full", feature = "derive"))]
626 #[cfg(feature = "full")]
627 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
628 fold_pat_path(self, i)
629 }
630 #[cfg(any(feature = "full", feature = "derive"))]
631 #[cfg(feature = "full")]
632 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
633 fold_pat_range(self, i)
634 }
635 #[cfg(any(feature = "full", feature = "derive"))]
636 #[cfg(feature = "full")]
637 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
638 fold_pat_ref(self, i)
639 }
640 #[cfg(any(feature = "full", feature = "derive"))]
641 #[cfg(feature = "full")]
642 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
643 fold_pat_slice(self, i)
644 }
645 #[cfg(any(feature = "full", feature = "derive"))]
646 #[cfg(feature = "full")]
647 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
648 fold_pat_struct(self, i)
649 }
650 #[cfg(any(feature = "full", feature = "derive"))]
651 #[cfg(feature = "full")]
652 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
653 fold_pat_tuple(self, i)
654 }
655 #[cfg(any(feature = "full", feature = "derive"))]
656 #[cfg(feature = "full")]
657 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
658 fold_pat_tuple_struct(self, i)
659 }
660 #[cfg(any(feature = "full", feature = "derive"))]
661 #[cfg(feature = "full")]
662 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
663 fold_pat_verbatim(self, i)
664 }
665 #[cfg(any(feature = "full", feature = "derive"))]
666 #[cfg(feature = "full")]
667 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
668 fold_pat_wild(self, i)
669 }
670 #[cfg(any(feature = "full", feature = "derive"))]
671 fn fold_path(&mut self, i: Path) -> Path {
672 fold_path(self, i)
673 }
674 #[cfg(any(feature = "full", feature = "derive"))]
675 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
676 fold_path_arguments(self, i)
677 }
678 #[cfg(any(feature = "full", feature = "derive"))]
679 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
680 fold_path_segment(self, i)
681 }
682 #[cfg(any(feature = "full", feature = "derive"))]
683 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
684 fold_predicate_eq(self, i)
685 }
686 #[cfg(any(feature = "full", feature = "derive"))]
687 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
688 fold_predicate_lifetime(self, i)
689 }
690 #[cfg(any(feature = "full", feature = "derive"))]
691 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
692 fold_predicate_type(self, i)
693 }
694 #[cfg(any(feature = "full", feature = "derive"))]
695 fn fold_qself(&mut self, i: QSelf) -> QSelf {
696 fold_qself(self, i)
697 }
698 #[cfg(any(feature = "full", feature = "derive"))]
699 #[cfg(feature = "full")]
700 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
701 fold_range_limits(self, i)
702 }
703 #[cfg(any(feature = "full", feature = "derive"))]
704 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
705 fold_return_type(self, i)
706 }
David Tolnay8c81f622018-07-31 23:34:35 -0700707 fn fold_span(&mut self, i: Span) -> Span {
708 fold_span(self, i)
709 }
710 #[cfg(any(feature = "full", feature = "derive"))]
711 #[cfg(feature = "full")]
712 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
713 fold_stmt(self, i)
714 }
715 #[cfg(any(feature = "full", feature = "derive"))]
716 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
717 fold_trait_bound(self, i)
718 }
719 #[cfg(any(feature = "full", feature = "derive"))]
720 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
721 fold_trait_bound_modifier(self, i)
722 }
723 #[cfg(feature = "full")]
724 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
725 fold_trait_item(self, i)
726 }
727 #[cfg(feature = "full")]
728 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
729 fold_trait_item_const(self, i)
730 }
731 #[cfg(feature = "full")]
732 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
733 fold_trait_item_macro(self, i)
734 }
735 #[cfg(feature = "full")]
736 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
737 fold_trait_item_method(self, i)
738 }
739 #[cfg(feature = "full")]
740 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
741 fold_trait_item_type(self, i)
742 }
743 #[cfg(feature = "full")]
744 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
745 fold_trait_item_verbatim(self, i)
746 }
747 #[cfg(any(feature = "full", feature = "derive"))]
748 fn fold_type(&mut self, i: Type) -> Type {
749 fold_type(self, i)
750 }
751 #[cfg(any(feature = "full", feature = "derive"))]
752 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
753 fold_type_array(self, i)
754 }
755 #[cfg(any(feature = "full", feature = "derive"))]
756 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
757 fold_type_bare_fn(self, i)
758 }
759 #[cfg(any(feature = "full", feature = "derive"))]
760 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
761 fold_type_group(self, i)
762 }
763 #[cfg(any(feature = "full", feature = "derive"))]
764 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
765 fold_type_impl_trait(self, i)
766 }
767 #[cfg(any(feature = "full", feature = "derive"))]
768 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
769 fold_type_infer(self, i)
770 }
771 #[cfg(any(feature = "full", feature = "derive"))]
772 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
773 fold_type_macro(self, i)
774 }
775 #[cfg(any(feature = "full", feature = "derive"))]
776 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
777 fold_type_never(self, i)
778 }
779 #[cfg(any(feature = "full", feature = "derive"))]
780 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
781 fold_type_param(self, i)
782 }
783 #[cfg(any(feature = "full", feature = "derive"))]
784 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
785 fold_type_param_bound(self, i)
786 }
787 #[cfg(any(feature = "full", feature = "derive"))]
788 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
789 fold_type_paren(self, i)
790 }
791 #[cfg(any(feature = "full", feature = "derive"))]
792 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
793 fold_type_path(self, i)
794 }
795 #[cfg(any(feature = "full", feature = "derive"))]
796 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
797 fold_type_ptr(self, i)
798 }
799 #[cfg(any(feature = "full", feature = "derive"))]
800 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
801 fold_type_reference(self, i)
802 }
803 #[cfg(any(feature = "full", feature = "derive"))]
804 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
805 fold_type_slice(self, i)
806 }
807 #[cfg(any(feature = "full", feature = "derive"))]
808 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
809 fold_type_trait_object(self, i)
810 }
811 #[cfg(any(feature = "full", feature = "derive"))]
812 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
813 fold_type_tuple(self, i)
814 }
815 #[cfg(any(feature = "full", feature = "derive"))]
816 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
817 fold_type_verbatim(self, i)
818 }
819 #[cfg(any(feature = "full", feature = "derive"))]
820 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
821 fold_un_op(self, i)
822 }
823 #[cfg(feature = "full")]
824 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
825 fold_use_glob(self, i)
826 }
827 #[cfg(feature = "full")]
828 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
829 fold_use_group(self, i)
830 }
831 #[cfg(feature = "full")]
832 fn fold_use_name(&mut self, i: UseName) -> UseName {
833 fold_use_name(self, i)
834 }
835 #[cfg(feature = "full")]
836 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
837 fold_use_path(self, i)
838 }
839 #[cfg(feature = "full")]
840 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
841 fold_use_rename(self, i)
842 }
843 #[cfg(feature = "full")]
844 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
845 fold_use_tree(self, i)
846 }
847 #[cfg(any(feature = "full", feature = "derive"))]
848 fn fold_variant(&mut self, i: Variant) -> Variant {
849 fold_variant(self, i)
850 }
851 #[cfg(any(feature = "full", feature = "derive"))]
852 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
853 fold_vis_crate(self, i)
854 }
855 #[cfg(any(feature = "full", feature = "derive"))]
856 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
857 fold_vis_public(self, i)
858 }
859 #[cfg(any(feature = "full", feature = "derive"))]
860 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
861 fold_vis_restricted(self, i)
862 }
863 #[cfg(any(feature = "full", feature = "derive"))]
864 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
865 fold_visibility(self, i)
866 }
867 #[cfg(any(feature = "full", feature = "derive"))]
868 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
869 fold_where_clause(self, i)
870 }
871 #[cfg(any(feature = "full", feature = "derive"))]
872 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
873 fold_where_predicate(self, i)
874 }
Nika Layzell27726662017-10-24 23:16:35 -0400875}
David Tolnayd3f32142018-05-20 20:21:12 -0700876#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800877macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700878 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800879 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700880 let span = _visitor.fold_span(_i.span());
881 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800882 _i
883 }
David Tolnay8c81f622018-07-31 23:34:35 -0700884 };
David Tolnayd0adf522017-12-29 01:30:07 -0500885}
David Tolnay360efd22018-01-04 23:35:26 -0800886#[cfg(any(feature = "full", feature = "derive"))]
887fold_span_only!(fold_lit_byte: LitByte);
888#[cfg(any(feature = "full", feature = "derive"))]
889fold_span_only!(fold_lit_byte_str: LitByteStr);
890#[cfg(any(feature = "full", feature = "derive"))]
891fold_span_only!(fold_lit_char: LitChar);
892#[cfg(any(feature = "full", feature = "derive"))]
893fold_span_only!(fold_lit_float: LitFloat);
894#[cfg(any(feature = "full", feature = "derive"))]
895fold_span_only!(fold_lit_int: LitInt);
896#[cfg(any(feature = "full", feature = "derive"))]
897fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700898#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800899pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400900 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400901 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700902 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400903 }
904}
David Tolnay8c81f622018-07-31 23:34:35 -0700905#[cfg(any(feature = "full", feature = "derive"))]
906pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
907 _visitor: &mut V,
908 _i: AngleBracketedGenericArguments,
909) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500910 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400911 colon2_token: (_i.colon2_token)
912 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
913 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700914 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400915 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400916 }
917}
David Tolnay8c81f622018-07-31 23:34:35 -0700918#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800919pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400920 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700921 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400922 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700923 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400924 }
925}
David Tolnay8c81f622018-07-31 23:34:35 -0700926#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800927pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400928 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400929 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
930 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400931 }
932}
David Tolnay8c81f622018-07-31 23:34:35 -0700933#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800934pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400935 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400936 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700937 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400938 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
939 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400940 }
941}
David Tolnay8c81f622018-07-31 23:34:35 -0700942#[cfg(any(feature = "full", feature = "derive"))]
943#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800944pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400945 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700946 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400947 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700948 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
949 guard: (_i.guard).map(|it| {
950 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400951 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700952 Box::new(_visitor.fold_expr(*(it).1)),
953 )
954 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400955 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700956 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400957 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400958 }
959}
David Tolnay8c81f622018-07-31 23:34:35 -0700960#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800961pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400962 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700963 AttrStyle::Outer => AttrStyle::Outer,
964 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400965 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400966 }
967 }
968}
David Tolnay8c81f622018-07-31 23:34:35 -0700969#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800970pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400971 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400972 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700973 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400974 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700975 path: _visitor.fold_path(_i.path),
976 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400977 }
978}
David Tolnay8c81f622018-07-31 23:34:35 -0700979#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800980pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400981 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700982 name: (_i.name).map(|it| {
983 (
984 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400985 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700986 )
987 }),
988 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400989 }
990}
David Tolnay8c81f622018-07-31 23:34:35 -0700991#[cfg(any(feature = "full", feature = "derive"))]
992pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
993 _visitor: &mut V,
994 _i: BareFnArgName,
995) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400996 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700997 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
998 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400999 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001000 }
1001 }
1002}
David Tolnay8c81f622018-07-31 23:34:35 -07001003#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001004pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -04001005 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001006 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001007 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001008 }
David Tolnay8c81f622018-07-31 23:34:35 -07001009 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001010 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001011 }
David Tolnay8c81f622018-07-31 23:34:35 -07001012 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001013 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001014 }
David Tolnay8c81f622018-07-31 23:34:35 -07001015 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001016 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001017 }
David Tolnay8c81f622018-07-31 23:34:35 -07001018 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001019 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001020 }
David Tolnay8c81f622018-07-31 23:34:35 -07001021 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001022 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001023 }
David Tolnay8c81f622018-07-31 23:34:35 -07001024 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001025 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001026 }
David Tolnay8c81f622018-07-31 23:34:35 -07001027 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001028 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001029 }
David Tolnay8c81f622018-07-31 23:34:35 -07001030 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001031 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001032 }
David Tolnay8c81f622018-07-31 23:34:35 -07001033 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001034 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001035 }
David Tolnay8c81f622018-07-31 23:34:35 -07001036 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001037 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001038 }
David Tolnay8c81f622018-07-31 23:34:35 -07001039 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001040 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001041 }
David Tolnay8c81f622018-07-31 23:34:35 -07001042 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001043 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001044 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001045 BinOp::Lt(_binding_0) => {
1046 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1047 }
David Tolnay8c81f622018-07-31 23:34:35 -07001048 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001049 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001050 }
David Tolnay8c81f622018-07-31 23:34:35 -07001051 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001052 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001053 }
David Tolnay8c81f622018-07-31 23:34:35 -07001054 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001055 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001056 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001057 BinOp::Gt(_binding_0) => {
1058 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1059 }
David Tolnay8c81f622018-07-31 23:34:35 -07001060 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001061 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001062 }
David Tolnay8c81f622018-07-31 23:34:35 -07001063 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001064 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001065 }
David Tolnay8c81f622018-07-31 23:34:35 -07001066 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001067 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001068 }
David Tolnay8c81f622018-07-31 23:34:35 -07001069 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001070 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001071 }
David Tolnay8c81f622018-07-31 23:34:35 -07001072 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001073 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001074 }
David Tolnay8c81f622018-07-31 23:34:35 -07001075 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001076 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001077 }
David Tolnay8c81f622018-07-31 23:34:35 -07001078 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001079 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001080 }
David Tolnay8c81f622018-07-31 23:34:35 -07001081 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001082 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001083 }
David Tolnay8c81f622018-07-31 23:34:35 -07001084 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001085 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001086 }
David Tolnay8c81f622018-07-31 23:34:35 -07001087 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001088 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001089 }
1090 }
1091}
David Tolnay8c81f622018-07-31 23:34:35 -07001092#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001093pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001094 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001095 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001096 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001097 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001098 }
1099}
David Tolnay8c81f622018-07-31 23:34:35 -07001100#[cfg(any(feature = "full", feature = "derive"))]
1101#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001102pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001103 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001104 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001105 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001106 }
1107}
David Tolnay8c81f622018-07-31 23:34:35 -07001108#[cfg(any(feature = "full", feature = "derive"))]
1109pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1110 _visitor: &mut V,
1111 _i: BoundLifetimes,
1112) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001113 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001114 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1115 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001116 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001117 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001118 }
1119}
David Tolnay8c81f622018-07-31 23:34:35 -07001120#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001121pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001122 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001123 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001124 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001125 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001126 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001127 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001128 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001129 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001130 }
1131}
David Tolnay9d0882a2018-09-01 19:49:14 -07001132#[cfg(any(feature = "full", feature = "derive"))]
1133pub fn fold_constraint<V: Fold + ?Sized>(_visitor: &mut V, _i: Constraint) -> Constraint {
1134 Constraint {
1135 ident: _visitor.fold_ident(_i.ident),
1136 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
1137 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1138 }
1139}
David Tolnay8c81f622018-07-31 23:34:35 -07001140#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001141pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001142 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001143 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1144 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1145 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001146 }
1147}
David Tolnay8c81f622018-07-31 23:34:35 -07001148#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001149pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001150 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001151 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1152 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001153 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001154 }
1155}
David Tolnay8c81f622018-07-31 23:34:35 -07001156#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001157pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001158 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001159 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001160 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001161 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001162 }
1163}
David Tolnay8c81f622018-07-31 23:34:35 -07001164#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001165pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001166 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001167 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001168 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001169 }
1170}
David Tolnay8c81f622018-07-31 23:34:35 -07001171#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001172pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001173 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001174 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1175 vis: _visitor.fold_visibility(_i.vis),
1176 ident: _visitor.fold_ident(_i.ident),
1177 generics: _visitor.fold_generics(_i.generics),
1178 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001179 }
1180}
David Tolnay8c81f622018-07-31 23:34:35 -07001181#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001182pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001183 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001184 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1185 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1186 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1187 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1188 Expr::MethodCall(_binding_0) => {
1189 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001190 }
David Tolnay8c81f622018-07-31 23:34:35 -07001191 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1192 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1193 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1194 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1195 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1196 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
David Tolnay9c119122018-09-01 18:47:02 -07001197 Expr::Let(_binding_0) => Expr::Let(full!(_visitor.fold_expr_let(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001198 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001199 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001200 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1201 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1202 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1203 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1204 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1205 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1206 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1207 Expr::AssignOp(_binding_0) => {
1208 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001209 }
David Tolnay8c81f622018-07-31 23:34:35 -07001210 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1211 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1212 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1213 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1214 Expr::Reference(_binding_0) => {
1215 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001216 }
David Tolnay8c81f622018-07-31 23:34:35 -07001217 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1218 Expr::Continue(_binding_0) => {
1219 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001220 }
David Tolnay8c81f622018-07-31 23:34:35 -07001221 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1222 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1223 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1224 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1225 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1226 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1227 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001228 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001229 Expr::TryBlock(_binding_0) => {
1230 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1231 }
David Tolnay8c81f622018-07-31 23:34:35 -07001232 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1233 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001234 }
1235}
David Tolnay8c81f622018-07-31 23:34:35 -07001236#[cfg(feature = "full")]
1237#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001238pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001239 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001240 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001241 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001242 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001243 }
1244}
David Tolnay8c81f622018-07-31 23:34:35 -07001245#[cfg(feature = "full")]
1246#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001247pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001248 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001249 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1250 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001251 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001252 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001253 }
1254}
David Tolnay8c81f622018-07-31 23:34:35 -07001255#[cfg(feature = "full")]
1256#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001257pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001258 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001259 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1260 left: Box::new(_visitor.fold_expr(*_i.left)),
1261 op: _visitor.fold_bin_op(_i.op),
1262 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001263 }
1264}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001265#[cfg(feature = "full")]
1266#[cfg(any(feature = "full", feature = "derive"))]
1267pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1268 ExprAsync {
1269 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1270 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
1271 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1272 block: _visitor.fold_block(_i.block),
1273 }
1274}
David Tolnay8c81f622018-07-31 23:34:35 -07001275#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001276pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001277 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001278 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1279 left: Box::new(_visitor.fold_expr(*_i.left)),
1280 op: _visitor.fold_bin_op(_i.op),
1281 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001282 }
1283}
David Tolnay8c81f622018-07-31 23:34:35 -07001284#[cfg(feature = "full")]
1285#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001286pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001287 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001288 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001289 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001290 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001291 }
1292}
David Tolnay8c81f622018-07-31 23:34:35 -07001293#[cfg(feature = "full")]
1294#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001295pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001296 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001297 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001298 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001299 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001300 }
1301}
David Tolnay8c81f622018-07-31 23:34:35 -07001302#[cfg(feature = "full")]
1303#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001304pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001305 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001306 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001307 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001308 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1309 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001310 }
1311}
David Tolnay8c81f622018-07-31 23:34:35 -07001312#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001313pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001314 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001315 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1316 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001317 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001318 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001319 }
1320}
David Tolnay8c81f622018-07-31 23:34:35 -07001321#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001322pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001323 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001324 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1325 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001326 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001327 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001328 }
1329}
David Tolnay8c81f622018-07-31 23:34:35 -07001330#[cfg(feature = "full")]
1331#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001332pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001333 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001334 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001335 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001336 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1337 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1338 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001339 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001340 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001341 output: _visitor.fold_return_type(_i.output),
1342 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001343 }
1344}
David Tolnay8c81f622018-07-31 23:34:35 -07001345#[cfg(feature = "full")]
1346#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001347pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001348 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001349 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001350 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001351 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001352 }
1353}
David Tolnay8c81f622018-07-31 23:34:35 -07001354#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001355pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001356 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001357 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1358 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001359 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001360 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001361 }
1362}
David Tolnay8c81f622018-07-31 23:34:35 -07001363#[cfg(feature = "full")]
1364#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001365pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001366 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001367 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1368 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001369 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001370 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001371 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001372 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1373 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001374 }
1375}
David Tolnay8c81f622018-07-31 23:34:35 -07001376#[cfg(feature = "full")]
1377#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001378pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001379 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001380 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001381 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001382 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001383 }
1384}
David Tolnay8c81f622018-07-31 23:34:35 -07001385#[cfg(feature = "full")]
1386#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001387pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001388 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001389 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001390 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001391 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1392 then_branch: _visitor.fold_block(_i.then_branch),
1393 else_branch: (_i.else_branch).map(|it| {
1394 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001395 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001396 Box::new(_visitor.fold_expr(*(it).1)),
1397 )
1398 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001399 }
1400}
David Tolnay8c81f622018-07-31 23:34:35 -07001401#[cfg(feature = "full")]
1402#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001403pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001404 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001405 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1406 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001407 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001408 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001409 }
1410}
David Tolnay8c81f622018-07-31 23:34:35 -07001411#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001412pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001413 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001414 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1415 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001416 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001417 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001418 }
1419}
David Tolnay9c119122018-09-01 18:47:02 -07001420#[cfg(feature = "full")]
1421#[cfg(any(feature = "full", feature = "derive"))]
1422pub fn fold_expr_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLet) -> ExprLet {
1423 ExprLet {
1424 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1425 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
1426 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
1427 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
1428 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1429 }
1430}
David Tolnay8c81f622018-07-31 23:34:35 -07001431#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001432pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001433 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001434 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1435 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001436 }
1437}
David Tolnay8c81f622018-07-31 23:34:35 -07001438#[cfg(feature = "full")]
1439#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001440pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001441 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001442 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1443 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001444 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001445 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001446 }
1447}
David Tolnay8c81f622018-07-31 23:34:35 -07001448#[cfg(feature = "full")]
1449#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001450pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001451 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001452 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1453 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001454 }
1455}
David Tolnay8c81f622018-07-31 23:34:35 -07001456#[cfg(feature = "full")]
1457#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001458pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001459 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001460 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001461 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001462 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001463 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001464 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001465 }
1466}
David Tolnay8c81f622018-07-31 23:34:35 -07001467#[cfg(feature = "full")]
1468#[cfg(any(feature = "full", feature = "derive"))]
1469pub fn fold_expr_method_call<V: Fold + ?Sized>(
1470 _visitor: &mut V,
1471 _i: ExprMethodCall,
1472) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001473 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001474 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1475 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001476 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001477 method: _visitor.fold_ident(_i.method),
1478 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001479 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001480 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001481 }
1482}
David Tolnay8c81f622018-07-31 23:34:35 -07001483#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001484pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001485 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001486 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001487 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001488 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001489 }
1490}
David Tolnay8c81f622018-07-31 23:34:35 -07001491#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001492pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001493 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001494 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1495 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1496 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001497 }
1498}
David Tolnay8c81f622018-07-31 23:34:35 -07001499#[cfg(feature = "full")]
1500#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001501pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001502 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001503 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1504 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1505 limits: _visitor.fold_range_limits(_i.limits),
1506 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001507 }
1508}
David Tolnay8c81f622018-07-31 23:34:35 -07001509#[cfg(feature = "full")]
1510#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001511pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1512 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001513 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001514 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1515 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001516 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001517 }
1518}
David Tolnay8c81f622018-07-31 23:34:35 -07001519#[cfg(feature = "full")]
1520#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001521pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001522 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001523 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001524 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001525 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001526 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001527 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001528 }
1529}
David Tolnay8c81f622018-07-31 23:34:35 -07001530#[cfg(feature = "full")]
1531#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001532pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001533 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001534 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001535 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001536 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001537 }
1538}
David Tolnay8c81f622018-07-31 23:34:35 -07001539#[cfg(feature = "full")]
1540#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001541pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001542 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001543 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1544 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001545 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001546 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001547 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001548 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001549 }
1550}
David Tolnay8c81f622018-07-31 23:34:35 -07001551#[cfg(feature = "full")]
1552#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001553pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001554 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001555 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1556 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001557 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001558 }
1559}
David Tolnay8c81f622018-07-31 23:34:35 -07001560#[cfg(feature = "full")]
1561#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001562pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1563 ExprTryBlock {
1564 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1565 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1566 block: _visitor.fold_block(_i.block),
1567 }
1568}
1569#[cfg(feature = "full")]
1570#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001571pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001572 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001573 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001574 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001575 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001576 }
1577}
David Tolnay8c81f622018-07-31 23:34:35 -07001578#[cfg(feature = "full")]
1579#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001580pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001581 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001582 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1583 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001584 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001585 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001586 }
1587}
David Tolnay8c81f622018-07-31 23:34:35 -07001588#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001589pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001590 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001591 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1592 op: _visitor.fold_un_op(_i.op),
1593 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001594 }
1595}
David Tolnay8c81f622018-07-31 23:34:35 -07001596#[cfg(feature = "full")]
1597#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001598pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001599 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001600 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001601 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001602 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001603 }
1604}
David Tolnay8c81f622018-07-31 23:34:35 -07001605#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001606pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001607 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001608}
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_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001612 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001613 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1614 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001615 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001616 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1617 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001618 }
1619}
David Tolnay8c81f622018-07-31 23:34:35 -07001620#[cfg(feature = "full")]
1621#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001622pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001623 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001624 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001625 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001626 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001627 }
1628}
David Tolnay8c81f622018-07-31 23:34:35 -07001629#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001630pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001631 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001632 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1633 vis: _visitor.fold_visibility(_i.vis),
1634 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001635 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001636 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001637 }
1638}
David Tolnay8c81f622018-07-31 23:34:35 -07001639#[cfg(any(feature = "full", feature = "derive"))]
1640#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001641pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001642 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001643 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1644 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001645 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001646 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001647 }
1648}
David Tolnay8c81f622018-07-31 23:34:35 -07001649#[cfg(any(feature = "full", feature = "derive"))]
1650#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001651pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001652 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001653 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1654 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001655 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001656 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001657 }
1658}
David Tolnay8c81f622018-07-31 23:34:35 -07001659#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001660pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001661 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001662 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1663 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1664 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001665 }
1666}
David Tolnay8c81f622018-07-31 23:34:35 -07001667#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001668pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001669 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001670 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001671 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001672 }
1673}
David Tolnay8c81f622018-07-31 23:34:35 -07001674#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001675pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001676 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001677 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001678 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001679 }
1680}
David Tolnay8c81f622018-07-31 23:34:35 -07001681#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001682pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001683 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001684 shebang: _i.shebang,
1685 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1686 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001687 }
1688}
David Tolnay8c81f622018-07-31 23:34:35 -07001689#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001690pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001691 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001692 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1693 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1694 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1695 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1696 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
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_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001701 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001702 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001703 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001704 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001705 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001706 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001707 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001708 }
1709}
David Tolnay8c81f622018-07-31 23:34:35 -07001710#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001711pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001712 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001713 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1714 ForeignItem::Static(_binding_0) => {
1715 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001716 }
David Tolnay8c81f622018-07-31 23:34:35 -07001717 ForeignItem::Type(_binding_0) => {
1718 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001719 }
David Tolnay435c1782018-08-24 16:15:44 -04001720 ForeignItem::Macro(_binding_0) => {
1721 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1722 }
David Tolnay8c81f622018-07-31 23:34:35 -07001723 ForeignItem::Verbatim(_binding_0) => {
1724 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001725 }
Nika Layzell27726662017-10-24 23:16:35 -04001726 }
1727}
David Tolnay8c81f622018-07-31 23:34:35 -07001728#[cfg(feature = "full")]
1729pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1730 _visitor: &mut V,
1731 _i: ForeignItemFn,
1732) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001733 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001734 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1735 vis: _visitor.fold_visibility(_i.vis),
1736 ident: _visitor.fold_ident(_i.ident),
1737 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001738 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001739 }
1740}
David Tolnay8c81f622018-07-31 23:34:35 -07001741#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001742pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1743 _visitor: &mut V,
1744 _i: ForeignItemMacro,
1745) -> ForeignItemMacro {
1746 ForeignItemMacro {
1747 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1748 mac: _visitor.fold_macro(_i.mac),
1749 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1750 }
1751}
1752#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001753pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1754 _visitor: &mut V,
1755 _i: ForeignItemStatic,
1756) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001757 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001758 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1759 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001760 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1761 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001762 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001763 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001764 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001765 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001766 }
1767}
David Tolnay8c81f622018-07-31 23:34:35 -07001768#[cfg(feature = "full")]
1769pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1770 _visitor: &mut V,
1771 _i: ForeignItemType,
1772) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001773 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001774 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1775 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001776 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001777 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001778 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001779 }
1780}
David Tolnay8c81f622018-07-31 23:34:35 -07001781#[cfg(feature = "full")]
1782pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1783 _visitor: &mut V,
1784 _i: ForeignItemVerbatim,
1785) -> ForeignItemVerbatim {
1786 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001787}
David Tolnay8c81f622018-07-31 23:34:35 -07001788#[cfg(any(feature = "full", feature = "derive"))]
1789pub fn fold_generic_argument<V: Fold + ?Sized>(
1790 _visitor: &mut V,
1791 _i: GenericArgument,
1792) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001793 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001794 GenericArgument::Lifetime(_binding_0) => {
1795 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001796 }
David Tolnay8c81f622018-07-31 23:34:35 -07001797 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1798 GenericArgument::Binding(_binding_0) => {
1799 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001800 }
David Tolnay9d0882a2018-09-01 19:49:14 -07001801 GenericArgument::Constraint(_binding_0) => {
1802 GenericArgument::Constraint(_visitor.fold_constraint(_binding_0))
1803 }
David Tolnay8c81f622018-07-31 23:34:35 -07001804 GenericArgument::Const(_binding_0) => {
1805 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001806 }
Nika Layzell357885a2017-12-04 15:47:07 -05001807 }
1808}
David Tolnay8c81f622018-07-31 23:34:35 -07001809#[cfg(any(feature = "full", feature = "derive"))]
1810#[cfg(feature = "full")]
1811pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1812 _visitor: &mut V,
1813 _i: GenericMethodArgument,
1814) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001815 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001816 GenericMethodArgument::Type(_binding_0) => {
1817 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001818 }
David Tolnay8c81f622018-07-31 23:34:35 -07001819 GenericMethodArgument::Const(_binding_0) => {
1820 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001821 }
1822 }
1823}
David Tolnay8c81f622018-07-31 23:34:35 -07001824#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001825pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001826 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001827 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1828 GenericParam::Lifetime(_binding_0) => {
1829 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001830 }
David Tolnay8c81f622018-07-31 23:34:35 -07001831 GenericParam::Const(_binding_0) => {
1832 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001833 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001834 }
1835}
David Tolnay8c81f622018-07-31 23:34:35 -07001836#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001837pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001838 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001839 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001840 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001841 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001842 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001843 }
1844}
Alex Crichtond261d092018-05-18 13:47:35 -07001845pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001846 let mut _i = _i;
1847 let span = _visitor.fold_span(_i.span());
1848 _i.set_span(span);
1849 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001850}
David Tolnay8c81f622018-07-31 23:34:35 -07001851#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001852pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001853 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001854 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1855 ImplItem::Method(_binding_0) => {
1856 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001857 }
David Tolnay8c81f622018-07-31 23:34:35 -07001858 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001859 ImplItem::Existential(_binding_0) => {
1860 ImplItem::Existential(_visitor.fold_impl_item_existential(_binding_0))
1861 }
David Tolnay8c81f622018-07-31 23:34:35 -07001862 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1863 ImplItem::Verbatim(_binding_0) => {
1864 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001865 }
Nika Layzell27726662017-10-24 23:16:35 -04001866 }
1867}
David Tolnay8c81f622018-07-31 23:34:35 -07001868#[cfg(feature = "full")]
1869pub fn fold_impl_item_const<V: Fold + ?Sized>(
1870 _visitor: &mut V,
1871 _i: ImplItemConst,
1872) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001873 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001874 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1875 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001876 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1877 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001878 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001879 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001880 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001881 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001882 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001883 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001884 }
1885}
David Tolnay8c81f622018-07-31 23:34:35 -07001886#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001887pub fn fold_impl_item_existential<V: Fold + ?Sized>(
1888 _visitor: &mut V,
1889 _i: ImplItemExistential,
1890) -> ImplItemExistential {
1891 ImplItemExistential {
1892 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1893 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
1894 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
1895 ident: _visitor.fold_ident(_i.ident),
1896 generics: _visitor.fold_generics(_i.generics),
1897 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1898 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1899 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1900 }
1901}
1902#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001903pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1904 _visitor: &mut V,
1905 _i: ImplItemMacro,
1906) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001907 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001908 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1909 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001910 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001911 }
1912}
David Tolnay8c81f622018-07-31 23:34:35 -07001913#[cfg(feature = "full")]
1914pub fn fold_impl_item_method<V: Fold + ?Sized>(
1915 _visitor: &mut V,
1916 _i: ImplItemMethod,
1917) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001918 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001919 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1920 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001921 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001922 sig: _visitor.fold_method_sig(_i.sig),
1923 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001924 }
1925}
David Tolnay8c81f622018-07-31 23:34:35 -07001926#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001927pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001928 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001929 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1930 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001931 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1932 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001933 ident: _visitor.fold_ident(_i.ident),
1934 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001935 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001936 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001937 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001938 }
1939}
David Tolnay8c81f622018-07-31 23:34:35 -07001940#[cfg(feature = "full")]
1941pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1942 _visitor: &mut V,
1943 _i: ImplItemVerbatim,
1944) -> ImplItemVerbatim {
1945 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001946}
David Tolnay8c81f622018-07-31 23:34:35 -07001947#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001948pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001949 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001950 index: _i.index,
1951 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001952 }
1953}
David Tolnay8c81f622018-07-31 23:34:35 -07001954#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001955pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001956 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001957 Item::ExternCrate(_binding_0) => {
1958 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001959 }
David Tolnay8c81f622018-07-31 23:34:35 -07001960 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1961 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1962 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1963 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1964 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1965 Item::ForeignMod(_binding_0) => {
1966 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001967 }
David Tolnay8c81f622018-07-31 23:34:35 -07001968 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001969 Item::Existential(_binding_0) => {
1970 Item::Existential(_visitor.fold_item_existential(_binding_0))
1971 }
David Tolnay8c81f622018-07-31 23:34:35 -07001972 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1973 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1974 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1975 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07001976 Item::TraitAlias(_binding_0) => {
1977 Item::TraitAlias(_visitor.fold_item_trait_alias(_binding_0))
1978 }
David Tolnay8c81f622018-07-31 23:34:35 -07001979 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1980 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1981 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1982 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001983 }
1984}
David Tolnay8c81f622018-07-31 23:34:35 -07001985#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001986pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001987 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001988 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1989 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001990 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001991 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001992 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001993 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001994 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001995 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001996 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001997 }
1998}
David Tolnay8c81f622018-07-31 23:34:35 -07001999#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002000pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002001 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07002002 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2003 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002004 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002005 ident: _visitor.fold_ident(_i.ident),
2006 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002007 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002008 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002009 }
2010}
David Tolnay8c81f622018-07-31 23:34:35 -07002011#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04002012pub fn fold_item_existential<V: Fold + ?Sized>(
2013 _visitor: &mut V,
2014 _i: ItemExistential,
2015) -> ItemExistential {
2016 ItemExistential {
2017 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2018 vis: _visitor.fold_visibility(_i.vis),
2019 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
2020 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
2021 ident: _visitor.fold_ident(_i.ident),
2022 generics: _visitor.fold_generics(_i.generics),
2023 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
2024 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2025 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2026 }
2027}
2028#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07002029pub fn fold_item_extern_crate<V: Fold + ?Sized>(
2030 _visitor: &mut V,
2031 _i: ItemExternCrate,
2032) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002033 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07002034 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2035 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002036 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
2037 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002038 ident: _visitor.fold_ident(_i.ident),
2039 rename: (_i.rename).map(|it| {
2040 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002041 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002042 _visitor.fold_ident((it).1),
2043 )
2044 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002045 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002046 }
2047}
David Tolnay8c81f622018-07-31 23:34:35 -07002048#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002049pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002050 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07002051 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2052 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002053 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2054 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002055 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002056 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2057 ident: _visitor.fold_ident(_i.ident),
2058 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2059 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002060 }
2061}
David Tolnay8c81f622018-07-31 23:34:35 -07002062#[cfg(feature = "full")]
2063pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2064 _visitor: &mut V,
2065 _i: ItemForeignMod,
2066) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002067 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002068 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2069 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002070 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002071 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002072 }
2073}
David Tolnay8c81f622018-07-31 23:34:35 -07002074#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002075pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002076 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002077 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002078 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2079 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2080 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002081 generics: _visitor.fold_generics(_i.generics),
2082 trait_: (_i.trait_).map(|it| {
2083 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002084 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002085 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002086 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002087 )
2088 }),
2089 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002090 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002091 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002092 }
2093}
David Tolnay8c81f622018-07-31 23:34:35 -07002094#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002095pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002096 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002097 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2098 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2099 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002100 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002101 }
2102}
David Tolnay8c81f622018-07-31 23:34:35 -07002103#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002104pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002105 ItemMacro2 {
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 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002109 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002110 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002111 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002112 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002113 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002114 }
2115}
David Tolnay8c81f622018-07-31 23:34:35 -07002116#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002117pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002118 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002119 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2120 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002121 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002122 ident: _visitor.fold_ident(_i.ident),
2123 content: (_i.content).map(|it| {
2124 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002125 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002126 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2127 )
2128 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002129 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.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_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002134 ItemStatic {
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 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2138 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002139 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002140 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002141 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002142 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002143 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002144 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002145 }
2146}
David Tolnay8c81f622018-07-31 23:34:35 -07002147#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002148pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002149 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002150 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2151 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002152 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002153 ident: _visitor.fold_ident(_i.ident),
2154 generics: _visitor.fold_generics(_i.generics),
2155 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002156 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002157 }
2158}
David Tolnay8c81f622018-07-31 23:34:35 -07002159#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002160pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002161 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002162 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2163 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002164 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2165 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2166 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002167 ident: _visitor.fold_ident(_i.ident),
2168 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002169 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002170 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002171 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002172 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002173 }
2174}
David Tolnay8c81f622018-07-31 23:34:35 -07002175#[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -07002176pub fn fold_item_trait_alias<V: Fold + ?Sized>(
2177 _visitor: &mut V,
2178 _i: ItemTraitAlias,
2179) -> ItemTraitAlias {
2180 ItemTraitAlias {
2181 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2182 vis: _visitor.fold_visibility(_i.vis),
2183 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
2184 ident: _visitor.fold_ident(_i.ident),
2185 generics: _visitor.fold_generics(_i.generics),
2186 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
2187 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2188 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2189 }
2190}
2191#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002192pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002193 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002194 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2195 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002196 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002197 ident: _visitor.fold_ident(_i.ident),
2198 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002199 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002200 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002201 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002202 }
2203}
David Tolnay8c81f622018-07-31 23:34:35 -07002204#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002205pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002206 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002207 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2208 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002209 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002210 ident: _visitor.fold_ident(_i.ident),
2211 generics: _visitor.fold_generics(_i.generics),
2212 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002213 }
2214}
David Tolnay8c81f622018-07-31 23:34:35 -07002215#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002216pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002217 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002218 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2219 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002220 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002221 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002222 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002223 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002224 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002225 }
2226}
David Tolnay8c81f622018-07-31 23:34:35 -07002227#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002228pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002229 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002230}
David Tolnay8c81f622018-07-31 23:34:35 -07002231#[cfg(any(feature = "full", feature = "derive"))]
2232#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002233pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002234 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002235 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002236 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002237 }
2238}
Alex Crichton131308c2018-05-18 14:00:24 -07002239pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2240 Lifetime {
David Tolnay17f63892018-08-31 10:36:32 -07002241 apostrophe: _visitor.fold_span(_i.apostrophe),
David Tolnay8c81f622018-07-31 23:34:35 -07002242 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002243 }
2244}
David Tolnay8c81f622018-07-31 23:34:35 -07002245#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002246pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002247 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002248 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2249 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002250 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002251 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002252 }
2253}
David Tolnay8c81f622018-07-31 23:34:35 -07002254#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002255pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002256 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002257 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2258 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2259 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2260 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2261 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2262 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2263 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2264 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002265 }
2266}
David Tolnay8c81f622018-07-31 23:34:35 -07002267#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002268pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002269 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002270 value: _i.value,
2271 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002272 }
2273}
David Tolnay8c81f622018-07-31 23:34:35 -07002274#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002275pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002276 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002277}
David Tolnay8c81f622018-07-31 23:34:35 -07002278#[cfg(any(feature = "full", feature = "derive"))]
2279#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002280pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002281 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002282 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002283 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002284 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2285 ty: (_i.ty).map(|it| {
2286 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002287 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002288 Box::new(_visitor.fold_type(*(it).1)),
2289 )
2290 }),
2291 init: (_i.init).map(|it| {
2292 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002293 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002294 Box::new(_visitor.fold_expr(*(it).1)),
2295 )
2296 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002297 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002298 }
2299}
David Tolnay8c81f622018-07-31 23:34:35 -07002300#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002301pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002302 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002303 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002304 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002305 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2306 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002307 }
2308}
David Tolnay8c81f622018-07-31 23:34:35 -07002309#[cfg(any(feature = "full", feature = "derive"))]
2310pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2311 _visitor: &mut V,
2312 _i: MacroDelimiter,
2313) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002314 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002315 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002316 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002317 }
David Tolnay8c81f622018-07-31 23:34:35 -07002318 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002319 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002320 }
David Tolnay8c81f622018-07-31 23:34:35 -07002321 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002322 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002323 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002324 }
2325}
David Tolnay8c81f622018-07-31 23:34:35 -07002326#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002327pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002328 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002329 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2330 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002331 }
2332}
David Tolnay8c81f622018-07-31 23:34:35 -07002333#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002334pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002335 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002336 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2337 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2338 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002339 }
2340}
David Tolnay8c81f622018-07-31 23:34:35 -07002341#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002342pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2343 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002344 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002345 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002346 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002347 }
2348}
David Tolnay8c81f622018-07-31 23:34:35 -07002349#[cfg(any(feature = "full", feature = "derive"))]
2350pub fn fold_meta_name_value<V: Fold + ?Sized>(
2351 _visitor: &mut V,
2352 _i: MetaNameValue,
2353) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002354 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002355 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002356 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002357 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002358 }
2359}
David Tolnay8c81f622018-07-31 23:34:35 -07002360#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002361pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002362 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002363 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2364 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002365 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002366 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2367 ident: _visitor.fold_ident(_i.ident),
2368 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002369 }
2370}
David Tolnay8c81f622018-07-31 23:34:35 -07002371#[cfg(any(feature = "full", feature = "derive"))]
2372#[cfg(feature = "full")]
2373pub fn fold_method_turbofish<V: Fold + ?Sized>(
2374 _visitor: &mut V,
2375 _i: MethodTurbofish,
2376) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002377 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002378 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2379 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002380 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002381 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002382 }
2383}
David Tolnay8c81f622018-07-31 23:34:35 -07002384#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002385pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002386 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002387 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2388 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002389 }
2390}
David Tolnay8c81f622018-07-31 23:34:35 -07002391#[cfg(any(feature = "full", feature = "derive"))]
2392pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2393 _visitor: &mut V,
2394 _i: ParenthesizedGenericArguments,
2395) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002396 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002397 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002398 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2399 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002400 }
2401}
David Tolnay8c81f622018-07-31 23:34:35 -07002402#[cfg(any(feature = "full", feature = "derive"))]
2403#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002404pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002405 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002406 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2407 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2408 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2409 Pat::TupleStruct(_binding_0) => {
2410 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002411 }
David Tolnay8c81f622018-07-31 23:34:35 -07002412 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2413 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2414 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2415 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2416 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2417 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2418 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2419 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2420 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002421 }
2422}
David Tolnay8c81f622018-07-31 23:34:35 -07002423#[cfg(any(feature = "full", feature = "derive"))]
2424#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002425pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002426 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002427 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002428 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002429 }
2430}
David Tolnay8c81f622018-07-31 23:34:35 -07002431#[cfg(any(feature = "full", feature = "derive"))]
2432#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002433pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002434 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002435 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2436 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002437 ident: _visitor.fold_ident(_i.ident),
2438 subpat: (_i.subpat).map(|it| {
2439 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002440 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002441 Box::new(_visitor.fold_pat(*(it).1)),
2442 )
2443 }),
Nika Layzell27726662017-10-24 23:16:35 -04002444 }
2445}
David Tolnay8c81f622018-07-31 23:34:35 -07002446#[cfg(any(feature = "full", feature = "derive"))]
2447#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002448pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002449 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002450 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002451 }
2452}
David Tolnay8c81f622018-07-31 23:34:35 -07002453#[cfg(any(feature = "full", feature = "derive"))]
2454#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002455pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002456 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002457 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002458 }
2459}
David Tolnay8c81f622018-07-31 23:34:35 -07002460#[cfg(any(feature = "full", feature = "derive"))]
2461#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002462pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002463 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002464 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2465 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002466 }
2467}
David Tolnay8c81f622018-07-31 23:34:35 -07002468#[cfg(any(feature = "full", feature = "derive"))]
2469#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002470pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002471 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002472 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2473 limits: _visitor.fold_range_limits(_i.limits),
2474 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002475 }
2476}
David Tolnay8c81f622018-07-31 23:34:35 -07002477#[cfg(any(feature = "full", feature = "derive"))]
2478#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002479pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002480 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002481 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2482 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002483 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002484 }
2485}
David Tolnay8c81f622018-07-31 23:34:35 -07002486#[cfg(any(feature = "full", feature = "derive"))]
2487#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002488pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002489 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002490 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002491 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2492 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002493 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2494 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002495 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002496 }
2497}
David Tolnay8c81f622018-07-31 23:34:35 -07002498#[cfg(any(feature = "full", feature = "derive"))]
2499#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002500pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002501 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002502 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002503 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002504 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002505 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002506 }
2507}
David Tolnay8c81f622018-07-31 23:34:35 -07002508#[cfg(any(feature = "full", feature = "derive"))]
2509#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002510pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002511 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002512 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002513 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002514 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2515 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002516 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002517 }
2518}
David Tolnay8c81f622018-07-31 23:34:35 -07002519#[cfg(any(feature = "full", feature = "derive"))]
2520#[cfg(feature = "full")]
2521pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2522 _visitor: &mut V,
2523 _i: PatTupleStruct,
2524) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002525 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002526 path: _visitor.fold_path(_i.path),
2527 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002528 }
2529}
David Tolnay8c81f622018-07-31 23:34:35 -07002530#[cfg(any(feature = "full", feature = "derive"))]
2531#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002532pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002533 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002534}
David Tolnay8c81f622018-07-31 23:34:35 -07002535#[cfg(any(feature = "full", feature = "derive"))]
2536#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002537pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002538 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002539 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002540 }
2541}
David Tolnay8c81f622018-07-31 23:34:35 -07002542#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002543pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002544 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002545 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002546 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002547 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002548 }
2549}
David Tolnay8c81f622018-07-31 23:34:35 -07002550#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002551pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002552 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002553 PathArguments::None => PathArguments::None,
2554 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2555 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2556 ),
2557 PathArguments::Parenthesized(_binding_0) => {
2558 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002559 }
2560 }
2561}
David Tolnay8c81f622018-07-31 23:34:35 -07002562#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002563pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002564 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002565 ident: _visitor.fold_ident(_i.ident),
2566 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002567 }
2568}
David Tolnay8c81f622018-07-31 23:34:35 -07002569#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002570pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002571 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002572 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002573 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002574 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002575 }
2576}
David Tolnay8c81f622018-07-31 23:34:35 -07002577#[cfg(any(feature = "full", feature = "derive"))]
2578pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2579 _visitor: &mut V,
2580 _i: PredicateLifetime,
2581) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002582 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002583 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay1b8e2852018-08-26 08:25:18 -04002584 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002585 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002586 }
2587}
David Tolnay8c81f622018-07-31 23:34:35 -07002588#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002589pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002590 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002591 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2592 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002593 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002594 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002595 }
2596}
David Tolnay8c81f622018-07-31 23:34:35 -07002597#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002598pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002599 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002600 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002601 ty: Box::new(_visitor.fold_type(*_i.ty)),
2602 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002603 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2604 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002605 }
2606}
David Tolnay8c81f622018-07-31 23:34:35 -07002607#[cfg(any(feature = "full", feature = "derive"))]
2608#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002609pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002610 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002611 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002612 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002613 }
David Tolnay8c81f622018-07-31 23:34:35 -07002614 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002615 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002616 }
2617 }
2618}
David Tolnay8c81f622018-07-31 23:34:35 -07002619#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002620pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002621 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002622 ReturnType::Default => ReturnType::Default,
2623 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002624 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002625 Box::new(_visitor.fold_type(*_binding_1)),
2626 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002627 }
2628}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002629pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002630 _i
2631}
David Tolnay8c81f622018-07-31 23:34:35 -07002632#[cfg(any(feature = "full", feature = "derive"))]
2633#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002634pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002635 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002636 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2637 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2638 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2639 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2640 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002641 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002642 ),
Nika Layzell27726662017-10-24 23:16:35 -04002643 }
2644}
David Tolnay8c81f622018-07-31 23:34:35 -07002645#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002646pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002647 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002648 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002649 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2650 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2651 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002652 }
2653}
David Tolnay8c81f622018-07-31 23:34:35 -07002654#[cfg(any(feature = "full", feature = "derive"))]
2655pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2656 _visitor: &mut V,
2657 _i: TraitBoundModifier,
2658) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002659 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002660 TraitBoundModifier::None => TraitBoundModifier::None,
2661 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002662 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002663 }
2664 }
2665}
David Tolnay8c81f622018-07-31 23:34:35 -07002666#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002667pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002668 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002669 TraitItem::Const(_binding_0) => {
2670 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002671 }
David Tolnay8c81f622018-07-31 23:34:35 -07002672 TraitItem::Method(_binding_0) => {
2673 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002674 }
David Tolnay8c81f622018-07-31 23:34:35 -07002675 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2676 TraitItem::Macro(_binding_0) => {
2677 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002678 }
David Tolnay8c81f622018-07-31 23:34:35 -07002679 TraitItem::Verbatim(_binding_0) => {
2680 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002681 }
Nika Layzell27726662017-10-24 23:16:35 -04002682 }
2683}
David Tolnay8c81f622018-07-31 23:34:35 -07002684#[cfg(feature = "full")]
2685pub fn fold_trait_item_const<V: Fold + ?Sized>(
2686 _visitor: &mut V,
2687 _i: TraitItemConst,
2688) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002689 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002690 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002691 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002692 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002693 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002694 ty: _visitor.fold_type(_i.ty),
2695 default: (_i.default).map(|it| {
2696 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002697 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002698 _visitor.fold_expr((it).1),
2699 )
2700 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002701 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002702 }
2703}
David Tolnay8c81f622018-07-31 23:34:35 -07002704#[cfg(feature = "full")]
2705pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2706 _visitor: &mut V,
2707 _i: TraitItemMacro,
2708) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002709 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002710 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2711 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002712 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002713 }
2714}
David Tolnay8c81f622018-07-31 23:34:35 -07002715#[cfg(feature = "full")]
2716pub fn fold_trait_item_method<V: Fold + ?Sized>(
2717 _visitor: &mut V,
2718 _i: TraitItemMethod,
2719) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002720 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002721 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2722 sig: _visitor.fold_method_sig(_i.sig),
2723 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002724 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002725 }
2726}
David Tolnay8c81f622018-07-31 23:34:35 -07002727#[cfg(feature = "full")]
2728pub fn fold_trait_item_type<V: Fold + ?Sized>(
2729 _visitor: &mut V,
2730 _i: TraitItemType,
2731) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002732 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002733 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002734 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002735 ident: _visitor.fold_ident(_i.ident),
2736 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002737 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002738 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2739 default: (_i.default).map(|it| {
2740 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002741 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002742 _visitor.fold_type((it).1),
2743 )
2744 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002745 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002746 }
2747}
David Tolnay8c81f622018-07-31 23:34:35 -07002748#[cfg(feature = "full")]
2749pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2750 _visitor: &mut V,
2751 _i: TraitItemVerbatim,
2752) -> TraitItemVerbatim {
2753 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002754}
David Tolnay8c81f622018-07-31 23:34:35 -07002755#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002756pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002757 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002758 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2759 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2760 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2761 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2762 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2763 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2764 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2765 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2766 Type::TraitObject(_binding_0) => {
2767 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002768 }
David Tolnay8c81f622018-07-31 23:34:35 -07002769 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2770 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2771 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2772 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2773 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2774 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002775 }
2776}
David Tolnay8c81f622018-07-31 23:34:35 -07002777#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002778pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002779 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002780 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002781 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002782 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002783 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002784 }
2785}
David Tolnay8c81f622018-07-31 23:34:35 -07002786#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002787pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002788 TypeBareFn {
David Tolnay3779bb72018-08-26 18:46:07 -07002789 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002790 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002791 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002792 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002793 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002794 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002795 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002796 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002797 }
2798}
David Tolnay8c81f622018-07-31 23:34:35 -07002799#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002800pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002801 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002802 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002803 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002804 }
2805}
David Tolnay8c81f622018-07-31 23:34:35 -07002806#[cfg(any(feature = "full", feature = "derive"))]
2807pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2808 _visitor: &mut V,
2809 _i: TypeImplTrait,
2810) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002811 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002812 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002813 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002814 }
2815}
David Tolnay8c81f622018-07-31 23:34:35 -07002816#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002817pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002818 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002819 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002820 }
2821}
David Tolnay8c81f622018-07-31 23:34:35 -07002822#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002823pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002824 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002825 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002826 }
2827}
David Tolnay8c81f622018-07-31 23:34:35 -07002828#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002829pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002830 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002831 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002832 }
2833}
David Tolnay8c81f622018-07-31 23:34:35 -07002834#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002835pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002836 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002837 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2838 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002839 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002840 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002841 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002842 default: (_i.default).map(|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"))]
2846pub fn fold_type_param_bound<V: Fold + ?Sized>(
2847 _visitor: &mut V,
2848 _i: TypeParamBound,
2849) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002850 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002851 TypeParamBound::Trait(_binding_0) => {
2852 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002853 }
David Tolnay8c81f622018-07-31 23:34:35 -07002854 TypeParamBound::Lifetime(_binding_0) => {
2855 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002856 }
2857 }
2858}
David Tolnay8c81f622018-07-31 23:34:35 -07002859#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002860pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002861 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002862 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002863 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002864 }
2865}
David Tolnay8c81f622018-07-31 23:34:35 -07002866#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002867pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002868 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002869 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2870 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002871 }
2872}
David Tolnay8c81f622018-07-31 23:34:35 -07002873#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002874pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002875 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002876 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2877 const_token: (_i.const_token)
2878 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2879 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002880 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002881 }
2882}
David Tolnay8c81f622018-07-31 23:34:35 -07002883#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002884pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002885 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002886 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002887 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002888 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002889 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002890 }
2891}
David Tolnay8c81f622018-07-31 23:34:35 -07002892#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002893pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002894 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002895 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002896 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002897 }
2898}
David Tolnay8c81f622018-07-31 23:34:35 -07002899#[cfg(any(feature = "full", feature = "derive"))]
2900pub fn fold_type_trait_object<V: Fold + ?Sized>(
2901 _visitor: &mut V,
2902 _i: TypeTraitObject,
2903) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002904 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002905 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002906 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002907 }
2908}
David Tolnay8c81f622018-07-31 23:34:35 -07002909#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002910pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002911 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002912 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002913 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002914 }
2915}
David Tolnay8c81f622018-07-31 23:34:35 -07002916#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002917pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002918 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002919}
David Tolnay8c81f622018-07-31 23:34:35 -07002920#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002921pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002922 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002923 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002924 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002925 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002926 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2927 UnOp::Neg(_binding_0) => {
2928 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2929 }
Nika Layzell27726662017-10-24 23:16:35 -04002930 }
2931}
David Tolnay8c81f622018-07-31 23:34:35 -07002932#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002933pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002934 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002935 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002936 }
2937}
David Tolnay8c81f622018-07-31 23:34:35 -07002938#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002939pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2940 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002941 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002942 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002943 }
2944}
David Tolnay8c81f622018-07-31 23:34:35 -07002945#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002946pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2947 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002948 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002949 }
2950}
David Tolnay8c81f622018-07-31 23:34:35 -07002951#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002952pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002953 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002954 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002955 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002956 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002957 }
2958}
David Tolnay8c81f622018-07-31 23:34:35 -07002959#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002960pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2961 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002962 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002963 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002964 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002965 }
2966}
David Tolnay8c81f622018-07-31 23:34:35 -07002967#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002968pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002969 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002970 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2971 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2972 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2973 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2974 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002975 }
2976}
David Tolnay8c81f622018-07-31 23:34:35 -07002977#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002978pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002979 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002980 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2981 ident: _visitor.fold_ident(_i.ident),
2982 fields: _visitor.fold_fields(_i.fields),
2983 discriminant: (_i.discriminant).map(|it| {
2984 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002985 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002986 _visitor.fold_expr((it).1),
2987 )
2988 }),
Nika Layzell27726662017-10-24 23:16:35 -04002989 }
2990}
David Tolnay8c81f622018-07-31 23:34:35 -07002991#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002992pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002993 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002994 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002995 }
2996}
David Tolnay8c81f622018-07-31 23:34:35 -07002997#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002998pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002999 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04003000 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04003001 }
3002}
David Tolnay8c81f622018-07-31 23:34:35 -07003003#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003004pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04003005 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04003006 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
3007 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
3008 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07003009 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04003010 }
3011}
David Tolnay8c81f622018-07-31 23:34:35 -07003012#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003013pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04003014 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003015 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
3016 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
3017 Visibility::Restricted(_binding_0) => {
3018 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003019 }
David Tolnay8c81f622018-07-31 23:34:35 -07003020 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04003021 }
3022}
David Tolnay8c81f622018-07-31 23:34:35 -07003023#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003024pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04003025 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04003026 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07003027 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04003028 }
3029}
David Tolnay8c81f622018-07-31 23:34:35 -07003030#[cfg(any(feature = "full", feature = "derive"))]
3031pub fn fold_where_predicate<V: Fold + ?Sized>(
3032 _visitor: &mut V,
3033 _i: WherePredicate,
3034) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04003035 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003036 WherePredicate::Type(_binding_0) => {
3037 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003038 }
David Tolnay8c81f622018-07-31 23:34:35 -07003039 WherePredicate::Lifetime(_binding_0) => {
3040 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003041 }
David Tolnay8c81f622018-07-31 23:34:35 -07003042 WherePredicate::Eq(_binding_0) => {
3043 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003044 }
3045 }
3046}