blob: 2499daf9f29bc1f0563f5a2f3aabf25b97114f6c [file] [log] [blame]
Nika Layzell27726662017-10-24 23:16:35 -04001// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
2
Nika Layzell27726662017-10-24 23:16:35 -04003#![allow(unreachable_code)]
David Tolnayf0d63bf2017-12-26 12:29:47 -05004#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
David Tolnay0a0d78c2018-01-05 15:24:01 -08005#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05006use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07007use proc_macro2::Span;
8#[cfg(any(feature = "full", feature = "derive"))]
9use token::{Brace, Bracket, Group, Paren};
10use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040011#[cfg(feature = "full")]
12macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070013 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070014 $e
15 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040016}
David Tolnay0a0d78c2018-01-05 15:24:01 -080017#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040018macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070019 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070020 unreachable!()
21 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040022}
David Tolnay6af48992018-08-01 11:16:28 -070023#[doc = r" Syntax tree traversal to transform the nodes of an owned syntax tree."]
24#[doc = r""]
25#[doc = r" See the [module documentation] for details."]
26#[doc = r""]
27#[doc = r" [module documentation]: index.html"]
28#[doc = r""]
29#[doc = r#" *This trait is available if Syn is built with the `"fold"` feature.*"#]
David Tolnay4b4c4b62018-01-06 13:48:05 -080030pub trait Fold {
David Tolnay8c81f622018-07-31 23:34:35 -070031 #[cfg(any(feature = "full", feature = "derive"))]
32 fn fold_abi(&mut self, i: Abi) -> Abi {
33 fold_abi(self, i)
34 }
35 #[cfg(any(feature = "full", feature = "derive"))]
36 fn fold_angle_bracketed_generic_arguments(
37 &mut self,
38 i: AngleBracketedGenericArguments,
39 ) -> AngleBracketedGenericArguments {
40 fold_angle_bracketed_generic_arguments(self, i)
41 }
42 #[cfg(feature = "full")]
43 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
44 fold_arg_captured(self, i)
45 }
46 #[cfg(feature = "full")]
47 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
48 fold_arg_self(self, i)
49 }
50 #[cfg(feature = "full")]
51 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
52 fold_arg_self_ref(self, i)
53 }
54 #[cfg(any(feature = "full", feature = "derive"))]
55 #[cfg(feature = "full")]
56 fn fold_arm(&mut self, i: Arm) -> Arm {
57 fold_arm(self, i)
58 }
59 #[cfg(any(feature = "full", feature = "derive"))]
60 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
61 fold_attr_style(self, i)
62 }
63 #[cfg(any(feature = "full", feature = "derive"))]
64 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
65 fold_attribute(self, i)
66 }
67 #[cfg(any(feature = "full", feature = "derive"))]
68 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
69 fold_bare_fn_arg(self, i)
70 }
71 #[cfg(any(feature = "full", feature = "derive"))]
72 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
73 fold_bare_fn_arg_name(self, i)
74 }
75 #[cfg(any(feature = "full", feature = "derive"))]
76 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
77 fold_bin_op(self, i)
78 }
79 #[cfg(any(feature = "full", feature = "derive"))]
80 fn fold_binding(&mut self, i: Binding) -> Binding {
81 fold_binding(self, i)
82 }
83 #[cfg(any(feature = "full", feature = "derive"))]
84 #[cfg(feature = "full")]
85 fn fold_block(&mut self, i: Block) -> Block {
86 fold_block(self, i)
87 }
88 #[cfg(any(feature = "full", feature = "derive"))]
89 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
90 fold_bound_lifetimes(self, i)
91 }
92 #[cfg(any(feature = "full", feature = "derive"))]
93 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
94 fold_const_param(self, i)
95 }
96 #[cfg(feature = "derive")]
97 fn fold_data(&mut self, i: Data) -> Data {
98 fold_data(self, i)
99 }
100 #[cfg(feature = "derive")]
101 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
102 fold_data_enum(self, i)
103 }
104 #[cfg(feature = "derive")]
105 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
106 fold_data_struct(self, i)
107 }
108 #[cfg(feature = "derive")]
109 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
110 fold_data_union(self, i)
111 }
112 #[cfg(feature = "derive")]
113 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
114 fold_derive_input(self, i)
115 }
116 #[cfg(any(feature = "full", feature = "derive"))]
117 fn fold_expr(&mut self, i: Expr) -> Expr {
118 fold_expr(self, i)
119 }
120 #[cfg(feature = "full")]
121 #[cfg(any(feature = "full", feature = "derive"))]
122 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
123 fold_expr_array(self, i)
124 }
125 #[cfg(feature = "full")]
126 #[cfg(any(feature = "full", feature = "derive"))]
127 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
128 fold_expr_assign(self, i)
129 }
130 #[cfg(feature = "full")]
131 #[cfg(any(feature = "full", feature = "derive"))]
132 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
133 fold_expr_assign_op(self, i)
134 }
135 #[cfg(any(feature = "full", feature = "derive"))]
136 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
137 fold_expr_binary(self, i)
138 }
139 #[cfg(feature = "full")]
140 #[cfg(any(feature = "full", feature = "derive"))]
141 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
142 fold_expr_block(self, i)
143 }
144 #[cfg(feature = "full")]
145 #[cfg(any(feature = "full", feature = "derive"))]
146 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
147 fold_expr_box(self, i)
148 }
149 #[cfg(feature = "full")]
150 #[cfg(any(feature = "full", feature = "derive"))]
151 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
152 fold_expr_break(self, i)
153 }
154 #[cfg(any(feature = "full", feature = "derive"))]
155 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
156 fold_expr_call(self, i)
157 }
158 #[cfg(any(feature = "full", feature = "derive"))]
159 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
160 fold_expr_cast(self, i)
161 }
162 #[cfg(feature = "full")]
163 #[cfg(any(feature = "full", feature = "derive"))]
164 fn fold_expr_catch(&mut self, i: ExprCatch) -> ExprCatch {
165 fold_expr_catch(self, i)
166 }
167 #[cfg(feature = "full")]
168 #[cfg(any(feature = "full", feature = "derive"))]
169 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
170 fold_expr_closure(self, i)
171 }
172 #[cfg(feature = "full")]
173 #[cfg(any(feature = "full", feature = "derive"))]
174 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
175 fold_expr_continue(self, i)
176 }
177 #[cfg(any(feature = "full", feature = "derive"))]
178 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
179 fold_expr_field(self, i)
180 }
181 #[cfg(feature = "full")]
182 #[cfg(any(feature = "full", feature = "derive"))]
183 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
184 fold_expr_for_loop(self, i)
185 }
186 #[cfg(feature = "full")]
187 #[cfg(any(feature = "full", feature = "derive"))]
188 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
189 fold_expr_group(self, i)
190 }
191 #[cfg(feature = "full")]
192 #[cfg(any(feature = "full", feature = "derive"))]
193 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
194 fold_expr_if(self, i)
195 }
196 #[cfg(feature = "full")]
197 #[cfg(any(feature = "full", feature = "derive"))]
198 fn fold_expr_if_let(&mut self, i: ExprIfLet) -> ExprIfLet {
199 fold_expr_if_let(self, i)
200 }
201 #[cfg(feature = "full")]
202 #[cfg(any(feature = "full", feature = "derive"))]
203 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
204 fold_expr_in_place(self, i)
205 }
206 #[cfg(any(feature = "full", feature = "derive"))]
207 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
208 fold_expr_index(self, i)
209 }
210 #[cfg(any(feature = "full", feature = "derive"))]
211 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
212 fold_expr_lit(self, i)
213 }
214 #[cfg(feature = "full")]
215 #[cfg(any(feature = "full", feature = "derive"))]
216 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
217 fold_expr_loop(self, i)
218 }
219 #[cfg(feature = "full")]
220 #[cfg(any(feature = "full", feature = "derive"))]
221 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
222 fold_expr_macro(self, i)
223 }
224 #[cfg(feature = "full")]
225 #[cfg(any(feature = "full", feature = "derive"))]
226 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
227 fold_expr_match(self, i)
228 }
229 #[cfg(feature = "full")]
230 #[cfg(any(feature = "full", feature = "derive"))]
231 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
232 fold_expr_method_call(self, i)
233 }
234 #[cfg(any(feature = "full", feature = "derive"))]
235 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
236 fold_expr_paren(self, i)
237 }
238 #[cfg(any(feature = "full", feature = "derive"))]
239 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
240 fold_expr_path(self, i)
241 }
242 #[cfg(feature = "full")]
243 #[cfg(any(feature = "full", feature = "derive"))]
244 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
245 fold_expr_range(self, i)
246 }
247 #[cfg(feature = "full")]
248 #[cfg(any(feature = "full", feature = "derive"))]
249 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
250 fold_expr_reference(self, i)
251 }
252 #[cfg(feature = "full")]
253 #[cfg(any(feature = "full", feature = "derive"))]
254 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
255 fold_expr_repeat(self, i)
256 }
257 #[cfg(feature = "full")]
258 #[cfg(any(feature = "full", feature = "derive"))]
259 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
260 fold_expr_return(self, i)
261 }
262 #[cfg(feature = "full")]
263 #[cfg(any(feature = "full", feature = "derive"))]
264 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
265 fold_expr_struct(self, i)
266 }
267 #[cfg(feature = "full")]
268 #[cfg(any(feature = "full", feature = "derive"))]
269 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
270 fold_expr_try(self, i)
271 }
272 #[cfg(feature = "full")]
273 #[cfg(any(feature = "full", feature = "derive"))]
274 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
275 fold_expr_tuple(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg(any(feature = "full", feature = "derive"))]
279 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
280 fold_expr_type(self, i)
281 }
282 #[cfg(any(feature = "full", feature = "derive"))]
283 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
284 fold_expr_unary(self, i)
285 }
286 #[cfg(feature = "full")]
287 #[cfg(any(feature = "full", feature = "derive"))]
288 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
289 fold_expr_unsafe(self, i)
290 }
291 #[cfg(any(feature = "full", feature = "derive"))]
292 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
293 fold_expr_verbatim(self, i)
294 }
295 #[cfg(feature = "full")]
296 #[cfg(any(feature = "full", feature = "derive"))]
297 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
298 fold_expr_while(self, i)
299 }
300 #[cfg(feature = "full")]
301 #[cfg(any(feature = "full", feature = "derive"))]
302 fn fold_expr_while_let(&mut self, i: ExprWhileLet) -> ExprWhileLet {
303 fold_expr_while_let(self, i)
304 }
305 #[cfg(feature = "full")]
306 #[cfg(any(feature = "full", feature = "derive"))]
307 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
308 fold_expr_yield(self, i)
309 }
310 #[cfg(any(feature = "full", feature = "derive"))]
311 fn fold_field(&mut self, i: Field) -> Field {
312 fold_field(self, i)
313 }
314 #[cfg(any(feature = "full", feature = "derive"))]
315 #[cfg(feature = "full")]
316 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
317 fold_field_pat(self, i)
318 }
319 #[cfg(any(feature = "full", feature = "derive"))]
320 #[cfg(feature = "full")]
321 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
322 fold_field_value(self, i)
323 }
324 #[cfg(any(feature = "full", feature = "derive"))]
325 fn fold_fields(&mut self, i: Fields) -> Fields {
326 fold_fields(self, i)
327 }
328 #[cfg(any(feature = "full", feature = "derive"))]
329 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
330 fold_fields_named(self, i)
331 }
332 #[cfg(any(feature = "full", feature = "derive"))]
333 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
334 fold_fields_unnamed(self, i)
335 }
336 #[cfg(feature = "full")]
337 fn fold_file(&mut self, i: File) -> File {
338 fold_file(self, i)
339 }
340 #[cfg(feature = "full")]
341 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
342 fold_fn_arg(self, i)
343 }
344 #[cfg(feature = "full")]
345 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
346 fold_fn_decl(self, i)
347 }
348 #[cfg(feature = "full")]
349 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
350 fold_foreign_item(self, i)
351 }
352 #[cfg(feature = "full")]
353 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
354 fold_foreign_item_fn(self, i)
355 }
356 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400357 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
358 fold_foreign_item_macro(self, i)
359 }
360 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700361 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
362 fold_foreign_item_static(self, i)
363 }
364 #[cfg(feature = "full")]
365 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
366 fold_foreign_item_type(self, i)
367 }
368 #[cfg(feature = "full")]
369 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
370 fold_foreign_item_verbatim(self, i)
371 }
372 #[cfg(any(feature = "full", feature = "derive"))]
373 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
374 fold_generic_argument(self, i)
375 }
376 #[cfg(any(feature = "full", feature = "derive"))]
377 #[cfg(feature = "full")]
378 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
379 fold_generic_method_argument(self, i)
380 }
381 #[cfg(any(feature = "full", feature = "derive"))]
382 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
383 fold_generic_param(self, i)
384 }
385 #[cfg(any(feature = "full", feature = "derive"))]
386 fn fold_generics(&mut self, i: Generics) -> Generics {
387 fold_generics(self, i)
388 }
David Tolnay8c81f622018-07-31 23:34:35 -0700389 fn fold_ident(&mut self, i: Ident) -> Ident {
390 fold_ident(self, i)
391 }
392 #[cfg(feature = "full")]
393 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
394 fold_impl_item(self, i)
395 }
396 #[cfg(feature = "full")]
397 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
398 fold_impl_item_const(self, i)
399 }
400 #[cfg(feature = "full")]
401 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
402 fold_impl_item_macro(self, i)
403 }
404 #[cfg(feature = "full")]
405 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
406 fold_impl_item_method(self, i)
407 }
408 #[cfg(feature = "full")]
409 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
410 fold_impl_item_type(self, i)
411 }
412 #[cfg(feature = "full")]
413 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
414 fold_impl_item_verbatim(self, i)
415 }
416 #[cfg(any(feature = "full", feature = "derive"))]
417 fn fold_index(&mut self, i: Index) -> Index {
418 fold_index(self, i)
419 }
420 #[cfg(feature = "full")]
421 fn fold_item(&mut self, i: Item) -> Item {
422 fold_item(self, i)
423 }
424 #[cfg(feature = "full")]
425 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
426 fold_item_const(self, i)
427 }
428 #[cfg(feature = "full")]
429 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
430 fold_item_enum(self, i)
431 }
432 #[cfg(feature = "full")]
433 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
434 fold_item_extern_crate(self, i)
435 }
436 #[cfg(feature = "full")]
437 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
438 fold_item_fn(self, i)
439 }
440 #[cfg(feature = "full")]
441 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
442 fold_item_foreign_mod(self, i)
443 }
444 #[cfg(feature = "full")]
445 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
446 fold_item_impl(self, i)
447 }
448 #[cfg(feature = "full")]
449 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
450 fold_item_macro(self, i)
451 }
452 #[cfg(feature = "full")]
453 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
454 fold_item_macro2(self, i)
455 }
456 #[cfg(feature = "full")]
457 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
458 fold_item_mod(self, i)
459 }
460 #[cfg(feature = "full")]
461 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
462 fold_item_static(self, i)
463 }
464 #[cfg(feature = "full")]
465 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
466 fold_item_struct(self, i)
467 }
468 #[cfg(feature = "full")]
469 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
470 fold_item_trait(self, i)
471 }
472 #[cfg(feature = "full")]
473 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
474 fold_item_type(self, i)
475 }
476 #[cfg(feature = "full")]
477 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
478 fold_item_union(self, i)
479 }
480 #[cfg(feature = "full")]
481 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
482 fold_item_use(self, i)
483 }
484 #[cfg(feature = "full")]
485 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
486 fold_item_verbatim(self, i)
487 }
488 #[cfg(any(feature = "full", feature = "derive"))]
489 #[cfg(feature = "full")]
490 fn fold_label(&mut self, i: Label) -> Label {
491 fold_label(self, i)
492 }
493 #[cfg(any(feature = "full", feature = "derive"))]
494 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
495 fold_lifetime(self, i)
496 }
497 #[cfg(any(feature = "full", feature = "derive"))]
498 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
499 fold_lifetime_def(self, i)
500 }
501 #[cfg(any(feature = "full", feature = "derive"))]
502 fn fold_lit(&mut self, i: Lit) -> Lit {
503 fold_lit(self, i)
504 }
505 #[cfg(any(feature = "full", feature = "derive"))]
506 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
507 fold_lit_bool(self, i)
508 }
509 #[cfg(any(feature = "full", feature = "derive"))]
510 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
511 fold_lit_byte(self, i)
512 }
513 #[cfg(any(feature = "full", feature = "derive"))]
514 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
515 fold_lit_byte_str(self, i)
516 }
517 #[cfg(any(feature = "full", feature = "derive"))]
518 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
519 fold_lit_char(self, i)
520 }
521 #[cfg(any(feature = "full", feature = "derive"))]
522 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
523 fold_lit_float(self, i)
524 }
525 #[cfg(any(feature = "full", feature = "derive"))]
526 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
527 fold_lit_int(self, i)
528 }
529 #[cfg(any(feature = "full", feature = "derive"))]
530 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
531 fold_lit_str(self, i)
532 }
533 #[cfg(any(feature = "full", feature = "derive"))]
534 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
535 fold_lit_verbatim(self, i)
536 }
537 #[cfg(any(feature = "full", feature = "derive"))]
538 #[cfg(feature = "full")]
539 fn fold_local(&mut self, i: Local) -> Local {
540 fold_local(self, i)
541 }
542 #[cfg(any(feature = "full", feature = "derive"))]
543 fn fold_macro(&mut self, i: Macro) -> Macro {
544 fold_macro(self, i)
545 }
546 #[cfg(any(feature = "full", feature = "derive"))]
547 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
548 fold_macro_delimiter(self, i)
549 }
550 #[cfg(any(feature = "full", feature = "derive"))]
551 fn fold_member(&mut self, i: Member) -> Member {
552 fold_member(self, i)
553 }
554 #[cfg(any(feature = "full", feature = "derive"))]
555 fn fold_meta(&mut self, i: Meta) -> Meta {
556 fold_meta(self, i)
557 }
558 #[cfg(any(feature = "full", feature = "derive"))]
559 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
560 fold_meta_list(self, i)
561 }
562 #[cfg(any(feature = "full", feature = "derive"))]
563 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
564 fold_meta_name_value(self, i)
565 }
566 #[cfg(feature = "full")]
567 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
568 fold_method_sig(self, i)
569 }
570 #[cfg(any(feature = "full", feature = "derive"))]
571 #[cfg(feature = "full")]
572 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
573 fold_method_turbofish(self, i)
574 }
575 #[cfg(any(feature = "full", feature = "derive"))]
576 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
577 fold_nested_meta(self, i)
578 }
579 #[cfg(any(feature = "full", feature = "derive"))]
580 fn fold_parenthesized_generic_arguments(
581 &mut self,
582 i: ParenthesizedGenericArguments,
583 ) -> ParenthesizedGenericArguments {
584 fold_parenthesized_generic_arguments(self, i)
585 }
586 #[cfg(any(feature = "full", feature = "derive"))]
587 #[cfg(feature = "full")]
588 fn fold_pat(&mut self, i: Pat) -> Pat {
589 fold_pat(self, i)
590 }
591 #[cfg(any(feature = "full", feature = "derive"))]
592 #[cfg(feature = "full")]
593 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
594 fold_pat_box(self, i)
595 }
596 #[cfg(any(feature = "full", feature = "derive"))]
597 #[cfg(feature = "full")]
598 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
599 fold_pat_ident(self, i)
600 }
601 #[cfg(any(feature = "full", feature = "derive"))]
602 #[cfg(feature = "full")]
603 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
604 fold_pat_lit(self, i)
605 }
606 #[cfg(any(feature = "full", feature = "derive"))]
607 #[cfg(feature = "full")]
608 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
609 fold_pat_macro(self, i)
610 }
611 #[cfg(any(feature = "full", feature = "derive"))]
612 #[cfg(feature = "full")]
613 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
614 fold_pat_path(self, i)
615 }
616 #[cfg(any(feature = "full", feature = "derive"))]
617 #[cfg(feature = "full")]
618 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
619 fold_pat_range(self, i)
620 }
621 #[cfg(any(feature = "full", feature = "derive"))]
622 #[cfg(feature = "full")]
623 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
624 fold_pat_ref(self, i)
625 }
626 #[cfg(any(feature = "full", feature = "derive"))]
627 #[cfg(feature = "full")]
628 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
629 fold_pat_slice(self, i)
630 }
631 #[cfg(any(feature = "full", feature = "derive"))]
632 #[cfg(feature = "full")]
633 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
634 fold_pat_struct(self, i)
635 }
636 #[cfg(any(feature = "full", feature = "derive"))]
637 #[cfg(feature = "full")]
638 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
639 fold_pat_tuple(self, i)
640 }
641 #[cfg(any(feature = "full", feature = "derive"))]
642 #[cfg(feature = "full")]
643 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
644 fold_pat_tuple_struct(self, i)
645 }
646 #[cfg(any(feature = "full", feature = "derive"))]
647 #[cfg(feature = "full")]
648 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
649 fold_pat_verbatim(self, i)
650 }
651 #[cfg(any(feature = "full", feature = "derive"))]
652 #[cfg(feature = "full")]
653 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
654 fold_pat_wild(self, i)
655 }
656 #[cfg(any(feature = "full", feature = "derive"))]
657 fn fold_path(&mut self, i: Path) -> Path {
658 fold_path(self, i)
659 }
660 #[cfg(any(feature = "full", feature = "derive"))]
661 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
662 fold_path_arguments(self, i)
663 }
664 #[cfg(any(feature = "full", feature = "derive"))]
665 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
666 fold_path_segment(self, i)
667 }
668 #[cfg(any(feature = "full", feature = "derive"))]
669 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
670 fold_predicate_eq(self, i)
671 }
672 #[cfg(any(feature = "full", feature = "derive"))]
673 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
674 fold_predicate_lifetime(self, i)
675 }
676 #[cfg(any(feature = "full", feature = "derive"))]
677 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
678 fold_predicate_type(self, i)
679 }
680 #[cfg(any(feature = "full", feature = "derive"))]
681 fn fold_qself(&mut self, i: QSelf) -> QSelf {
682 fold_qself(self, i)
683 }
684 #[cfg(any(feature = "full", feature = "derive"))]
685 #[cfg(feature = "full")]
686 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
687 fold_range_limits(self, i)
688 }
689 #[cfg(any(feature = "full", feature = "derive"))]
690 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
691 fold_return_type(self, i)
692 }
David Tolnay8c81f622018-07-31 23:34:35 -0700693 fn fold_span(&mut self, i: Span) -> Span {
694 fold_span(self, i)
695 }
696 #[cfg(any(feature = "full", feature = "derive"))]
697 #[cfg(feature = "full")]
698 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
699 fold_stmt(self, i)
700 }
701 #[cfg(any(feature = "full", feature = "derive"))]
702 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
703 fold_trait_bound(self, i)
704 }
705 #[cfg(any(feature = "full", feature = "derive"))]
706 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
707 fold_trait_bound_modifier(self, i)
708 }
709 #[cfg(feature = "full")]
710 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
711 fold_trait_item(self, i)
712 }
713 #[cfg(feature = "full")]
714 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
715 fold_trait_item_const(self, i)
716 }
717 #[cfg(feature = "full")]
718 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
719 fold_trait_item_macro(self, i)
720 }
721 #[cfg(feature = "full")]
722 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
723 fold_trait_item_method(self, i)
724 }
725 #[cfg(feature = "full")]
726 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
727 fold_trait_item_type(self, i)
728 }
729 #[cfg(feature = "full")]
730 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
731 fold_trait_item_verbatim(self, i)
732 }
733 #[cfg(any(feature = "full", feature = "derive"))]
734 fn fold_type(&mut self, i: Type) -> Type {
735 fold_type(self, i)
736 }
737 #[cfg(any(feature = "full", feature = "derive"))]
738 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
739 fold_type_array(self, i)
740 }
741 #[cfg(any(feature = "full", feature = "derive"))]
742 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
743 fold_type_bare_fn(self, i)
744 }
745 #[cfg(any(feature = "full", feature = "derive"))]
746 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
747 fold_type_group(self, i)
748 }
749 #[cfg(any(feature = "full", feature = "derive"))]
750 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
751 fold_type_impl_trait(self, i)
752 }
753 #[cfg(any(feature = "full", feature = "derive"))]
754 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
755 fold_type_infer(self, i)
756 }
757 #[cfg(any(feature = "full", feature = "derive"))]
758 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
759 fold_type_macro(self, i)
760 }
761 #[cfg(any(feature = "full", feature = "derive"))]
762 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
763 fold_type_never(self, i)
764 }
765 #[cfg(any(feature = "full", feature = "derive"))]
766 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
767 fold_type_param(self, i)
768 }
769 #[cfg(any(feature = "full", feature = "derive"))]
770 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
771 fold_type_param_bound(self, i)
772 }
773 #[cfg(any(feature = "full", feature = "derive"))]
774 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
775 fold_type_paren(self, i)
776 }
777 #[cfg(any(feature = "full", feature = "derive"))]
778 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
779 fold_type_path(self, i)
780 }
781 #[cfg(any(feature = "full", feature = "derive"))]
782 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
783 fold_type_ptr(self, i)
784 }
785 #[cfg(any(feature = "full", feature = "derive"))]
786 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
787 fold_type_reference(self, i)
788 }
789 #[cfg(any(feature = "full", feature = "derive"))]
790 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
791 fold_type_slice(self, i)
792 }
793 #[cfg(any(feature = "full", feature = "derive"))]
794 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
795 fold_type_trait_object(self, i)
796 }
797 #[cfg(any(feature = "full", feature = "derive"))]
798 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
799 fold_type_tuple(self, i)
800 }
801 #[cfg(any(feature = "full", feature = "derive"))]
802 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
803 fold_type_verbatim(self, i)
804 }
805 #[cfg(any(feature = "full", feature = "derive"))]
806 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
807 fold_un_op(self, i)
808 }
809 #[cfg(feature = "full")]
810 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
811 fold_use_glob(self, i)
812 }
813 #[cfg(feature = "full")]
814 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
815 fold_use_group(self, i)
816 }
817 #[cfg(feature = "full")]
818 fn fold_use_name(&mut self, i: UseName) -> UseName {
819 fold_use_name(self, i)
820 }
821 #[cfg(feature = "full")]
822 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
823 fold_use_path(self, i)
824 }
825 #[cfg(feature = "full")]
826 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
827 fold_use_rename(self, i)
828 }
829 #[cfg(feature = "full")]
830 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
831 fold_use_tree(self, i)
832 }
833 #[cfg(any(feature = "full", feature = "derive"))]
834 fn fold_variant(&mut self, i: Variant) -> Variant {
835 fold_variant(self, i)
836 }
837 #[cfg(any(feature = "full", feature = "derive"))]
838 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
839 fold_vis_crate(self, i)
840 }
841 #[cfg(any(feature = "full", feature = "derive"))]
842 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
843 fold_vis_public(self, i)
844 }
845 #[cfg(any(feature = "full", feature = "derive"))]
846 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
847 fold_vis_restricted(self, i)
848 }
849 #[cfg(any(feature = "full", feature = "derive"))]
850 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
851 fold_visibility(self, i)
852 }
853 #[cfg(any(feature = "full", feature = "derive"))]
854 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
855 fold_where_clause(self, i)
856 }
857 #[cfg(any(feature = "full", feature = "derive"))]
858 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
859 fold_where_predicate(self, i)
860 }
Nika Layzell27726662017-10-24 23:16:35 -0400861}
David Tolnayd3f32142018-05-20 20:21:12 -0700862#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800863macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700864 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800865 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700866 let span = _visitor.fold_span(_i.span());
867 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800868 _i
869 }
David Tolnay8c81f622018-07-31 23:34:35 -0700870 };
David Tolnayd0adf522017-12-29 01:30:07 -0500871}
David Tolnay360efd22018-01-04 23:35:26 -0800872#[cfg(any(feature = "full", feature = "derive"))]
873fold_span_only!(fold_lit_byte: LitByte);
874#[cfg(any(feature = "full", feature = "derive"))]
875fold_span_only!(fold_lit_byte_str: LitByteStr);
876#[cfg(any(feature = "full", feature = "derive"))]
877fold_span_only!(fold_lit_char: LitChar);
878#[cfg(any(feature = "full", feature = "derive"))]
879fold_span_only!(fold_lit_float: LitFloat);
880#[cfg(any(feature = "full", feature = "derive"))]
881fold_span_only!(fold_lit_int: LitInt);
882#[cfg(any(feature = "full", feature = "derive"))]
883fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700884#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800885pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400886 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400887 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700888 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400889 }
890}
David Tolnay8c81f622018-07-31 23:34:35 -0700891#[cfg(any(feature = "full", feature = "derive"))]
892pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
893 _visitor: &mut V,
894 _i: AngleBracketedGenericArguments,
895) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500896 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400897 colon2_token: (_i.colon2_token)
898 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
899 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700900 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400901 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400902 }
903}
David Tolnay8c81f622018-07-31 23:34:35 -0700904#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800905pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400906 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700907 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400908 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700909 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400910 }
911}
David Tolnay8c81f622018-07-31 23:34:35 -0700912#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800913pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400914 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400915 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
916 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400917 }
918}
David Tolnay8c81f622018-07-31 23:34:35 -0700919#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800920pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400921 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400922 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700923 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400924 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
925 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400926 }
927}
David Tolnay8c81f622018-07-31 23:34:35 -0700928#[cfg(any(feature = "full", feature = "derive"))]
929#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800930pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400931 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700932 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400933 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700934 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
935 guard: (_i.guard).map(|it| {
936 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400937 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700938 Box::new(_visitor.fold_expr(*(it).1)),
939 )
940 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400941 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700942 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400943 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400944 }
945}
David Tolnay8c81f622018-07-31 23:34:35 -0700946#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800947pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400948 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700949 AttrStyle::Outer => AttrStyle::Outer,
950 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400951 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400952 }
953 }
954}
David Tolnay8c81f622018-07-31 23:34:35 -0700955#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800956pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400957 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400958 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700959 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400960 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700961 path: _visitor.fold_path(_i.path),
962 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400963 }
964}
David Tolnay8c81f622018-07-31 23:34:35 -0700965#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800966pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400967 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700968 name: (_i.name).map(|it| {
969 (
970 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400971 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700972 )
973 }),
974 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400975 }
976}
David Tolnay8c81f622018-07-31 23:34:35 -0700977#[cfg(any(feature = "full", feature = "derive"))]
978pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
979 _visitor: &mut V,
980 _i: BareFnArgName,
981) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400982 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700983 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
984 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400985 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400986 }
987 }
988}
David Tolnay8c81f622018-07-31 23:34:35 -0700989#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800990pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -0400991 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700992 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400993 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400994 }
David Tolnay8c81f622018-07-31 23:34:35 -0700995 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400996 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400997 }
David Tolnay8c81f622018-07-31 23:34:35 -0700998 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400999 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001000 }
David Tolnay8c81f622018-07-31 23:34:35 -07001001 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001002 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001003 }
David Tolnay8c81f622018-07-31 23:34:35 -07001004 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001005 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001006 }
David Tolnay8c81f622018-07-31 23:34:35 -07001007 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001008 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001009 }
David Tolnay8c81f622018-07-31 23:34:35 -07001010 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001011 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001012 }
David Tolnay8c81f622018-07-31 23:34:35 -07001013 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001014 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001015 }
David Tolnay8c81f622018-07-31 23:34:35 -07001016 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001017 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001018 }
David Tolnay8c81f622018-07-31 23:34:35 -07001019 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001020 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001021 }
David Tolnay8c81f622018-07-31 23:34:35 -07001022 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001023 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001024 }
David Tolnay8c81f622018-07-31 23:34:35 -07001025 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001026 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001027 }
David Tolnay8c81f622018-07-31 23:34:35 -07001028 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001029 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001030 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001031 BinOp::Lt(_binding_0) => {
1032 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1033 }
David Tolnay8c81f622018-07-31 23:34:35 -07001034 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001035 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001036 }
David Tolnay8c81f622018-07-31 23:34:35 -07001037 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001038 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001039 }
David Tolnay8c81f622018-07-31 23:34:35 -07001040 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001041 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001042 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001043 BinOp::Gt(_binding_0) => {
1044 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1045 }
David Tolnay8c81f622018-07-31 23:34:35 -07001046 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001047 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001048 }
David Tolnay8c81f622018-07-31 23:34:35 -07001049 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001050 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001051 }
David Tolnay8c81f622018-07-31 23:34:35 -07001052 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001053 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001054 }
David Tolnay8c81f622018-07-31 23:34:35 -07001055 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001056 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001057 }
David Tolnay8c81f622018-07-31 23:34:35 -07001058 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001059 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001060 }
David Tolnay8c81f622018-07-31 23:34:35 -07001061 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001062 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001063 }
David Tolnay8c81f622018-07-31 23:34:35 -07001064 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001065 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001066 }
David Tolnay8c81f622018-07-31 23:34:35 -07001067 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001068 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001069 }
David Tolnay8c81f622018-07-31 23:34:35 -07001070 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001071 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001072 }
David Tolnay8c81f622018-07-31 23:34:35 -07001073 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001074 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001075 }
1076 }
1077}
David Tolnay8c81f622018-07-31 23:34:35 -07001078#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001079pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001080 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001081 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001082 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001083 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001084 }
1085}
David Tolnay8c81f622018-07-31 23:34:35 -07001086#[cfg(any(feature = "full", feature = "derive"))]
1087#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001088pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001089 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001090 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001091 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001092 }
1093}
David Tolnay8c81f622018-07-31 23:34:35 -07001094#[cfg(any(feature = "full", feature = "derive"))]
1095pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1096 _visitor: &mut V,
1097 _i: BoundLifetimes,
1098) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001099 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001100 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1101 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001102 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001103 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001104 }
1105}
David Tolnay8c81f622018-07-31 23:34:35 -07001106#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001107pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001108 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001109 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001110 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001111 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001112 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001113 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001114 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001115 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001116 }
1117}
David Tolnay8c81f622018-07-31 23:34:35 -07001118#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001119pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001120 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001121 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1122 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1123 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001124 }
1125}
David Tolnay8c81f622018-07-31 23:34:35 -07001126#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001127pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001128 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001129 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1130 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001131 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001132 }
1133}
David Tolnay8c81f622018-07-31 23:34:35 -07001134#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001135pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001136 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001137 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001138 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001139 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001140 }
1141}
David Tolnay8c81f622018-07-31 23:34:35 -07001142#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001143pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001144 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001145 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001146 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001147 }
1148}
David Tolnay8c81f622018-07-31 23:34:35 -07001149#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001150pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001151 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001152 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1153 vis: _visitor.fold_visibility(_i.vis),
1154 ident: _visitor.fold_ident(_i.ident),
1155 generics: _visitor.fold_generics(_i.generics),
1156 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001157 }
1158}
David Tolnay8c81f622018-07-31 23:34:35 -07001159#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001160pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001161 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001162 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1163 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1164 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1165 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1166 Expr::MethodCall(_binding_0) => {
1167 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001168 }
David Tolnay8c81f622018-07-31 23:34:35 -07001169 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1170 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1171 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1172 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1173 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1174 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
1175 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
1176 Expr::IfLet(_binding_0) => Expr::IfLet(full!(_visitor.fold_expr_if_let(_binding_0))),
1177 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
1178 Expr::WhileLet(_binding_0) => {
1179 Expr::WhileLet(full!(_visitor.fold_expr_while_let(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001180 }
David Tolnay8c81f622018-07-31 23:34:35 -07001181 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1182 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1183 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1184 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1185 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1186 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1187 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1188 Expr::AssignOp(_binding_0) => {
1189 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001190 }
David Tolnay8c81f622018-07-31 23:34:35 -07001191 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1192 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1193 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1194 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1195 Expr::Reference(_binding_0) => {
1196 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001197 }
David Tolnay8c81f622018-07-31 23:34:35 -07001198 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1199 Expr::Continue(_binding_0) => {
1200 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001201 }
David Tolnay8c81f622018-07-31 23:34:35 -07001202 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1203 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1204 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1205 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1206 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1207 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1208 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
1209 Expr::Catch(_binding_0) => Expr::Catch(full!(_visitor.fold_expr_catch(_binding_0))),
1210 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1211 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001212 }
1213}
David Tolnay8c81f622018-07-31 23:34:35 -07001214#[cfg(feature = "full")]
1215#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001216pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001217 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001218 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001219 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001220 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001221 }
1222}
David Tolnay8c81f622018-07-31 23:34:35 -07001223#[cfg(feature = "full")]
1224#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001225pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001226 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001227 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1228 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001229 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001230 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001231 }
1232}
David Tolnay8c81f622018-07-31 23:34:35 -07001233#[cfg(feature = "full")]
1234#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001235pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001236 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001237 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1238 left: Box::new(_visitor.fold_expr(*_i.left)),
1239 op: _visitor.fold_bin_op(_i.op),
1240 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001241 }
1242}
David Tolnay8c81f622018-07-31 23:34:35 -07001243#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001244pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001245 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001246 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1247 left: Box::new(_visitor.fold_expr(*_i.left)),
1248 op: _visitor.fold_bin_op(_i.op),
1249 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001250 }
1251}
David Tolnay8c81f622018-07-31 23:34:35 -07001252#[cfg(feature = "full")]
1253#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001254pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001255 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001256 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1257 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001258 }
1259}
David Tolnay8c81f622018-07-31 23:34:35 -07001260#[cfg(feature = "full")]
1261#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001262pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001263 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001264 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001265 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001266 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001267 }
1268}
David Tolnay8c81f622018-07-31 23:34:35 -07001269#[cfg(feature = "full")]
1270#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001271pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001272 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001273 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001274 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001275 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1276 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001277 }
1278}
David Tolnay8c81f622018-07-31 23:34:35 -07001279#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001280pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001281 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001282 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1283 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001284 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001285 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001286 }
1287}
David Tolnay8c81f622018-07-31 23:34:35 -07001288#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001289pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001290 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001291 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1292 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001293 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001294 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001295 }
1296}
David Tolnay8c81f622018-07-31 23:34:35 -07001297#[cfg(feature = "full")]
1298#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001299pub fn fold_expr_catch<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCatch) -> ExprCatch {
David Tolnay8c91b882017-12-28 23:04:32 -05001300 ExprCatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001301 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001302 do_token: Token ! [ do ](tokens_helper(_visitor, &_i.do_token.span)),
1303 catch_token: Token![catch](tokens_helper(_visitor, &_i.catch_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001304 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001305 }
1306}
David Tolnay8c81f622018-07-31 23:34:35 -07001307#[cfg(feature = "full")]
1308#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001309pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001310 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001311 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001312 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1313 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1314 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001315 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001316 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001317 output: _visitor.fold_return_type(_i.output),
1318 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001319 }
1320}
David Tolnay8c81f622018-07-31 23:34:35 -07001321#[cfg(feature = "full")]
1322#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001323pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001324 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001325 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001326 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001327 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001328 }
1329}
David Tolnay8c81f622018-07-31 23:34:35 -07001330#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001331pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001332 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001333 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1334 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001335 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001336 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001337 }
1338}
David Tolnay8c81f622018-07-31 23:34:35 -07001339#[cfg(feature = "full")]
1340#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001341pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001342 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001343 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1344 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001345 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001346 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001347 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001348 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1349 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001350 }
1351}
David Tolnay8c81f622018-07-31 23:34:35 -07001352#[cfg(feature = "full")]
1353#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001354pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001355 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001356 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001357 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001358 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001359 }
1360}
David Tolnay8c81f622018-07-31 23:34:35 -07001361#[cfg(feature = "full")]
1362#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001363pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001364 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001365 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001366 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001367 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1368 then_branch: _visitor.fold_block(_i.then_branch),
1369 else_branch: (_i.else_branch).map(|it| {
1370 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001371 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001372 Box::new(_visitor.fold_expr(*(it).1)),
1373 )
1374 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001375 }
1376}
David Tolnay8c81f622018-07-31 23:34:35 -07001377#[cfg(feature = "full")]
1378#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001379pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001380 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001381 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001382 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
1383 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001384 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001385 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001386 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1387 then_branch: _visitor.fold_block(_i.then_branch),
1388 else_branch: (_i.else_branch).map(|it| {
1389 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001390 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001391 Box::new(_visitor.fold_expr(*(it).1)),
1392 )
1393 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001394 }
1395}
David Tolnay8c81f622018-07-31 23:34:35 -07001396#[cfg(feature = "full")]
1397#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001398pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001399 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001400 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1401 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001402 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001403 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001404 }
1405}
David Tolnay8c81f622018-07-31 23:34:35 -07001406#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001407pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001408 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001409 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1410 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001411 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001412 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001413 }
1414}
David Tolnay8c81f622018-07-31 23:34:35 -07001415#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001416pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001417 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001418 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1419 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001420 }
1421}
David Tolnay8c81f622018-07-31 23:34:35 -07001422#[cfg(feature = "full")]
1423#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001424pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001425 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001426 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1427 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001428 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001429 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001430 }
1431}
David Tolnay8c81f622018-07-31 23:34:35 -07001432#[cfg(feature = "full")]
1433#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001434pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001435 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001436 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1437 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001438 }
1439}
David Tolnay8c81f622018-07-31 23:34:35 -07001440#[cfg(feature = "full")]
1441#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001442pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001443 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001444 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001445 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001446 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001447 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001448 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001449 }
1450}
David Tolnay8c81f622018-07-31 23:34:35 -07001451#[cfg(feature = "full")]
1452#[cfg(any(feature = "full", feature = "derive"))]
1453pub fn fold_expr_method_call<V: Fold + ?Sized>(
1454 _visitor: &mut V,
1455 _i: ExprMethodCall,
1456) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001457 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001458 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1459 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001460 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001461 method: _visitor.fold_ident(_i.method),
1462 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001463 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001464 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001465 }
1466}
David Tolnay8c81f622018-07-31 23:34:35 -07001467#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001468pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001469 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001470 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001471 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001472 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001473 }
1474}
David Tolnay8c81f622018-07-31 23:34:35 -07001475#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001476pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001477 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001478 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1479 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1480 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001481 }
1482}
David Tolnay8c81f622018-07-31 23:34:35 -07001483#[cfg(feature = "full")]
1484#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001485pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001486 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001487 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1488 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1489 limits: _visitor.fold_range_limits(_i.limits),
1490 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001491 }
1492}
David Tolnay8c81f622018-07-31 23:34:35 -07001493#[cfg(feature = "full")]
1494#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001495pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1496 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001497 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001498 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1499 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001500 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001501 }
1502}
David Tolnay8c81f622018-07-31 23:34:35 -07001503#[cfg(feature = "full")]
1504#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001505pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001506 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001507 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001508 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001509 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001510 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001511 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001512 }
1513}
David Tolnay8c81f622018-07-31 23:34:35 -07001514#[cfg(feature = "full")]
1515#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001516pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001517 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001518 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001519 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001520 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001521 }
1522}
David Tolnay8c81f622018-07-31 23:34:35 -07001523#[cfg(feature = "full")]
1524#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001525pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001526 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001527 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1528 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001529 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001530 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001531 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001532 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001533 }
1534}
David Tolnay8c81f622018-07-31 23:34:35 -07001535#[cfg(feature = "full")]
1536#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001537pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001538 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001539 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1540 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001541 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001542 }
1543}
David Tolnay8c81f622018-07-31 23:34:35 -07001544#[cfg(feature = "full")]
1545#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001546pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001547 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001548 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001549 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001550 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001551 }
1552}
David Tolnay8c81f622018-07-31 23:34:35 -07001553#[cfg(feature = "full")]
1554#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001555pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001556 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001557 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1558 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001559 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001560 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001561 }
1562}
David Tolnay8c81f622018-07-31 23:34:35 -07001563#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001564pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001565 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001566 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1567 op: _visitor.fold_un_op(_i.op),
1568 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001569 }
1570}
David Tolnay8c81f622018-07-31 23:34:35 -07001571#[cfg(feature = "full")]
1572#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001573pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001574 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001575 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001576 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001577 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001578 }
1579}
David Tolnay8c81f622018-07-31 23:34:35 -07001580#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001581pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001582 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001583}
David Tolnay8c81f622018-07-31 23:34:35 -07001584#[cfg(feature = "full")]
1585#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001586pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001587 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001588 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1589 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001590 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001591 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1592 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001593 }
1594}
David Tolnay8c81f622018-07-31 23:34:35 -07001595#[cfg(feature = "full")]
1596#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001597pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001598 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001599 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1600 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001601 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
1602 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001603 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001604 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001605 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1606 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001607 }
1608}
David Tolnay8c81f622018-07-31 23:34:35 -07001609#[cfg(feature = "full")]
1610#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001611pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001612 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001613 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001614 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001615 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001616 }
1617}
David Tolnay8c81f622018-07-31 23:34:35 -07001618#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001619pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001620 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001621 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1622 vis: _visitor.fold_visibility(_i.vis),
1623 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001624 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001625 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001626 }
1627}
David Tolnay8c81f622018-07-31 23:34:35 -07001628#[cfg(any(feature = "full", feature = "derive"))]
1629#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001630pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001631 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001632 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1633 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001634 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001635 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001636 }
1637}
David Tolnay8c81f622018-07-31 23:34:35 -07001638#[cfg(any(feature = "full", feature = "derive"))]
1639#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001640pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001641 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001642 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1643 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001644 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001645 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001646 }
1647}
David Tolnay8c81f622018-07-31 23:34:35 -07001648#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001649pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001650 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001651 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1652 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1653 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001654 }
1655}
David Tolnay8c81f622018-07-31 23:34:35 -07001656#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001657pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001658 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001659 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001660 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001661 }
1662}
David Tolnay8c81f622018-07-31 23:34:35 -07001663#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001664pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001665 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001666 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001667 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001668 }
1669}
David Tolnay8c81f622018-07-31 23:34:35 -07001670#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001671pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001672 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001673 shebang: _i.shebang,
1674 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1675 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001676 }
1677}
David Tolnay8c81f622018-07-31 23:34:35 -07001678#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001679pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001680 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001681 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1682 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1683 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1684 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1685 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001686 }
1687}
David Tolnay8c81f622018-07-31 23:34:35 -07001688#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001689pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001690 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001691 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001692 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001693 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001694 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001695 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001696 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001697 }
1698}
David Tolnay8c81f622018-07-31 23:34:35 -07001699#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001700pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001701 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001702 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1703 ForeignItem::Static(_binding_0) => {
1704 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001705 }
David Tolnay8c81f622018-07-31 23:34:35 -07001706 ForeignItem::Type(_binding_0) => {
1707 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001708 }
David Tolnay435c1782018-08-24 16:15:44 -04001709 ForeignItem::Macro(_binding_0) => {
1710 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1711 }
David Tolnay8c81f622018-07-31 23:34:35 -07001712 ForeignItem::Verbatim(_binding_0) => {
1713 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001714 }
Nika Layzell27726662017-10-24 23:16:35 -04001715 }
1716}
David Tolnay8c81f622018-07-31 23:34:35 -07001717#[cfg(feature = "full")]
1718pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1719 _visitor: &mut V,
1720 _i: ForeignItemFn,
1721) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001722 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001723 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1724 vis: _visitor.fold_visibility(_i.vis),
1725 ident: _visitor.fold_ident(_i.ident),
1726 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001727 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001728 }
1729}
David Tolnay8c81f622018-07-31 23:34:35 -07001730#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001731pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1732 _visitor: &mut V,
1733 _i: ForeignItemMacro,
1734) -> ForeignItemMacro {
1735 ForeignItemMacro {
1736 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1737 mac: _visitor.fold_macro(_i.mac),
1738 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1739 }
1740}
1741#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001742pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1743 _visitor: &mut V,
1744 _i: ForeignItemStatic,
1745) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001746 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001747 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1748 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001749 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1750 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001751 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001752 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001753 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001754 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001755 }
1756}
David Tolnay8c81f622018-07-31 23:34:35 -07001757#[cfg(feature = "full")]
1758pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1759 _visitor: &mut V,
1760 _i: ForeignItemType,
1761) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001762 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001763 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1764 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001765 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001766 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001767 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001768 }
1769}
David Tolnay8c81f622018-07-31 23:34:35 -07001770#[cfg(feature = "full")]
1771pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1772 _visitor: &mut V,
1773 _i: ForeignItemVerbatim,
1774) -> ForeignItemVerbatim {
1775 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001776}
David Tolnay8c81f622018-07-31 23:34:35 -07001777#[cfg(any(feature = "full", feature = "derive"))]
1778pub fn fold_generic_argument<V: Fold + ?Sized>(
1779 _visitor: &mut V,
1780 _i: GenericArgument,
1781) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001782 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001783 GenericArgument::Lifetime(_binding_0) => {
1784 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001785 }
David Tolnay8c81f622018-07-31 23:34:35 -07001786 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1787 GenericArgument::Binding(_binding_0) => {
1788 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001789 }
David Tolnay8c81f622018-07-31 23:34:35 -07001790 GenericArgument::Const(_binding_0) => {
1791 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001792 }
Nika Layzell357885a2017-12-04 15:47:07 -05001793 }
1794}
David Tolnay8c81f622018-07-31 23:34:35 -07001795#[cfg(any(feature = "full", feature = "derive"))]
1796#[cfg(feature = "full")]
1797pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1798 _visitor: &mut V,
1799 _i: GenericMethodArgument,
1800) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001801 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001802 GenericMethodArgument::Type(_binding_0) => {
1803 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001804 }
David Tolnay8c81f622018-07-31 23:34:35 -07001805 GenericMethodArgument::Const(_binding_0) => {
1806 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001807 }
1808 }
1809}
David Tolnay8c81f622018-07-31 23:34:35 -07001810#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001811pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001812 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001813 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1814 GenericParam::Lifetime(_binding_0) => {
1815 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001816 }
David Tolnay8c81f622018-07-31 23:34:35 -07001817 GenericParam::Const(_binding_0) => {
1818 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001819 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001820 }
1821}
David Tolnay8c81f622018-07-31 23:34:35 -07001822#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001823pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001824 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001825 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001826 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001827 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001828 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001829 }
1830}
Alex Crichtond261d092018-05-18 13:47:35 -07001831pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001832 let mut _i = _i;
1833 let span = _visitor.fold_span(_i.span());
1834 _i.set_span(span);
1835 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001836}
David Tolnay8c81f622018-07-31 23:34:35 -07001837#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001838pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001839 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001840 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1841 ImplItem::Method(_binding_0) => {
1842 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001843 }
David Tolnay8c81f622018-07-31 23:34:35 -07001844 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
1845 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1846 ImplItem::Verbatim(_binding_0) => {
1847 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001848 }
Nika Layzell27726662017-10-24 23:16:35 -04001849 }
1850}
David Tolnay8c81f622018-07-31 23:34:35 -07001851#[cfg(feature = "full")]
1852pub fn fold_impl_item_const<V: Fold + ?Sized>(
1853 _visitor: &mut V,
1854 _i: ImplItemConst,
1855) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001856 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001857 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1858 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001859 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1860 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001861 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001862 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001863 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001864 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001865 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001866 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001867 }
1868}
David Tolnay8c81f622018-07-31 23:34:35 -07001869#[cfg(feature = "full")]
1870pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1871 _visitor: &mut V,
1872 _i: ImplItemMacro,
1873) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001874 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001875 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1876 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001877 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001878 }
1879}
David Tolnay8c81f622018-07-31 23:34:35 -07001880#[cfg(feature = "full")]
1881pub fn fold_impl_item_method<V: Fold + ?Sized>(
1882 _visitor: &mut V,
1883 _i: ImplItemMethod,
1884) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001885 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001886 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1887 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001888 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001889 sig: _visitor.fold_method_sig(_i.sig),
1890 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001891 }
1892}
David Tolnay8c81f622018-07-31 23:34:35 -07001893#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001894pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001895 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001896 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1897 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001898 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1899 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001900 ident: _visitor.fold_ident(_i.ident),
1901 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001902 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001903 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001904 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001905 }
1906}
David Tolnay8c81f622018-07-31 23:34:35 -07001907#[cfg(feature = "full")]
1908pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1909 _visitor: &mut V,
1910 _i: ImplItemVerbatim,
1911) -> ImplItemVerbatim {
1912 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001913}
David Tolnay8c81f622018-07-31 23:34:35 -07001914#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001915pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001916 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001917 index: _i.index,
1918 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001919 }
1920}
David Tolnay8c81f622018-07-31 23:34:35 -07001921#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001922pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001923 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001924 Item::ExternCrate(_binding_0) => {
1925 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001926 }
David Tolnay8c81f622018-07-31 23:34:35 -07001927 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1928 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1929 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1930 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1931 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1932 Item::ForeignMod(_binding_0) => {
1933 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001934 }
David Tolnay8c81f622018-07-31 23:34:35 -07001935 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
1936 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1937 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1938 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1939 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
1940 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1941 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1942 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1943 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001944 }
1945}
David Tolnay8c81f622018-07-31 23:34:35 -07001946#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001947pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001948 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001949 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1950 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001951 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001952 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001953 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001954 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001955 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001956 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001957 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001958 }
1959}
David Tolnay8c81f622018-07-31 23:34:35 -07001960#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001961pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001962 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001963 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1964 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001965 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001966 ident: _visitor.fold_ident(_i.ident),
1967 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001968 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001969 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001970 }
1971}
David Tolnay8c81f622018-07-31 23:34:35 -07001972#[cfg(feature = "full")]
1973pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1974 _visitor: &mut V,
1975 _i: ItemExternCrate,
1976) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001977 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001978 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1979 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001980 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
1981 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001982 ident: _visitor.fold_ident(_i.ident),
1983 rename: (_i.rename).map(|it| {
1984 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001985 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001986 _visitor.fold_ident((it).1),
1987 )
1988 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04001989 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001990 }
1991}
David Tolnay8c81f622018-07-31 23:34:35 -07001992#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001993pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001994 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001995 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1996 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001997 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
1998 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001999 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2000 ident: _visitor.fold_ident(_i.ident),
2001 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2002 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002003 }
2004}
David Tolnay8c81f622018-07-31 23:34:35 -07002005#[cfg(feature = "full")]
2006pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2007 _visitor: &mut V,
2008 _i: ItemForeignMod,
2009) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002010 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002011 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2012 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002013 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002014 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002015 }
2016}
David Tolnay8c81f622018-07-31 23:34:35 -07002017#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002018pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002019 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002020 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002021 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2022 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2023 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002024 generics: _visitor.fold_generics(_i.generics),
2025 trait_: (_i.trait_).map(|it| {
2026 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002027 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002028 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002029 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002030 )
2031 }),
2032 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002033 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002034 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002035 }
2036}
David Tolnay8c81f622018-07-31 23:34:35 -07002037#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002038pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002039 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002040 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2041 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2042 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002043 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002044 }
2045}
David Tolnay8c81f622018-07-31 23:34:35 -07002046#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002047pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002048 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002049 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2050 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002051 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002052 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002053 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002054 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002055 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002056 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002057 }
2058}
David Tolnay8c81f622018-07-31 23:34:35 -07002059#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002060pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002061 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002062 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2063 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002064 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002065 ident: _visitor.fold_ident(_i.ident),
2066 content: (_i.content).map(|it| {
2067 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002068 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002069 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2070 )
2071 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002072 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002073 }
2074}
David Tolnay8c81f622018-07-31 23:34:35 -07002075#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002076pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002077 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002078 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2079 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002080 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2081 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002082 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002083 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002084 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002085 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002086 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002087 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002088 }
2089}
David Tolnay8c81f622018-07-31 23:34:35 -07002090#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002091pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002092 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002093 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2094 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002095 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002096 ident: _visitor.fold_ident(_i.ident),
2097 generics: _visitor.fold_generics(_i.generics),
2098 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002099 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002100 }
2101}
David Tolnay8c81f622018-07-31 23:34:35 -07002102#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002103pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002104 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002105 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2106 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002107 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2108 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2109 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002110 ident: _visitor.fold_ident(_i.ident),
2111 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002112 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002113 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002114 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002115 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002116 }
2117}
David Tolnay8c81f622018-07-31 23:34:35 -07002118#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002119pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002120 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002121 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2122 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002123 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002124 ident: _visitor.fold_ident(_i.ident),
2125 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002126 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002127 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002128 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002129 }
2130}
David Tolnay8c81f622018-07-31 23:34:35 -07002131#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002132pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002133 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002134 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2135 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002136 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002137 ident: _visitor.fold_ident(_i.ident),
2138 generics: _visitor.fold_generics(_i.generics),
2139 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002140 }
2141}
David Tolnay8c81f622018-07-31 23:34:35 -07002142#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002143pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002144 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002145 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2146 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002147 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002148 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002149 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002150 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002151 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002152 }
2153}
David Tolnay8c81f622018-07-31 23:34:35 -07002154#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002155pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002156 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002157}
David Tolnay8c81f622018-07-31 23:34:35 -07002158#[cfg(any(feature = "full", feature = "derive"))]
2159#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002160pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002161 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002162 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002163 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002164 }
2165}
David Tolnay8c81f622018-07-31 23:34:35 -07002166#[cfg(any(feature = "full", feature = "derive"))]
Alex Crichton131308c2018-05-18 14:00:24 -07002167pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2168 Lifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002169 apostrophe: _i.apostrophe,
2170 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002171 }
2172}
David Tolnay8c81f622018-07-31 23:34:35 -07002173#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002174pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002175 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002176 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2177 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002178 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002179 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002180 }
2181}
David Tolnay8c81f622018-07-31 23:34:35 -07002182#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002183pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002184 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002185 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2186 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2187 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2188 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2189 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2190 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2191 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2192 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002193 }
2194}
David Tolnay8c81f622018-07-31 23:34:35 -07002195#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002196pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002197 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002198 value: _i.value,
2199 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002200 }
2201}
David Tolnay8c81f622018-07-31 23:34:35 -07002202#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002203pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002204 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002205}
David Tolnay8c81f622018-07-31 23:34:35 -07002206#[cfg(any(feature = "full", feature = "derive"))]
2207#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002208pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002209 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002210 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002211 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002212 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2213 ty: (_i.ty).map(|it| {
2214 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002215 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002216 Box::new(_visitor.fold_type(*(it).1)),
2217 )
2218 }),
2219 init: (_i.init).map(|it| {
2220 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002221 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002222 Box::new(_visitor.fold_expr(*(it).1)),
2223 )
2224 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002225 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002226 }
2227}
David Tolnay8c81f622018-07-31 23:34:35 -07002228#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002229pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002230 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002231 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002232 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002233 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2234 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002235 }
2236}
David Tolnay8c81f622018-07-31 23:34:35 -07002237#[cfg(any(feature = "full", feature = "derive"))]
2238pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2239 _visitor: &mut V,
2240 _i: MacroDelimiter,
2241) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002242 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002243 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002244 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002245 }
David Tolnay8c81f622018-07-31 23:34:35 -07002246 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002247 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002248 }
David Tolnay8c81f622018-07-31 23:34:35 -07002249 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002250 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002251 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002252 }
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_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002256 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002257 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2258 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002259 }
2260}
David Tolnay8c81f622018-07-31 23:34:35 -07002261#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002262pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002263 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002264 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2265 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2266 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002267 }
2268}
David Tolnay8c81f622018-07-31 23:34:35 -07002269#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002270pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2271 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002272 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002273 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002274 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002275 }
2276}
David Tolnay8c81f622018-07-31 23:34:35 -07002277#[cfg(any(feature = "full", feature = "derive"))]
2278pub fn fold_meta_name_value<V: Fold + ?Sized>(
2279 _visitor: &mut V,
2280 _i: MetaNameValue,
2281) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002282 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002283 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002284 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002285 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002286 }
2287}
David Tolnay8c81f622018-07-31 23:34:35 -07002288#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002289pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002290 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002291 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2292 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002293 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2294 ident: _visitor.fold_ident(_i.ident),
2295 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002296 }
2297}
David Tolnay8c81f622018-07-31 23:34:35 -07002298#[cfg(any(feature = "full", feature = "derive"))]
2299#[cfg(feature = "full")]
2300pub fn fold_method_turbofish<V: Fold + ?Sized>(
2301 _visitor: &mut V,
2302 _i: MethodTurbofish,
2303) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002304 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002305 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2306 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002307 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002308 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002309 }
2310}
David Tolnay8c81f622018-07-31 23:34:35 -07002311#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002312pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002313 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002314 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2315 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002316 }
2317}
David Tolnay8c81f622018-07-31 23:34:35 -07002318#[cfg(any(feature = "full", feature = "derive"))]
2319pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2320 _visitor: &mut V,
2321 _i: ParenthesizedGenericArguments,
2322) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002323 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002324 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002325 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2326 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002327 }
2328}
David Tolnay8c81f622018-07-31 23:34:35 -07002329#[cfg(any(feature = "full", feature = "derive"))]
2330#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002331pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002332 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002333 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2334 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2335 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2336 Pat::TupleStruct(_binding_0) => {
2337 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002338 }
David Tolnay8c81f622018-07-31 23:34:35 -07002339 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2340 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2341 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2342 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2343 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2344 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2345 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2346 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2347 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002348 }
2349}
David Tolnay8c81f622018-07-31 23:34:35 -07002350#[cfg(any(feature = "full", feature = "derive"))]
2351#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002352pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002353 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002354 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002355 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002356 }
2357}
David Tolnay8c81f622018-07-31 23:34:35 -07002358#[cfg(any(feature = "full", feature = "derive"))]
2359#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002360pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002361 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002362 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2363 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002364 ident: _visitor.fold_ident(_i.ident),
2365 subpat: (_i.subpat).map(|it| {
2366 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002367 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002368 Box::new(_visitor.fold_pat(*(it).1)),
2369 )
2370 }),
Nika Layzell27726662017-10-24 23:16:35 -04002371 }
2372}
David Tolnay8c81f622018-07-31 23:34:35 -07002373#[cfg(any(feature = "full", feature = "derive"))]
2374#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002375pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002376 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002377 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002378 }
2379}
David Tolnay8c81f622018-07-31 23:34:35 -07002380#[cfg(any(feature = "full", feature = "derive"))]
2381#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002382pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002383 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002384 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002385 }
2386}
David Tolnay8c81f622018-07-31 23:34:35 -07002387#[cfg(any(feature = "full", feature = "derive"))]
2388#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002389pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002390 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002391 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2392 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002393 }
2394}
David Tolnay8c81f622018-07-31 23:34:35 -07002395#[cfg(any(feature = "full", feature = "derive"))]
2396#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002397pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002398 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002399 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2400 limits: _visitor.fold_range_limits(_i.limits),
2401 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002402 }
2403}
David Tolnay8c81f622018-07-31 23:34:35 -07002404#[cfg(any(feature = "full", feature = "derive"))]
2405#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002406pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002407 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002408 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2409 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002410 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002411 }
2412}
David Tolnay8c81f622018-07-31 23:34:35 -07002413#[cfg(any(feature = "full", feature = "derive"))]
2414#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002415pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002416 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002417 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002418 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2419 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002420 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2421 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002422 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002423 }
2424}
David Tolnay8c81f622018-07-31 23:34:35 -07002425#[cfg(any(feature = "full", feature = "derive"))]
2426#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002427pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002428 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002429 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002430 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002431 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002432 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002433 }
2434}
David Tolnay8c81f622018-07-31 23:34:35 -07002435#[cfg(any(feature = "full", feature = "derive"))]
2436#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002437pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002438 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002439 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002440 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002441 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2442 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002443 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
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")]
2448pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2449 _visitor: &mut V,
2450 _i: PatTupleStruct,
2451) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002452 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002453 path: _visitor.fold_path(_i.path),
2454 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002455 }
2456}
David Tolnay8c81f622018-07-31 23:34:35 -07002457#[cfg(any(feature = "full", feature = "derive"))]
2458#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002459pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002460 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002461}
David Tolnay8c81f622018-07-31 23:34:35 -07002462#[cfg(any(feature = "full", feature = "derive"))]
2463#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002464pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002465 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002466 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002467 }
2468}
David Tolnay8c81f622018-07-31 23:34:35 -07002469#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002470pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002471 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002472 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002473 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002474 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002475 }
2476}
David Tolnay8c81f622018-07-31 23:34:35 -07002477#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002478pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002479 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002480 PathArguments::None => PathArguments::None,
2481 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2482 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2483 ),
2484 PathArguments::Parenthesized(_binding_0) => {
2485 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002486 }
2487 }
2488}
David Tolnay8c81f622018-07-31 23:34:35 -07002489#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002490pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002491 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002492 ident: _visitor.fold_ident(_i.ident),
2493 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002494 }
2495}
David Tolnay8c81f622018-07-31 23:34:35 -07002496#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002497pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002498 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002499 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002500 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002501 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002502 }
2503}
David Tolnay8c81f622018-07-31 23:34:35 -07002504#[cfg(any(feature = "full", feature = "derive"))]
2505pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2506 _visitor: &mut V,
2507 _i: PredicateLifetime,
2508) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002509 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002510 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002511 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002512 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002513 }
2514}
David Tolnay8c81f622018-07-31 23:34:35 -07002515#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002516pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002517 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002518 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2519 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002520 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002521 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002522 }
2523}
David Tolnay8c81f622018-07-31 23:34:35 -07002524#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002525pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002526 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002527 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002528 ty: Box::new(_visitor.fold_type(*_i.ty)),
2529 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002530 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2531 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002532 }
2533}
David Tolnay8c81f622018-07-31 23:34:35 -07002534#[cfg(any(feature = "full", feature = "derive"))]
2535#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002536pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002537 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002538 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002539 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002540 }
David Tolnay8c81f622018-07-31 23:34:35 -07002541 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002542 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002543 }
2544 }
2545}
David Tolnay8c81f622018-07-31 23:34:35 -07002546#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002547pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002548 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002549 ReturnType::Default => ReturnType::Default,
2550 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002551 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002552 Box::new(_visitor.fold_type(*_binding_1)),
2553 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002554 }
2555}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002556pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002557 _i
2558}
David Tolnay8c81f622018-07-31 23:34:35 -07002559#[cfg(any(feature = "full", feature = "derive"))]
2560#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002561pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002562 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002563 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2564 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2565 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2566 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2567 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002568 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002569 ),
Nika Layzell27726662017-10-24 23:16:35 -04002570 }
2571}
David Tolnay8c81f622018-07-31 23:34:35 -07002572#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002573pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002574 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002575 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002576 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2577 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2578 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002579 }
2580}
David Tolnay8c81f622018-07-31 23:34:35 -07002581#[cfg(any(feature = "full", feature = "derive"))]
2582pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2583 _visitor: &mut V,
2584 _i: TraitBoundModifier,
2585) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002586 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002587 TraitBoundModifier::None => TraitBoundModifier::None,
2588 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002589 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002590 }
2591 }
2592}
David Tolnay8c81f622018-07-31 23:34:35 -07002593#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002594pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002595 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002596 TraitItem::Const(_binding_0) => {
2597 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002598 }
David Tolnay8c81f622018-07-31 23:34:35 -07002599 TraitItem::Method(_binding_0) => {
2600 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002601 }
David Tolnay8c81f622018-07-31 23:34:35 -07002602 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2603 TraitItem::Macro(_binding_0) => {
2604 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002605 }
David Tolnay8c81f622018-07-31 23:34:35 -07002606 TraitItem::Verbatim(_binding_0) => {
2607 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002608 }
Nika Layzell27726662017-10-24 23:16:35 -04002609 }
2610}
David Tolnay8c81f622018-07-31 23:34:35 -07002611#[cfg(feature = "full")]
2612pub fn fold_trait_item_const<V: Fold + ?Sized>(
2613 _visitor: &mut V,
2614 _i: TraitItemConst,
2615) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002616 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002617 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002618 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002619 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002620 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002621 ty: _visitor.fold_type(_i.ty),
2622 default: (_i.default).map(|it| {
2623 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002624 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002625 _visitor.fold_expr((it).1),
2626 )
2627 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002628 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002629 }
2630}
David Tolnay8c81f622018-07-31 23:34:35 -07002631#[cfg(feature = "full")]
2632pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2633 _visitor: &mut V,
2634 _i: TraitItemMacro,
2635) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002636 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002637 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2638 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002639 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002640 }
2641}
David Tolnay8c81f622018-07-31 23:34:35 -07002642#[cfg(feature = "full")]
2643pub fn fold_trait_item_method<V: Fold + ?Sized>(
2644 _visitor: &mut V,
2645 _i: TraitItemMethod,
2646) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002647 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002648 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2649 sig: _visitor.fold_method_sig(_i.sig),
2650 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002651 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002652 }
2653}
David Tolnay8c81f622018-07-31 23:34:35 -07002654#[cfg(feature = "full")]
2655pub fn fold_trait_item_type<V: Fold + ?Sized>(
2656 _visitor: &mut V,
2657 _i: TraitItemType,
2658) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002659 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002660 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002661 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002662 ident: _visitor.fold_ident(_i.ident),
2663 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002664 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002665 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2666 default: (_i.default).map(|it| {
2667 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002668 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002669 _visitor.fold_type((it).1),
2670 )
2671 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002672 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002673 }
2674}
David Tolnay8c81f622018-07-31 23:34:35 -07002675#[cfg(feature = "full")]
2676pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2677 _visitor: &mut V,
2678 _i: TraitItemVerbatim,
2679) -> TraitItemVerbatim {
2680 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002681}
David Tolnay8c81f622018-07-31 23:34:35 -07002682#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002683pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002684 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002685 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2686 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2687 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2688 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2689 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2690 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2691 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2692 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2693 Type::TraitObject(_binding_0) => {
2694 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002695 }
David Tolnay8c81f622018-07-31 23:34:35 -07002696 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2697 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2698 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2699 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2700 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2701 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002702 }
2703}
David Tolnay8c81f622018-07-31 23:34:35 -07002704#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002705pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002706 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002707 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002708 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002709 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002710 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002711 }
2712}
David Tolnay8c81f622018-07-31 23:34:35 -07002713#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002714pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002715 TypeBareFn {
David Tolnay7ac699c2018-08-24 14:00:58 -04002716 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002717 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002718 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002719 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002720 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002721 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002722 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002723 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002724 }
2725}
David Tolnay8c81f622018-07-31 23:34:35 -07002726#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002727pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002728 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002729 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002730 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002731 }
2732}
David Tolnay8c81f622018-07-31 23:34:35 -07002733#[cfg(any(feature = "full", feature = "derive"))]
2734pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2735 _visitor: &mut V,
2736 _i: TypeImplTrait,
2737) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002738 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002739 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002740 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002741 }
2742}
David Tolnay8c81f622018-07-31 23:34:35 -07002743#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002744pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002745 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002746 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002747 }
2748}
David Tolnay8c81f622018-07-31 23:34:35 -07002749#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002750pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002751 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002752 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002753 }
2754}
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_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002757 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002758 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002759 }
2760}
David Tolnay8c81f622018-07-31 23:34:35 -07002761#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002762pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002763 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002764 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2765 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002766 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002767 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002768 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002769 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002770 }
2771}
David Tolnay8c81f622018-07-31 23:34:35 -07002772#[cfg(any(feature = "full", feature = "derive"))]
2773pub fn fold_type_param_bound<V: Fold + ?Sized>(
2774 _visitor: &mut V,
2775 _i: TypeParamBound,
2776) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002777 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002778 TypeParamBound::Trait(_binding_0) => {
2779 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002780 }
David Tolnay8c81f622018-07-31 23:34:35 -07002781 TypeParamBound::Lifetime(_binding_0) => {
2782 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002783 }
2784 }
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_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002788 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002789 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002790 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002791 }
2792}
David Tolnay8c81f622018-07-31 23:34:35 -07002793#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002794pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002795 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002796 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2797 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002798 }
2799}
David Tolnay8c81f622018-07-31 23:34:35 -07002800#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002801pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002802 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002803 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2804 const_token: (_i.const_token)
2805 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2806 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002807 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002808 }
2809}
David Tolnay8c81f622018-07-31 23:34:35 -07002810#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002811pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002812 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002813 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002814 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002815 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002816 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002817 }
2818}
David Tolnay8c81f622018-07-31 23:34:35 -07002819#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002820pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002821 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002822 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002823 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002824 }
2825}
David Tolnay8c81f622018-07-31 23:34:35 -07002826#[cfg(any(feature = "full", feature = "derive"))]
2827pub fn fold_type_trait_object<V: Fold + ?Sized>(
2828 _visitor: &mut V,
2829 _i: TypeTraitObject,
2830) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002831 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002832 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002833 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002834 }
2835}
David Tolnay8c81f622018-07-31 23:34:35 -07002836#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002837pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002838 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002839 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002840 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002841 }
2842}
David Tolnay8c81f622018-07-31 23:34:35 -07002843#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002844pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002845 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002846}
David Tolnay8c81f622018-07-31 23:34:35 -07002847#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002848pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002849 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002850 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002851 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002852 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002853 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2854 UnOp::Neg(_binding_0) => {
2855 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2856 }
Nika Layzell27726662017-10-24 23:16:35 -04002857 }
2858}
David Tolnay8c81f622018-07-31 23:34:35 -07002859#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002860pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002861 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002862 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002863 }
2864}
David Tolnay8c81f622018-07-31 23:34:35 -07002865#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002866pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2867 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002868 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002869 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002870 }
2871}
David Tolnay8c81f622018-07-31 23:34:35 -07002872#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002873pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2874 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002875 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002876 }
2877}
David Tolnay8c81f622018-07-31 23:34:35 -07002878#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002879pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002880 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002881 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002882 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002883 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002884 }
2885}
David Tolnay8c81f622018-07-31 23:34:35 -07002886#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002887pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2888 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002889 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002890 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002891 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002892 }
2893}
David Tolnay8c81f622018-07-31 23:34:35 -07002894#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002895pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002896 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002897 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2898 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2899 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2900 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2901 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002902 }
2903}
David Tolnay8c81f622018-07-31 23:34:35 -07002904#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002905pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002906 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002907 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2908 ident: _visitor.fold_ident(_i.ident),
2909 fields: _visitor.fold_fields(_i.fields),
2910 discriminant: (_i.discriminant).map(|it| {
2911 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002912 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002913 _visitor.fold_expr((it).1),
2914 )
2915 }),
Nika Layzell27726662017-10-24 23:16:35 -04002916 }
2917}
David Tolnay8c81f622018-07-31 23:34:35 -07002918#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002919pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002920 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002921 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002922 }
2923}
David Tolnay8c81f622018-07-31 23:34:35 -07002924#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002925pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002926 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04002927 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002928 }
2929}
David Tolnay8c81f622018-07-31 23:34:35 -07002930#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002931pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002932 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04002933 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
2934 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
2935 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002936 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002937 }
2938}
David Tolnay8c81f622018-07-31 23:34:35 -07002939#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002940pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002941 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002942 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2943 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2944 Visibility::Restricted(_binding_0) => {
2945 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002946 }
David Tolnay8c81f622018-07-31 23:34:35 -07002947 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04002948 }
2949}
David Tolnay8c81f622018-07-31 23:34:35 -07002950#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002951pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002952 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04002953 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002954 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002955 }
2956}
David Tolnay8c81f622018-07-31 23:34:35 -07002957#[cfg(any(feature = "full", feature = "derive"))]
2958pub fn fold_where_predicate<V: Fold + ?Sized>(
2959 _visitor: &mut V,
2960 _i: WherePredicate,
2961) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002962 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002963 WherePredicate::Type(_binding_0) => {
2964 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002965 }
David Tolnay8c81f622018-07-31 23:34:35 -07002966 WherePredicate::Lifetime(_binding_0) => {
2967 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002968 }
David Tolnay8c81f622018-07-31 23:34:35 -07002969 WherePredicate::Eq(_binding_0) => {
2970 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002971 }
2972 }
2973}