blob: 8bfa9fe6437f39a30f7eb69a52c8b1fc5543948b [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 }
David Tolnay02a9c6f2018-08-24 18:58:45 -0400135 #[cfg(feature = "full")]
136 #[cfg(any(feature = "full", feature = "derive"))]
137 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
138 fold_expr_async(self, i)
139 }
David Tolnay8c81f622018-07-31 23:34:35 -0700140 #[cfg(any(feature = "full", feature = "derive"))]
141 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
142 fold_expr_binary(self, i)
143 }
144 #[cfg(feature = "full")]
145 #[cfg(any(feature = "full", feature = "derive"))]
146 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
147 fold_expr_block(self, i)
148 }
149 #[cfg(feature = "full")]
150 #[cfg(any(feature = "full", feature = "derive"))]
151 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
152 fold_expr_box(self, i)
153 }
154 #[cfg(feature = "full")]
155 #[cfg(any(feature = "full", feature = "derive"))]
156 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
157 fold_expr_break(self, i)
158 }
159 #[cfg(any(feature = "full", feature = "derive"))]
160 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
161 fold_expr_call(self, i)
162 }
163 #[cfg(any(feature = "full", feature = "derive"))]
164 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
165 fold_expr_cast(self, i)
166 }
167 #[cfg(feature = "full")]
168 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700169 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"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -0400274 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
275 fold_expr_try_block(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700279 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
280 fold_expr_tuple(self, i)
281 }
282 #[cfg(feature = "full")]
283 #[cfg(any(feature = "full", feature = "derive"))]
284 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
285 fold_expr_type(self, i)
286 }
287 #[cfg(any(feature = "full", feature = "derive"))]
288 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
289 fold_expr_unary(self, i)
290 }
291 #[cfg(feature = "full")]
292 #[cfg(any(feature = "full", feature = "derive"))]
293 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
294 fold_expr_unsafe(self, i)
295 }
296 #[cfg(any(feature = "full", feature = "derive"))]
297 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
298 fold_expr_verbatim(self, i)
299 }
300 #[cfg(feature = "full")]
301 #[cfg(any(feature = "full", feature = "derive"))]
302 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
303 fold_expr_while(self, i)
304 }
305 #[cfg(feature = "full")]
306 #[cfg(any(feature = "full", feature = "derive"))]
307 fn fold_expr_while_let(&mut self, i: ExprWhileLet) -> ExprWhileLet {
308 fold_expr_while_let(self, i)
309 }
310 #[cfg(feature = "full")]
311 #[cfg(any(feature = "full", feature = "derive"))]
312 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
313 fold_expr_yield(self, i)
314 }
315 #[cfg(any(feature = "full", feature = "derive"))]
316 fn fold_field(&mut self, i: Field) -> Field {
317 fold_field(self, i)
318 }
319 #[cfg(any(feature = "full", feature = "derive"))]
320 #[cfg(feature = "full")]
321 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
322 fold_field_pat(self, i)
323 }
324 #[cfg(any(feature = "full", feature = "derive"))]
325 #[cfg(feature = "full")]
326 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
327 fold_field_value(self, i)
328 }
329 #[cfg(any(feature = "full", feature = "derive"))]
330 fn fold_fields(&mut self, i: Fields) -> Fields {
331 fold_fields(self, i)
332 }
333 #[cfg(any(feature = "full", feature = "derive"))]
334 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
335 fold_fields_named(self, i)
336 }
337 #[cfg(any(feature = "full", feature = "derive"))]
338 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
339 fold_fields_unnamed(self, i)
340 }
341 #[cfg(feature = "full")]
342 fn fold_file(&mut self, i: File) -> File {
343 fold_file(self, i)
344 }
345 #[cfg(feature = "full")]
346 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
347 fold_fn_arg(self, i)
348 }
349 #[cfg(feature = "full")]
350 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
351 fold_fn_decl(self, i)
352 }
353 #[cfg(feature = "full")]
354 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
355 fold_foreign_item(self, i)
356 }
357 #[cfg(feature = "full")]
358 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
359 fold_foreign_item_fn(self, i)
360 }
361 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400362 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
363 fold_foreign_item_macro(self, i)
364 }
365 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700366 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
367 fold_foreign_item_static(self, i)
368 }
369 #[cfg(feature = "full")]
370 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
371 fold_foreign_item_type(self, i)
372 }
373 #[cfg(feature = "full")]
374 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
375 fold_foreign_item_verbatim(self, i)
376 }
377 #[cfg(any(feature = "full", feature = "derive"))]
378 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
379 fold_generic_argument(self, i)
380 }
381 #[cfg(any(feature = "full", feature = "derive"))]
382 #[cfg(feature = "full")]
383 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
384 fold_generic_method_argument(self, i)
385 }
386 #[cfg(any(feature = "full", feature = "derive"))]
387 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
388 fold_generic_param(self, i)
389 }
390 #[cfg(any(feature = "full", feature = "derive"))]
391 fn fold_generics(&mut self, i: Generics) -> Generics {
392 fold_generics(self, i)
393 }
David Tolnay8c81f622018-07-31 23:34:35 -0700394 fn fold_ident(&mut self, i: Ident) -> Ident {
395 fold_ident(self, i)
396 }
397 #[cfg(feature = "full")]
398 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
399 fold_impl_item(self, i)
400 }
401 #[cfg(feature = "full")]
402 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
403 fold_impl_item_const(self, i)
404 }
405 #[cfg(feature = "full")]
406 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
407 fold_impl_item_macro(self, i)
408 }
409 #[cfg(feature = "full")]
410 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
411 fold_impl_item_method(self, i)
412 }
413 #[cfg(feature = "full")]
414 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
415 fold_impl_item_type(self, i)
416 }
417 #[cfg(feature = "full")]
418 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
419 fold_impl_item_verbatim(self, i)
420 }
421 #[cfg(any(feature = "full", feature = "derive"))]
422 fn fold_index(&mut self, i: Index) -> Index {
423 fold_index(self, i)
424 }
425 #[cfg(feature = "full")]
426 fn fold_item(&mut self, i: Item) -> Item {
427 fold_item(self, i)
428 }
429 #[cfg(feature = "full")]
430 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
431 fold_item_const(self, i)
432 }
433 #[cfg(feature = "full")]
434 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
435 fold_item_enum(self, i)
436 }
437 #[cfg(feature = "full")]
438 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
439 fold_item_extern_crate(self, i)
440 }
441 #[cfg(feature = "full")]
442 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
443 fold_item_fn(self, i)
444 }
445 #[cfg(feature = "full")]
446 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
447 fold_item_foreign_mod(self, i)
448 }
449 #[cfg(feature = "full")]
450 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
451 fold_item_impl(self, i)
452 }
453 #[cfg(feature = "full")]
454 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
455 fold_item_macro(self, i)
456 }
457 #[cfg(feature = "full")]
458 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
459 fold_item_macro2(self, i)
460 }
461 #[cfg(feature = "full")]
462 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
463 fold_item_mod(self, i)
464 }
465 #[cfg(feature = "full")]
466 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
467 fold_item_static(self, i)
468 }
469 #[cfg(feature = "full")]
470 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
471 fold_item_struct(self, i)
472 }
473 #[cfg(feature = "full")]
474 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
475 fold_item_trait(self, i)
476 }
477 #[cfg(feature = "full")]
478 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
479 fold_item_type(self, i)
480 }
481 #[cfg(feature = "full")]
482 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
483 fold_item_union(self, i)
484 }
485 #[cfg(feature = "full")]
486 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
487 fold_item_use(self, i)
488 }
489 #[cfg(feature = "full")]
490 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
491 fold_item_verbatim(self, i)
492 }
493 #[cfg(any(feature = "full", feature = "derive"))]
494 #[cfg(feature = "full")]
495 fn fold_label(&mut self, i: Label) -> Label {
496 fold_label(self, i)
497 }
498 #[cfg(any(feature = "full", feature = "derive"))]
499 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
500 fold_lifetime(self, i)
501 }
502 #[cfg(any(feature = "full", feature = "derive"))]
503 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
504 fold_lifetime_def(self, i)
505 }
506 #[cfg(any(feature = "full", feature = "derive"))]
507 fn fold_lit(&mut self, i: Lit) -> Lit {
508 fold_lit(self, i)
509 }
510 #[cfg(any(feature = "full", feature = "derive"))]
511 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
512 fold_lit_bool(self, i)
513 }
514 #[cfg(any(feature = "full", feature = "derive"))]
515 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
516 fold_lit_byte(self, i)
517 }
518 #[cfg(any(feature = "full", feature = "derive"))]
519 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
520 fold_lit_byte_str(self, i)
521 }
522 #[cfg(any(feature = "full", feature = "derive"))]
523 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
524 fold_lit_char(self, i)
525 }
526 #[cfg(any(feature = "full", feature = "derive"))]
527 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
528 fold_lit_float(self, i)
529 }
530 #[cfg(any(feature = "full", feature = "derive"))]
531 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
532 fold_lit_int(self, i)
533 }
534 #[cfg(any(feature = "full", feature = "derive"))]
535 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
536 fold_lit_str(self, i)
537 }
538 #[cfg(any(feature = "full", feature = "derive"))]
539 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
540 fold_lit_verbatim(self, i)
541 }
542 #[cfg(any(feature = "full", feature = "derive"))]
543 #[cfg(feature = "full")]
544 fn fold_local(&mut self, i: Local) -> Local {
545 fold_local(self, i)
546 }
547 #[cfg(any(feature = "full", feature = "derive"))]
548 fn fold_macro(&mut self, i: Macro) -> Macro {
549 fold_macro(self, i)
550 }
551 #[cfg(any(feature = "full", feature = "derive"))]
552 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
553 fold_macro_delimiter(self, i)
554 }
555 #[cfg(any(feature = "full", feature = "derive"))]
556 fn fold_member(&mut self, i: Member) -> Member {
557 fold_member(self, i)
558 }
559 #[cfg(any(feature = "full", feature = "derive"))]
560 fn fold_meta(&mut self, i: Meta) -> Meta {
561 fold_meta(self, i)
562 }
563 #[cfg(any(feature = "full", feature = "derive"))]
564 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
565 fold_meta_list(self, i)
566 }
567 #[cfg(any(feature = "full", feature = "derive"))]
568 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
569 fold_meta_name_value(self, i)
570 }
571 #[cfg(feature = "full")]
572 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
573 fold_method_sig(self, i)
574 }
575 #[cfg(any(feature = "full", feature = "derive"))]
576 #[cfg(feature = "full")]
577 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
578 fold_method_turbofish(self, i)
579 }
580 #[cfg(any(feature = "full", feature = "derive"))]
581 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
582 fold_nested_meta(self, i)
583 }
584 #[cfg(any(feature = "full", feature = "derive"))]
585 fn fold_parenthesized_generic_arguments(
586 &mut self,
587 i: ParenthesizedGenericArguments,
588 ) -> ParenthesizedGenericArguments {
589 fold_parenthesized_generic_arguments(self, i)
590 }
591 #[cfg(any(feature = "full", feature = "derive"))]
592 #[cfg(feature = "full")]
593 fn fold_pat(&mut self, i: Pat) -> Pat {
594 fold_pat(self, i)
595 }
596 #[cfg(any(feature = "full", feature = "derive"))]
597 #[cfg(feature = "full")]
598 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
599 fold_pat_box(self, i)
600 }
601 #[cfg(any(feature = "full", feature = "derive"))]
602 #[cfg(feature = "full")]
603 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
604 fold_pat_ident(self, i)
605 }
606 #[cfg(any(feature = "full", feature = "derive"))]
607 #[cfg(feature = "full")]
608 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
609 fold_pat_lit(self, i)
610 }
611 #[cfg(any(feature = "full", feature = "derive"))]
612 #[cfg(feature = "full")]
613 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
614 fold_pat_macro(self, i)
615 }
616 #[cfg(any(feature = "full", feature = "derive"))]
617 #[cfg(feature = "full")]
618 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
619 fold_pat_path(self, i)
620 }
621 #[cfg(any(feature = "full", feature = "derive"))]
622 #[cfg(feature = "full")]
623 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
624 fold_pat_range(self, i)
625 }
626 #[cfg(any(feature = "full", feature = "derive"))]
627 #[cfg(feature = "full")]
628 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
629 fold_pat_ref(self, i)
630 }
631 #[cfg(any(feature = "full", feature = "derive"))]
632 #[cfg(feature = "full")]
633 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
634 fold_pat_slice(self, i)
635 }
636 #[cfg(any(feature = "full", feature = "derive"))]
637 #[cfg(feature = "full")]
638 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
639 fold_pat_struct(self, i)
640 }
641 #[cfg(any(feature = "full", feature = "derive"))]
642 #[cfg(feature = "full")]
643 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
644 fold_pat_tuple(self, i)
645 }
646 #[cfg(any(feature = "full", feature = "derive"))]
647 #[cfg(feature = "full")]
648 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
649 fold_pat_tuple_struct(self, i)
650 }
651 #[cfg(any(feature = "full", feature = "derive"))]
652 #[cfg(feature = "full")]
653 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
654 fold_pat_verbatim(self, i)
655 }
656 #[cfg(any(feature = "full", feature = "derive"))]
657 #[cfg(feature = "full")]
658 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
659 fold_pat_wild(self, i)
660 }
661 #[cfg(any(feature = "full", feature = "derive"))]
662 fn fold_path(&mut self, i: Path) -> Path {
663 fold_path(self, i)
664 }
665 #[cfg(any(feature = "full", feature = "derive"))]
666 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
667 fold_path_arguments(self, i)
668 }
669 #[cfg(any(feature = "full", feature = "derive"))]
670 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
671 fold_path_segment(self, i)
672 }
673 #[cfg(any(feature = "full", feature = "derive"))]
674 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
675 fold_predicate_eq(self, i)
676 }
677 #[cfg(any(feature = "full", feature = "derive"))]
678 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
679 fold_predicate_lifetime(self, i)
680 }
681 #[cfg(any(feature = "full", feature = "derive"))]
682 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
683 fold_predicate_type(self, i)
684 }
685 #[cfg(any(feature = "full", feature = "derive"))]
686 fn fold_qself(&mut self, i: QSelf) -> QSelf {
687 fold_qself(self, i)
688 }
689 #[cfg(any(feature = "full", feature = "derive"))]
690 #[cfg(feature = "full")]
691 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
692 fold_range_limits(self, i)
693 }
694 #[cfg(any(feature = "full", feature = "derive"))]
695 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
696 fold_return_type(self, i)
697 }
David Tolnay8c81f622018-07-31 23:34:35 -0700698 fn fold_span(&mut self, i: Span) -> Span {
699 fold_span(self, i)
700 }
701 #[cfg(any(feature = "full", feature = "derive"))]
702 #[cfg(feature = "full")]
703 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
704 fold_stmt(self, i)
705 }
706 #[cfg(any(feature = "full", feature = "derive"))]
707 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
708 fold_trait_bound(self, i)
709 }
710 #[cfg(any(feature = "full", feature = "derive"))]
711 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
712 fold_trait_bound_modifier(self, i)
713 }
714 #[cfg(feature = "full")]
715 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
716 fold_trait_item(self, i)
717 }
718 #[cfg(feature = "full")]
719 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
720 fold_trait_item_const(self, i)
721 }
722 #[cfg(feature = "full")]
723 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
724 fold_trait_item_macro(self, i)
725 }
726 #[cfg(feature = "full")]
727 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
728 fold_trait_item_method(self, i)
729 }
730 #[cfg(feature = "full")]
731 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
732 fold_trait_item_type(self, i)
733 }
734 #[cfg(feature = "full")]
735 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
736 fold_trait_item_verbatim(self, i)
737 }
738 #[cfg(any(feature = "full", feature = "derive"))]
739 fn fold_type(&mut self, i: Type) -> Type {
740 fold_type(self, i)
741 }
742 #[cfg(any(feature = "full", feature = "derive"))]
743 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
744 fold_type_array(self, i)
745 }
746 #[cfg(any(feature = "full", feature = "derive"))]
747 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
748 fold_type_bare_fn(self, i)
749 }
750 #[cfg(any(feature = "full", feature = "derive"))]
751 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
752 fold_type_group(self, i)
753 }
754 #[cfg(any(feature = "full", feature = "derive"))]
755 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
756 fold_type_impl_trait(self, i)
757 }
758 #[cfg(any(feature = "full", feature = "derive"))]
759 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
760 fold_type_infer(self, i)
761 }
762 #[cfg(any(feature = "full", feature = "derive"))]
763 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
764 fold_type_macro(self, i)
765 }
766 #[cfg(any(feature = "full", feature = "derive"))]
767 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
768 fold_type_never(self, i)
769 }
770 #[cfg(any(feature = "full", feature = "derive"))]
771 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
772 fold_type_param(self, i)
773 }
774 #[cfg(any(feature = "full", feature = "derive"))]
775 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
776 fold_type_param_bound(self, i)
777 }
778 #[cfg(any(feature = "full", feature = "derive"))]
779 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
780 fold_type_paren(self, i)
781 }
782 #[cfg(any(feature = "full", feature = "derive"))]
783 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
784 fold_type_path(self, i)
785 }
786 #[cfg(any(feature = "full", feature = "derive"))]
787 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
788 fold_type_ptr(self, i)
789 }
790 #[cfg(any(feature = "full", feature = "derive"))]
791 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
792 fold_type_reference(self, i)
793 }
794 #[cfg(any(feature = "full", feature = "derive"))]
795 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
796 fold_type_slice(self, i)
797 }
798 #[cfg(any(feature = "full", feature = "derive"))]
799 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
800 fold_type_trait_object(self, i)
801 }
802 #[cfg(any(feature = "full", feature = "derive"))]
803 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
804 fold_type_tuple(self, i)
805 }
806 #[cfg(any(feature = "full", feature = "derive"))]
807 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
808 fold_type_verbatim(self, i)
809 }
810 #[cfg(any(feature = "full", feature = "derive"))]
811 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
812 fold_un_op(self, i)
813 }
814 #[cfg(feature = "full")]
815 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
816 fold_use_glob(self, i)
817 }
818 #[cfg(feature = "full")]
819 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
820 fold_use_group(self, i)
821 }
822 #[cfg(feature = "full")]
823 fn fold_use_name(&mut self, i: UseName) -> UseName {
824 fold_use_name(self, i)
825 }
826 #[cfg(feature = "full")]
827 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
828 fold_use_path(self, i)
829 }
830 #[cfg(feature = "full")]
831 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
832 fold_use_rename(self, i)
833 }
834 #[cfg(feature = "full")]
835 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
836 fold_use_tree(self, i)
837 }
838 #[cfg(any(feature = "full", feature = "derive"))]
839 fn fold_variant(&mut self, i: Variant) -> Variant {
840 fold_variant(self, i)
841 }
842 #[cfg(any(feature = "full", feature = "derive"))]
843 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
844 fold_vis_crate(self, i)
845 }
846 #[cfg(any(feature = "full", feature = "derive"))]
847 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
848 fold_vis_public(self, i)
849 }
850 #[cfg(any(feature = "full", feature = "derive"))]
851 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
852 fold_vis_restricted(self, i)
853 }
854 #[cfg(any(feature = "full", feature = "derive"))]
855 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
856 fold_visibility(self, i)
857 }
858 #[cfg(any(feature = "full", feature = "derive"))]
859 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
860 fold_where_clause(self, i)
861 }
862 #[cfg(any(feature = "full", feature = "derive"))]
863 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
864 fold_where_predicate(self, i)
865 }
Nika Layzell27726662017-10-24 23:16:35 -0400866}
David Tolnayd3f32142018-05-20 20:21:12 -0700867#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800868macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700869 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800870 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700871 let span = _visitor.fold_span(_i.span());
872 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800873 _i
874 }
David Tolnay8c81f622018-07-31 23:34:35 -0700875 };
David Tolnayd0adf522017-12-29 01:30:07 -0500876}
David Tolnay360efd22018-01-04 23:35:26 -0800877#[cfg(any(feature = "full", feature = "derive"))]
878fold_span_only!(fold_lit_byte: LitByte);
879#[cfg(any(feature = "full", feature = "derive"))]
880fold_span_only!(fold_lit_byte_str: LitByteStr);
881#[cfg(any(feature = "full", feature = "derive"))]
882fold_span_only!(fold_lit_char: LitChar);
883#[cfg(any(feature = "full", feature = "derive"))]
884fold_span_only!(fold_lit_float: LitFloat);
885#[cfg(any(feature = "full", feature = "derive"))]
886fold_span_only!(fold_lit_int: LitInt);
887#[cfg(any(feature = "full", feature = "derive"))]
888fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700889#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800890pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400891 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400892 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700893 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400894 }
895}
David Tolnay8c81f622018-07-31 23:34:35 -0700896#[cfg(any(feature = "full", feature = "derive"))]
897pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
898 _visitor: &mut V,
899 _i: AngleBracketedGenericArguments,
900) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500901 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400902 colon2_token: (_i.colon2_token)
903 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
904 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700905 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400906 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400907 }
908}
David Tolnay8c81f622018-07-31 23:34:35 -0700909#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800910pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400911 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700912 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400913 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700914 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400915 }
916}
David Tolnay8c81f622018-07-31 23:34:35 -0700917#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800918pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400919 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400920 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
921 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400922 }
923}
David Tolnay8c81f622018-07-31 23:34:35 -0700924#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800925pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400926 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400927 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700928 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400929 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
930 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400931 }
932}
David Tolnay8c81f622018-07-31 23:34:35 -0700933#[cfg(any(feature = "full", feature = "derive"))]
934#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800935pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400936 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700937 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400938 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700939 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
940 guard: (_i.guard).map(|it| {
941 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400942 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700943 Box::new(_visitor.fold_expr(*(it).1)),
944 )
945 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400946 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700947 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400948 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400949 }
950}
David Tolnay8c81f622018-07-31 23:34:35 -0700951#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800952pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400953 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700954 AttrStyle::Outer => AttrStyle::Outer,
955 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400956 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400957 }
958 }
959}
David Tolnay8c81f622018-07-31 23:34:35 -0700960#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800961pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400962 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400963 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700964 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400965 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700966 path: _visitor.fold_path(_i.path),
967 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400968 }
969}
David Tolnay8c81f622018-07-31 23:34:35 -0700970#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800971pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400972 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700973 name: (_i.name).map(|it| {
974 (
975 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400976 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700977 )
978 }),
979 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400980 }
981}
David Tolnay8c81f622018-07-31 23:34:35 -0700982#[cfg(any(feature = "full", feature = "derive"))]
983pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
984 _visitor: &mut V,
985 _i: BareFnArgName,
986) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400987 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700988 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
989 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400990 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400991 }
992 }
993}
David Tolnay8c81f622018-07-31 23:34:35 -0700994#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800995pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -0400996 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700997 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400998 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400999 }
David Tolnay8c81f622018-07-31 23:34:35 -07001000 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001001 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001002 }
David Tolnay8c81f622018-07-31 23:34:35 -07001003 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001004 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001005 }
David Tolnay8c81f622018-07-31 23:34:35 -07001006 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001007 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001008 }
David Tolnay8c81f622018-07-31 23:34:35 -07001009 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001010 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001011 }
David Tolnay8c81f622018-07-31 23:34:35 -07001012 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001013 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001014 }
David Tolnay8c81f622018-07-31 23:34:35 -07001015 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001016 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001017 }
David Tolnay8c81f622018-07-31 23:34:35 -07001018 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001019 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001020 }
David Tolnay8c81f622018-07-31 23:34:35 -07001021 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001022 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001023 }
David Tolnay8c81f622018-07-31 23:34:35 -07001024 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001025 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001026 }
David Tolnay8c81f622018-07-31 23:34:35 -07001027 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001028 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001029 }
David Tolnay8c81f622018-07-31 23:34:35 -07001030 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001031 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001032 }
David Tolnay8c81f622018-07-31 23:34:35 -07001033 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001034 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001035 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001036 BinOp::Lt(_binding_0) => {
1037 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1038 }
David Tolnay8c81f622018-07-31 23:34:35 -07001039 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001040 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001041 }
David Tolnay8c81f622018-07-31 23:34:35 -07001042 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001043 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001044 }
David Tolnay8c81f622018-07-31 23:34:35 -07001045 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001046 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001047 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001048 BinOp::Gt(_binding_0) => {
1049 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1050 }
David Tolnay8c81f622018-07-31 23:34:35 -07001051 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001052 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001053 }
David Tolnay8c81f622018-07-31 23:34:35 -07001054 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001055 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001056 }
David Tolnay8c81f622018-07-31 23:34:35 -07001057 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001058 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001059 }
David Tolnay8c81f622018-07-31 23:34:35 -07001060 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001061 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001062 }
David Tolnay8c81f622018-07-31 23:34:35 -07001063 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001064 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001065 }
David Tolnay8c81f622018-07-31 23:34:35 -07001066 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001067 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001068 }
David Tolnay8c81f622018-07-31 23:34:35 -07001069 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001070 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001071 }
David Tolnay8c81f622018-07-31 23:34:35 -07001072 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001073 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001074 }
David Tolnay8c81f622018-07-31 23:34:35 -07001075 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001076 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001077 }
David Tolnay8c81f622018-07-31 23:34:35 -07001078 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001079 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001080 }
1081 }
1082}
David Tolnay8c81f622018-07-31 23:34:35 -07001083#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001084pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001085 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001086 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001087 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001088 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001089 }
1090}
David Tolnay8c81f622018-07-31 23:34:35 -07001091#[cfg(any(feature = "full", feature = "derive"))]
1092#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001093pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001094 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001095 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001096 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001097 }
1098}
David Tolnay8c81f622018-07-31 23:34:35 -07001099#[cfg(any(feature = "full", feature = "derive"))]
1100pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1101 _visitor: &mut V,
1102 _i: BoundLifetimes,
1103) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001104 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001105 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1106 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001107 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001108 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001109 }
1110}
David Tolnay8c81f622018-07-31 23:34:35 -07001111#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001112pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001113 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001114 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001115 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001116 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001117 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001118 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001119 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001120 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001121 }
1122}
David Tolnay8c81f622018-07-31 23:34:35 -07001123#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001124pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001125 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001126 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1127 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1128 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001129 }
1130}
David Tolnay8c81f622018-07-31 23:34:35 -07001131#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001132pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001133 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001134 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1135 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001136 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001137 }
1138}
David Tolnay8c81f622018-07-31 23:34:35 -07001139#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001140pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001141 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001142 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001143 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001144 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001145 }
1146}
David Tolnay8c81f622018-07-31 23:34:35 -07001147#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001148pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001149 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001150 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001151 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001152 }
1153}
David Tolnay8c81f622018-07-31 23:34:35 -07001154#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001155pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001156 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001157 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1158 vis: _visitor.fold_visibility(_i.vis),
1159 ident: _visitor.fold_ident(_i.ident),
1160 generics: _visitor.fold_generics(_i.generics),
1161 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001162 }
1163}
David Tolnay8c81f622018-07-31 23:34:35 -07001164#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001165pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001166 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001167 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1168 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1169 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1170 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1171 Expr::MethodCall(_binding_0) => {
1172 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001173 }
David Tolnay8c81f622018-07-31 23:34:35 -07001174 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1175 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1176 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1177 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1178 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1179 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
1180 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
1181 Expr::IfLet(_binding_0) => Expr::IfLet(full!(_visitor.fold_expr_if_let(_binding_0))),
1182 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
1183 Expr::WhileLet(_binding_0) => {
1184 Expr::WhileLet(full!(_visitor.fold_expr_while_let(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001185 }
David Tolnay8c81f622018-07-31 23:34:35 -07001186 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1187 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1188 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1189 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1190 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1191 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1192 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1193 Expr::AssignOp(_binding_0) => {
1194 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001195 }
David Tolnay8c81f622018-07-31 23:34:35 -07001196 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1197 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1198 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1199 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1200 Expr::Reference(_binding_0) => {
1201 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001202 }
David Tolnay8c81f622018-07-31 23:34:35 -07001203 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1204 Expr::Continue(_binding_0) => {
1205 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001206 }
David Tolnay8c81f622018-07-31 23:34:35 -07001207 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1208 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1209 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1210 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1211 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1212 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1213 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001214 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001215 Expr::TryBlock(_binding_0) => {
1216 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1217 }
David Tolnay8c81f622018-07-31 23:34:35 -07001218 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1219 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001220 }
1221}
David Tolnay8c81f622018-07-31 23:34:35 -07001222#[cfg(feature = "full")]
1223#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001224pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001225 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001226 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001227 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001228 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001229 }
1230}
David Tolnay8c81f622018-07-31 23:34:35 -07001231#[cfg(feature = "full")]
1232#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001233pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001234 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001235 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1236 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001237 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001238 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001239 }
1240}
David Tolnay8c81f622018-07-31 23:34:35 -07001241#[cfg(feature = "full")]
1242#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001243pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001244 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001245 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1246 left: Box::new(_visitor.fold_expr(*_i.left)),
1247 op: _visitor.fold_bin_op(_i.op),
1248 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001249 }
1250}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001251#[cfg(feature = "full")]
1252#[cfg(any(feature = "full", feature = "derive"))]
1253pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1254 ExprAsync {
1255 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1256 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
1257 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1258 block: _visitor.fold_block(_i.block),
1259 }
1260}
David Tolnay8c81f622018-07-31 23:34:35 -07001261#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001262pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001263 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001264 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1265 left: Box::new(_visitor.fold_expr(*_i.left)),
1266 op: _visitor.fold_bin_op(_i.op),
1267 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001268 }
1269}
David Tolnay8c81f622018-07-31 23:34:35 -07001270#[cfg(feature = "full")]
1271#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001272pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001273 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001274 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001275 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001276 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001277 }
1278}
David Tolnay8c81f622018-07-31 23:34:35 -07001279#[cfg(feature = "full")]
1280#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001281pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001282 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001283 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001284 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001285 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001286 }
1287}
David Tolnay8c81f622018-07-31 23:34:35 -07001288#[cfg(feature = "full")]
1289#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001290pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001291 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001292 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001293 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001294 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1295 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001296 }
1297}
David Tolnay8c81f622018-07-31 23:34:35 -07001298#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001299pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001300 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001301 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1302 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001303 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001304 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001305 }
1306}
David Tolnay8c81f622018-07-31 23:34:35 -07001307#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001308pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001309 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001310 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1311 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001312 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001313 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001314 }
1315}
David Tolnay8c81f622018-07-31 23:34:35 -07001316#[cfg(feature = "full")]
1317#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001318pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001319 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001320 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001321 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001322 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1323 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1324 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001325 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001326 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001327 output: _visitor.fold_return_type(_i.output),
1328 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001329 }
1330}
David Tolnay8c81f622018-07-31 23:34:35 -07001331#[cfg(feature = "full")]
1332#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001333pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001334 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001335 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001336 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001337 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001338 }
1339}
David Tolnay8c81f622018-07-31 23:34:35 -07001340#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001341pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001342 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001343 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1344 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001345 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001346 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001347 }
1348}
David Tolnay8c81f622018-07-31 23:34:35 -07001349#[cfg(feature = "full")]
1350#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001351pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001352 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001353 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1354 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001355 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001356 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001357 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001358 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1359 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001360 }
1361}
David Tolnay8c81f622018-07-31 23:34:35 -07001362#[cfg(feature = "full")]
1363#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001364pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001365 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001366 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001367 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001368 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001369 }
1370}
David Tolnay8c81f622018-07-31 23:34:35 -07001371#[cfg(feature = "full")]
1372#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001373pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001374 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001375 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001376 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001377 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1378 then_branch: _visitor.fold_block(_i.then_branch),
1379 else_branch: (_i.else_branch).map(|it| {
1380 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001381 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001382 Box::new(_visitor.fold_expr(*(it).1)),
1383 )
1384 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001385 }
1386}
David Tolnay8c81f622018-07-31 23:34:35 -07001387#[cfg(feature = "full")]
1388#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001389pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001390 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001391 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001392 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
1393 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001394 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001395 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001396 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1397 then_branch: _visitor.fold_block(_i.then_branch),
1398 else_branch: (_i.else_branch).map(|it| {
1399 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001400 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001401 Box::new(_visitor.fold_expr(*(it).1)),
1402 )
1403 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001404 }
1405}
David Tolnay8c81f622018-07-31 23:34:35 -07001406#[cfg(feature = "full")]
1407#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001408pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001409 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001410 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1411 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001412 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001413 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001414 }
1415}
David Tolnay8c81f622018-07-31 23:34:35 -07001416#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001417pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001418 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001419 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1420 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001421 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001422 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001423 }
1424}
David Tolnay8c81f622018-07-31 23:34:35 -07001425#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001426pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001427 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001428 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1429 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001430 }
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_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001435 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001436 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1437 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001438 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001439 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001440 }
1441}
David Tolnay8c81f622018-07-31 23:34:35 -07001442#[cfg(feature = "full")]
1443#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001444pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001445 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001446 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1447 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001448 }
1449}
David Tolnay8c81f622018-07-31 23:34:35 -07001450#[cfg(feature = "full")]
1451#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001452pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001453 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001454 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001455 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001456 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001457 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001458 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001459 }
1460}
David Tolnay8c81f622018-07-31 23:34:35 -07001461#[cfg(feature = "full")]
1462#[cfg(any(feature = "full", feature = "derive"))]
1463pub fn fold_expr_method_call<V: Fold + ?Sized>(
1464 _visitor: &mut V,
1465 _i: ExprMethodCall,
1466) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001467 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001468 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1469 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001470 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001471 method: _visitor.fold_ident(_i.method),
1472 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001473 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001474 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001475 }
1476}
David Tolnay8c81f622018-07-31 23:34:35 -07001477#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001478pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001479 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001480 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001481 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001482 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001483 }
1484}
David Tolnay8c81f622018-07-31 23:34:35 -07001485#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001486pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001487 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001488 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1489 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1490 path: _visitor.fold_path(_i.path),
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 Tolnay4b4c4b62018-01-06 13:48:05 -08001495pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001496 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001497 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1498 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1499 limits: _visitor.fold_range_limits(_i.limits),
1500 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001501 }
1502}
David Tolnay8c81f622018-07-31 23:34:35 -07001503#[cfg(feature = "full")]
1504#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001505pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1506 ExprReference {
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 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1509 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001510 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001511 }
1512}
David Tolnay8c81f622018-07-31 23:34:35 -07001513#[cfg(feature = "full")]
1514#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001515pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001516 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001517 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001518 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001519 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001520 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001521 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001522 }
1523}
David Tolnay8c81f622018-07-31 23:34:35 -07001524#[cfg(feature = "full")]
1525#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001526pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001527 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001528 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001529 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001530 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001531 }
1532}
David Tolnay8c81f622018-07-31 23:34:35 -07001533#[cfg(feature = "full")]
1534#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001535pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001536 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001537 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1538 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001539 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001540 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001541 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001542 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001543 }
1544}
David Tolnay8c81f622018-07-31 23:34:35 -07001545#[cfg(feature = "full")]
1546#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001547pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001548 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001549 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1550 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001551 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001552 }
1553}
David Tolnay8c81f622018-07-31 23:34:35 -07001554#[cfg(feature = "full")]
1555#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001556pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1557 ExprTryBlock {
1558 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1559 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1560 block: _visitor.fold_block(_i.block),
1561 }
1562}
1563#[cfg(feature = "full")]
1564#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001565pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001566 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001567 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001568 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001569 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001570 }
1571}
David Tolnay8c81f622018-07-31 23:34:35 -07001572#[cfg(feature = "full")]
1573#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001574pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001575 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001576 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1577 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001578 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001579 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001580 }
1581}
David Tolnay8c81f622018-07-31 23:34:35 -07001582#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001583pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001584 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001585 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1586 op: _visitor.fold_un_op(_i.op),
1587 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001588 }
1589}
David Tolnay8c81f622018-07-31 23:34:35 -07001590#[cfg(feature = "full")]
1591#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001592pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001593 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001594 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001595 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001596 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001597 }
1598}
David Tolnay8c81f622018-07-31 23:34:35 -07001599#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001600pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001601 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001602}
David Tolnay8c81f622018-07-31 23:34:35 -07001603#[cfg(feature = "full")]
1604#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001605pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001606 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001607 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1608 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001609 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001610 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1611 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001612 }
1613}
David Tolnay8c81f622018-07-31 23:34:35 -07001614#[cfg(feature = "full")]
1615#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001616pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001617 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001618 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1619 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001620 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
1621 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001622 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001623 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001624 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1625 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001626 }
1627}
David Tolnay8c81f622018-07-31 23:34:35 -07001628#[cfg(feature = "full")]
1629#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001630pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001631 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001632 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001633 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001634 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001635 }
1636}
David Tolnay8c81f622018-07-31 23:34:35 -07001637#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001638pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001639 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001640 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1641 vis: _visitor.fold_visibility(_i.vis),
1642 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001643 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001644 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001645 }
1646}
David Tolnay8c81f622018-07-31 23:34:35 -07001647#[cfg(any(feature = "full", feature = "derive"))]
1648#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001649pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001650 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001651 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1652 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001653 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001654 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001655 }
1656}
David Tolnay8c81f622018-07-31 23:34:35 -07001657#[cfg(any(feature = "full", feature = "derive"))]
1658#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001659pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001660 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001661 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1662 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001663 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001664 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001665 }
1666}
David Tolnay8c81f622018-07-31 23:34:35 -07001667#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001668pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001669 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001670 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1671 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1672 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001673 }
1674}
David Tolnay8c81f622018-07-31 23:34:35 -07001675#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001676pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001677 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001678 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001679 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001680 }
1681}
David Tolnay8c81f622018-07-31 23:34:35 -07001682#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001683pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001684 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001685 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001686 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001687 }
1688}
David Tolnay8c81f622018-07-31 23:34:35 -07001689#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001690pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001691 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001692 shebang: _i.shebang,
1693 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1694 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001695 }
1696}
David Tolnay8c81f622018-07-31 23:34:35 -07001697#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001698pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001699 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001700 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1701 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1702 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1703 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1704 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001705 }
1706}
David Tolnay8c81f622018-07-31 23:34:35 -07001707#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001708pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001709 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001710 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001711 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001712 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001713 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001714 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001715 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001716 }
1717}
David Tolnay8c81f622018-07-31 23:34:35 -07001718#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001719pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001720 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001721 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1722 ForeignItem::Static(_binding_0) => {
1723 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001724 }
David Tolnay8c81f622018-07-31 23:34:35 -07001725 ForeignItem::Type(_binding_0) => {
1726 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001727 }
David Tolnay435c1782018-08-24 16:15:44 -04001728 ForeignItem::Macro(_binding_0) => {
1729 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1730 }
David Tolnay8c81f622018-07-31 23:34:35 -07001731 ForeignItem::Verbatim(_binding_0) => {
1732 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001733 }
Nika Layzell27726662017-10-24 23:16:35 -04001734 }
1735}
David Tolnay8c81f622018-07-31 23:34:35 -07001736#[cfg(feature = "full")]
1737pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1738 _visitor: &mut V,
1739 _i: ForeignItemFn,
1740) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001741 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001742 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1743 vis: _visitor.fold_visibility(_i.vis),
1744 ident: _visitor.fold_ident(_i.ident),
1745 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001746 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001747 }
1748}
David Tolnay8c81f622018-07-31 23:34:35 -07001749#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001750pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1751 _visitor: &mut V,
1752 _i: ForeignItemMacro,
1753) -> ForeignItemMacro {
1754 ForeignItemMacro {
1755 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1756 mac: _visitor.fold_macro(_i.mac),
1757 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1758 }
1759}
1760#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001761pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1762 _visitor: &mut V,
1763 _i: ForeignItemStatic,
1764) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001765 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001766 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1767 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001768 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1769 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001770 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001771 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001772 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001773 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001774 }
1775}
David Tolnay8c81f622018-07-31 23:34:35 -07001776#[cfg(feature = "full")]
1777pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1778 _visitor: &mut V,
1779 _i: ForeignItemType,
1780) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001781 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001782 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1783 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001784 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001785 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001786 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001787 }
1788}
David Tolnay8c81f622018-07-31 23:34:35 -07001789#[cfg(feature = "full")]
1790pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1791 _visitor: &mut V,
1792 _i: ForeignItemVerbatim,
1793) -> ForeignItemVerbatim {
1794 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001795}
David Tolnay8c81f622018-07-31 23:34:35 -07001796#[cfg(any(feature = "full", feature = "derive"))]
1797pub fn fold_generic_argument<V: Fold + ?Sized>(
1798 _visitor: &mut V,
1799 _i: GenericArgument,
1800) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001801 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001802 GenericArgument::Lifetime(_binding_0) => {
1803 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001804 }
David Tolnay8c81f622018-07-31 23:34:35 -07001805 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1806 GenericArgument::Binding(_binding_0) => {
1807 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001808 }
David Tolnay8c81f622018-07-31 23:34:35 -07001809 GenericArgument::Const(_binding_0) => {
1810 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001811 }
Nika Layzell357885a2017-12-04 15:47:07 -05001812 }
1813}
David Tolnay8c81f622018-07-31 23:34:35 -07001814#[cfg(any(feature = "full", feature = "derive"))]
1815#[cfg(feature = "full")]
1816pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1817 _visitor: &mut V,
1818 _i: GenericMethodArgument,
1819) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001820 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001821 GenericMethodArgument::Type(_binding_0) => {
1822 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001823 }
David Tolnay8c81f622018-07-31 23:34:35 -07001824 GenericMethodArgument::Const(_binding_0) => {
1825 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001826 }
1827 }
1828}
David Tolnay8c81f622018-07-31 23:34:35 -07001829#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001830pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001831 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001832 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1833 GenericParam::Lifetime(_binding_0) => {
1834 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001835 }
David Tolnay8c81f622018-07-31 23:34:35 -07001836 GenericParam::Const(_binding_0) => {
1837 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001838 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001839 }
1840}
David Tolnay8c81f622018-07-31 23:34:35 -07001841#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001842pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001843 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001844 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001845 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001846 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001847 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001848 }
1849}
Alex Crichtond261d092018-05-18 13:47:35 -07001850pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001851 let mut _i = _i;
1852 let span = _visitor.fold_span(_i.span());
1853 _i.set_span(span);
1854 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001855}
David Tolnay8c81f622018-07-31 23:34:35 -07001856#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001857pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001858 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001859 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1860 ImplItem::Method(_binding_0) => {
1861 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001862 }
David Tolnay8c81f622018-07-31 23:34:35 -07001863 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
1864 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1865 ImplItem::Verbatim(_binding_0) => {
1866 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001867 }
Nika Layzell27726662017-10-24 23:16:35 -04001868 }
1869}
David Tolnay8c81f622018-07-31 23:34:35 -07001870#[cfg(feature = "full")]
1871pub fn fold_impl_item_const<V: Fold + ?Sized>(
1872 _visitor: &mut V,
1873 _i: ImplItemConst,
1874) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001875 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001876 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1877 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001878 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1879 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001880 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001881 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001882 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001883 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001884 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001885 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001886 }
1887}
David Tolnay8c81f622018-07-31 23:34:35 -07001888#[cfg(feature = "full")]
1889pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1890 _visitor: &mut V,
1891 _i: ImplItemMacro,
1892) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001893 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001894 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1895 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001896 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001897 }
1898}
David Tolnay8c81f622018-07-31 23:34:35 -07001899#[cfg(feature = "full")]
1900pub fn fold_impl_item_method<V: Fold + ?Sized>(
1901 _visitor: &mut V,
1902 _i: ImplItemMethod,
1903) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001904 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001905 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1906 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001907 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001908 sig: _visitor.fold_method_sig(_i.sig),
1909 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001910 }
1911}
David Tolnay8c81f622018-07-31 23:34:35 -07001912#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001913pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001914 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001915 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1916 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001917 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1918 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001919 ident: _visitor.fold_ident(_i.ident),
1920 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001921 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001922 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001923 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001924 }
1925}
David Tolnay8c81f622018-07-31 23:34:35 -07001926#[cfg(feature = "full")]
1927pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1928 _visitor: &mut V,
1929 _i: ImplItemVerbatim,
1930) -> ImplItemVerbatim {
1931 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001932}
David Tolnay8c81f622018-07-31 23:34:35 -07001933#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001934pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001935 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001936 index: _i.index,
1937 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001938 }
1939}
David Tolnay8c81f622018-07-31 23:34:35 -07001940#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001941pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001942 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001943 Item::ExternCrate(_binding_0) => {
1944 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001945 }
David Tolnay8c81f622018-07-31 23:34:35 -07001946 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1947 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1948 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1949 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1950 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1951 Item::ForeignMod(_binding_0) => {
1952 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001953 }
David Tolnay8c81f622018-07-31 23:34:35 -07001954 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
1955 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1956 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1957 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1958 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
1959 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1960 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1961 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1962 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001963 }
1964}
David Tolnay8c81f622018-07-31 23:34:35 -07001965#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001966pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001967 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001968 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1969 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001970 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001971 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001972 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001973 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001974 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001975 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001976 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001977 }
1978}
David Tolnay8c81f622018-07-31 23:34:35 -07001979#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001980pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001981 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001982 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1983 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001984 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001985 ident: _visitor.fold_ident(_i.ident),
1986 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001987 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001988 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001989 }
1990}
David Tolnay8c81f622018-07-31 23:34:35 -07001991#[cfg(feature = "full")]
1992pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1993 _visitor: &mut V,
1994 _i: ItemExternCrate,
1995) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001996 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001997 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1998 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001999 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
2000 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002001 ident: _visitor.fold_ident(_i.ident),
2002 rename: (_i.rename).map(|it| {
2003 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002004 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002005 _visitor.fold_ident((it).1),
2006 )
2007 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002008 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002009 }
2010}
David Tolnay8c81f622018-07-31 23:34:35 -07002011#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002012pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002013 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07002014 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2015 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002016 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2017 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002018 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002019 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2020 ident: _visitor.fold_ident(_i.ident),
2021 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2022 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002023 }
2024}
David Tolnay8c81f622018-07-31 23:34:35 -07002025#[cfg(feature = "full")]
2026pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2027 _visitor: &mut V,
2028 _i: ItemForeignMod,
2029) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002030 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002031 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2032 abi: _visitor.fold_abi(_i.abi),
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_foreign_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_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002039 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002040 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002041 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2042 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2043 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002044 generics: _visitor.fold_generics(_i.generics),
2045 trait_: (_i.trait_).map(|it| {
2046 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002047 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002048 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002049 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002050 )
2051 }),
2052 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002053 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002054 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002055 }
2056}
David Tolnay8c81f622018-07-31 23:34:35 -07002057#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002058pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002059 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002060 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2061 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2062 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002063 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002064 }
2065}
David Tolnay8c81f622018-07-31 23:34:35 -07002066#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002067pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002068 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002069 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2070 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002071 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002072 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002073 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002074 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002075 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002076 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002077 }
2078}
David Tolnay8c81f622018-07-31 23:34:35 -07002079#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002080pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002081 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002082 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2083 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002084 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002085 ident: _visitor.fold_ident(_i.ident),
2086 content: (_i.content).map(|it| {
2087 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002088 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002089 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2090 )
2091 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002092 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002093 }
2094}
David Tolnay8c81f622018-07-31 23:34:35 -07002095#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002096pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002097 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002098 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2099 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002100 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2101 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002102 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002103 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002104 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002105 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002106 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002107 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002108 }
2109}
David Tolnay8c81f622018-07-31 23:34:35 -07002110#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002111pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002112 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002113 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2114 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002115 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002116 ident: _visitor.fold_ident(_i.ident),
2117 generics: _visitor.fold_generics(_i.generics),
2118 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002119 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002120 }
2121}
David Tolnay8c81f622018-07-31 23:34:35 -07002122#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002123pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002124 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002125 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2126 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002127 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2128 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2129 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002130 ident: _visitor.fold_ident(_i.ident),
2131 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002132 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002133 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002134 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002135 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002136 }
2137}
David Tolnay8c81f622018-07-31 23:34:35 -07002138#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002139pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002140 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002141 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2142 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002143 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002144 ident: _visitor.fold_ident(_i.ident),
2145 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002146 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002147 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002148 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002149 }
2150}
David Tolnay8c81f622018-07-31 23:34:35 -07002151#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002152pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002153 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002154 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2155 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002156 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002157 ident: _visitor.fold_ident(_i.ident),
2158 generics: _visitor.fold_generics(_i.generics),
2159 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002160 }
2161}
David Tolnay8c81f622018-07-31 23:34:35 -07002162#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002163pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002164 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002165 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2166 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002167 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002168 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002169 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002170 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002171 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002172 }
2173}
David Tolnay8c81f622018-07-31 23:34:35 -07002174#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002175pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002176 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002177}
David Tolnay8c81f622018-07-31 23:34:35 -07002178#[cfg(any(feature = "full", feature = "derive"))]
2179#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002180pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002181 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002182 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002183 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002184 }
2185}
David Tolnay8c81f622018-07-31 23:34:35 -07002186#[cfg(any(feature = "full", feature = "derive"))]
Alex Crichton131308c2018-05-18 14:00:24 -07002187pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2188 Lifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002189 apostrophe: _i.apostrophe,
2190 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002191 }
2192}
David Tolnay8c81f622018-07-31 23:34:35 -07002193#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002194pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002195 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002196 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2197 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002198 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002199 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002200 }
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<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002204 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002205 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2206 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2207 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2208 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2209 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2210 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2211 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2212 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002213 }
2214}
David Tolnay8c81f622018-07-31 23:34:35 -07002215#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002216pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002217 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002218 value: _i.value,
2219 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002220 }
2221}
David Tolnay8c81f622018-07-31 23:34:35 -07002222#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002223pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002224 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002225}
David Tolnay8c81f622018-07-31 23:34:35 -07002226#[cfg(any(feature = "full", feature = "derive"))]
2227#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002228pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002229 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002230 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002231 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002232 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2233 ty: (_i.ty).map(|it| {
2234 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002235 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002236 Box::new(_visitor.fold_type(*(it).1)),
2237 )
2238 }),
2239 init: (_i.init).map(|it| {
2240 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002241 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002242 Box::new(_visitor.fold_expr(*(it).1)),
2243 )
2244 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002245 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002246 }
2247}
David Tolnay8c81f622018-07-31 23:34:35 -07002248#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002249pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002250 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002251 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002252 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002253 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2254 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002255 }
2256}
David Tolnay8c81f622018-07-31 23:34:35 -07002257#[cfg(any(feature = "full", feature = "derive"))]
2258pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2259 _visitor: &mut V,
2260 _i: MacroDelimiter,
2261) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002262 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002263 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002264 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002265 }
David Tolnay8c81f622018-07-31 23:34:35 -07002266 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002267 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002268 }
David Tolnay8c81f622018-07-31 23:34:35 -07002269 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002270 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002271 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002272 }
2273}
David Tolnay8c81f622018-07-31 23:34:35 -07002274#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002275pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002276 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002277 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2278 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002279 }
2280}
David Tolnay8c81f622018-07-31 23:34:35 -07002281#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002282pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002283 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002284 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2285 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2286 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002287 }
2288}
David Tolnay8c81f622018-07-31 23:34:35 -07002289#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002290pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2291 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002292 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002293 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002294 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002295 }
2296}
David Tolnay8c81f622018-07-31 23:34:35 -07002297#[cfg(any(feature = "full", feature = "derive"))]
2298pub fn fold_meta_name_value<V: Fold + ?Sized>(
2299 _visitor: &mut V,
2300 _i: MetaNameValue,
2301) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002302 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002303 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002304 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002305 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002306 }
2307}
David Tolnay8c81f622018-07-31 23:34:35 -07002308#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002309pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002310 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002311 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2312 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002313 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002314 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2315 ident: _visitor.fold_ident(_i.ident),
2316 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002317 }
2318}
David Tolnay8c81f622018-07-31 23:34:35 -07002319#[cfg(any(feature = "full", feature = "derive"))]
2320#[cfg(feature = "full")]
2321pub fn fold_method_turbofish<V: Fold + ?Sized>(
2322 _visitor: &mut V,
2323 _i: MethodTurbofish,
2324) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002325 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002326 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2327 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002328 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002329 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002330 }
2331}
David Tolnay8c81f622018-07-31 23:34:35 -07002332#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002333pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002334 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002335 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2336 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002337 }
2338}
David Tolnay8c81f622018-07-31 23:34:35 -07002339#[cfg(any(feature = "full", feature = "derive"))]
2340pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2341 _visitor: &mut V,
2342 _i: ParenthesizedGenericArguments,
2343) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002344 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002345 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002346 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2347 output: _visitor.fold_return_type(_i.output),
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<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002353 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002354 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2355 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2356 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2357 Pat::TupleStruct(_binding_0) => {
2358 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002359 }
David Tolnay8c81f622018-07-31 23:34:35 -07002360 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2361 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2362 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2363 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2364 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2365 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2366 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2367 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2368 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002369 }
2370}
David Tolnay8c81f622018-07-31 23:34:35 -07002371#[cfg(any(feature = "full", feature = "derive"))]
2372#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002373pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002374 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002375 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002376 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002377 }
2378}
David Tolnay8c81f622018-07-31 23:34:35 -07002379#[cfg(any(feature = "full", feature = "derive"))]
2380#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002381pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002382 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002383 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2384 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002385 ident: _visitor.fold_ident(_i.ident),
2386 subpat: (_i.subpat).map(|it| {
2387 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002388 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002389 Box::new(_visitor.fold_pat(*(it).1)),
2390 )
2391 }),
Nika Layzell27726662017-10-24 23:16:35 -04002392 }
2393}
David Tolnay8c81f622018-07-31 23:34:35 -07002394#[cfg(any(feature = "full", feature = "derive"))]
2395#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002396pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002397 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002398 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002399 }
2400}
David Tolnay8c81f622018-07-31 23:34:35 -07002401#[cfg(any(feature = "full", feature = "derive"))]
2402#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002403pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002404 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002405 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002406 }
2407}
David Tolnay8c81f622018-07-31 23:34:35 -07002408#[cfg(any(feature = "full", feature = "derive"))]
2409#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002410pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002411 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002412 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2413 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002414 }
2415}
David Tolnay8c81f622018-07-31 23:34:35 -07002416#[cfg(any(feature = "full", feature = "derive"))]
2417#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002418pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002419 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002420 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2421 limits: _visitor.fold_range_limits(_i.limits),
2422 hi: Box::new(_visitor.fold_expr(*_i.hi)),
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_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002428 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002429 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2430 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002431 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002432 }
2433}
David Tolnay8c81f622018-07-31 23:34:35 -07002434#[cfg(any(feature = "full", feature = "derive"))]
2435#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002436pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002437 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002438 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002439 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2440 middle: (_i.middle).map(|it| Box::new(_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")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002448pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002449 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002450 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002451 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002452 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002453 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002454 }
2455}
David Tolnay8c81f622018-07-31 23:34:35 -07002456#[cfg(any(feature = "full", feature = "derive"))]
2457#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002458pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002459 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002460 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002461 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002462 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2463 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002464 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002465 }
2466}
David Tolnay8c81f622018-07-31 23:34:35 -07002467#[cfg(any(feature = "full", feature = "derive"))]
2468#[cfg(feature = "full")]
2469pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2470 _visitor: &mut V,
2471 _i: PatTupleStruct,
2472) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002473 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002474 path: _visitor.fold_path(_i.path),
2475 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002476 }
2477}
David Tolnay8c81f622018-07-31 23:34:35 -07002478#[cfg(any(feature = "full", feature = "derive"))]
2479#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002480pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002481 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002482}
David Tolnay8c81f622018-07-31 23:34:35 -07002483#[cfg(any(feature = "full", feature = "derive"))]
2484#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002485pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002486 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002487 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002488 }
2489}
David Tolnay8c81f622018-07-31 23:34:35 -07002490#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002491pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002492 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002493 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002494 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002495 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002496 }
2497}
David Tolnay8c81f622018-07-31 23:34:35 -07002498#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002499pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002500 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002501 PathArguments::None => PathArguments::None,
2502 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2503 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2504 ),
2505 PathArguments::Parenthesized(_binding_0) => {
2506 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002507 }
2508 }
2509}
David Tolnay8c81f622018-07-31 23:34:35 -07002510#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002511pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002512 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002513 ident: _visitor.fold_ident(_i.ident),
2514 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002515 }
2516}
David Tolnay8c81f622018-07-31 23:34:35 -07002517#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002518pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002519 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002520 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002521 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002522 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002523 }
2524}
David Tolnay8c81f622018-07-31 23:34:35 -07002525#[cfg(any(feature = "full", feature = "derive"))]
2526pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2527 _visitor: &mut V,
2528 _i: PredicateLifetime,
2529) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002530 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002531 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002532 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002533 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002534 }
2535}
David Tolnay8c81f622018-07-31 23:34:35 -07002536#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002537pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002538 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002539 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2540 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002541 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002542 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002543 }
2544}
David Tolnay8c81f622018-07-31 23:34:35 -07002545#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002546pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002547 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002548 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002549 ty: Box::new(_visitor.fold_type(*_i.ty)),
2550 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002551 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2552 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002553 }
2554}
David Tolnay8c81f622018-07-31 23:34:35 -07002555#[cfg(any(feature = "full", feature = "derive"))]
2556#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002557pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002558 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002559 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002560 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002561 }
David Tolnay8c81f622018-07-31 23:34:35 -07002562 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002563 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002564 }
2565 }
2566}
David Tolnay8c81f622018-07-31 23:34:35 -07002567#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002568pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002569 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002570 ReturnType::Default => ReturnType::Default,
2571 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002572 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002573 Box::new(_visitor.fold_type(*_binding_1)),
2574 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002575 }
2576}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002577pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002578 _i
2579}
David Tolnay8c81f622018-07-31 23:34:35 -07002580#[cfg(any(feature = "full", feature = "derive"))]
2581#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002582pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002583 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002584 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2585 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2586 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2587 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2588 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002589 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002590 ),
Nika Layzell27726662017-10-24 23:16:35 -04002591 }
2592}
David Tolnay8c81f622018-07-31 23:34:35 -07002593#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002594pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002595 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002596 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002597 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2598 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2599 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002600 }
2601}
David Tolnay8c81f622018-07-31 23:34:35 -07002602#[cfg(any(feature = "full", feature = "derive"))]
2603pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2604 _visitor: &mut V,
2605 _i: TraitBoundModifier,
2606) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002607 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002608 TraitBoundModifier::None => TraitBoundModifier::None,
2609 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002610 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002611 }
2612 }
2613}
David Tolnay8c81f622018-07-31 23:34:35 -07002614#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002615pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002616 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002617 TraitItem::Const(_binding_0) => {
2618 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002619 }
David Tolnay8c81f622018-07-31 23:34:35 -07002620 TraitItem::Method(_binding_0) => {
2621 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002622 }
David Tolnay8c81f622018-07-31 23:34:35 -07002623 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2624 TraitItem::Macro(_binding_0) => {
2625 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002626 }
David Tolnay8c81f622018-07-31 23:34:35 -07002627 TraitItem::Verbatim(_binding_0) => {
2628 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002629 }
Nika Layzell27726662017-10-24 23:16:35 -04002630 }
2631}
David Tolnay8c81f622018-07-31 23:34:35 -07002632#[cfg(feature = "full")]
2633pub fn fold_trait_item_const<V: Fold + ?Sized>(
2634 _visitor: &mut V,
2635 _i: TraitItemConst,
2636) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002637 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002638 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002639 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002640 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002641 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002642 ty: _visitor.fold_type(_i.ty),
2643 default: (_i.default).map(|it| {
2644 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002645 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002646 _visitor.fold_expr((it).1),
2647 )
2648 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002649 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002650 }
2651}
David Tolnay8c81f622018-07-31 23:34:35 -07002652#[cfg(feature = "full")]
2653pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2654 _visitor: &mut V,
2655 _i: TraitItemMacro,
2656) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002657 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002658 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2659 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002660 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002661 }
2662}
David Tolnay8c81f622018-07-31 23:34:35 -07002663#[cfg(feature = "full")]
2664pub fn fold_trait_item_method<V: Fold + ?Sized>(
2665 _visitor: &mut V,
2666 _i: TraitItemMethod,
2667) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002668 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002669 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2670 sig: _visitor.fold_method_sig(_i.sig),
2671 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002672 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.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_type<V: Fold + ?Sized>(
2677 _visitor: &mut V,
2678 _i: TraitItemType,
2679) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002680 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002681 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002682 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002683 ident: _visitor.fold_ident(_i.ident),
2684 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002685 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002686 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2687 default: (_i.default).map(|it| {
2688 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002689 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002690 _visitor.fold_type((it).1),
2691 )
2692 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002693 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002694 }
2695}
David Tolnay8c81f622018-07-31 23:34:35 -07002696#[cfg(feature = "full")]
2697pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2698 _visitor: &mut V,
2699 _i: TraitItemVerbatim,
2700) -> TraitItemVerbatim {
2701 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002702}
David Tolnay8c81f622018-07-31 23:34:35 -07002703#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002704pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002705 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002706 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2707 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2708 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2709 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2710 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2711 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2712 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2713 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2714 Type::TraitObject(_binding_0) => {
2715 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002716 }
David Tolnay8c81f622018-07-31 23:34:35 -07002717 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2718 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2719 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2720 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2721 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2722 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002723 }
2724}
David Tolnay8c81f622018-07-31 23:34:35 -07002725#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002726pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002727 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002728 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002729 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002730 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002731 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002732 }
2733}
David Tolnay8c81f622018-07-31 23:34:35 -07002734#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002735pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002736 TypeBareFn {
David Tolnay7ac699c2018-08-24 14:00:58 -04002737 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002738 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002739 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002740 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002741 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002742 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002743 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002744 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002745 }
2746}
David Tolnay8c81f622018-07-31 23:34:35 -07002747#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002748pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002749 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002750 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002751 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002752 }
2753}
David Tolnay8c81f622018-07-31 23:34:35 -07002754#[cfg(any(feature = "full", feature = "derive"))]
2755pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2756 _visitor: &mut V,
2757 _i: TypeImplTrait,
2758) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002759 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002760 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002761 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002762 }
2763}
David Tolnay8c81f622018-07-31 23:34:35 -07002764#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002765pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002766 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002767 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002768 }
2769}
David Tolnay8c81f622018-07-31 23:34:35 -07002770#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002771pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002772 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002773 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002774 }
2775}
David Tolnay8c81f622018-07-31 23:34:35 -07002776#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002777pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002778 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002779 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002780 }
2781}
David Tolnay8c81f622018-07-31 23:34:35 -07002782#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002783pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002784 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002785 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2786 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002787 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002788 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002789 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002790 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002791 }
2792}
David Tolnay8c81f622018-07-31 23:34:35 -07002793#[cfg(any(feature = "full", feature = "derive"))]
2794pub fn fold_type_param_bound<V: Fold + ?Sized>(
2795 _visitor: &mut V,
2796 _i: TypeParamBound,
2797) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002798 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002799 TypeParamBound::Trait(_binding_0) => {
2800 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002801 }
David Tolnay8c81f622018-07-31 23:34:35 -07002802 TypeParamBound::Lifetime(_binding_0) => {
2803 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002804 }
2805 }
2806}
David Tolnay8c81f622018-07-31 23:34:35 -07002807#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002808pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002809 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002810 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002811 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002812 }
2813}
David Tolnay8c81f622018-07-31 23:34:35 -07002814#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002815pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002816 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002817 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2818 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002819 }
2820}
David Tolnay8c81f622018-07-31 23:34:35 -07002821#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002822pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002823 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002824 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2825 const_token: (_i.const_token)
2826 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2827 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002828 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002829 }
2830}
David Tolnay8c81f622018-07-31 23:34:35 -07002831#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002832pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002833 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002834 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002835 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002836 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002837 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002838 }
2839}
David Tolnay8c81f622018-07-31 23:34:35 -07002840#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002841pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002842 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002843 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002844 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002845 }
2846}
David Tolnay8c81f622018-07-31 23:34:35 -07002847#[cfg(any(feature = "full", feature = "derive"))]
2848pub fn fold_type_trait_object<V: Fold + ?Sized>(
2849 _visitor: &mut V,
2850 _i: TypeTraitObject,
2851) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002852 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002853 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002854 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002855 }
2856}
David Tolnay8c81f622018-07-31 23:34:35 -07002857#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002858pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002859 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002860 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002861 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002862 }
2863}
David Tolnay8c81f622018-07-31 23:34:35 -07002864#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002865pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002866 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002867}
David Tolnay8c81f622018-07-31 23:34:35 -07002868#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002869pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002870 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002871 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002872 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002873 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002874 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2875 UnOp::Neg(_binding_0) => {
2876 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2877 }
Nika Layzell27726662017-10-24 23:16:35 -04002878 }
2879}
David Tolnay8c81f622018-07-31 23:34:35 -07002880#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002881pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002882 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002883 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002884 }
2885}
David Tolnay8c81f622018-07-31 23:34:35 -07002886#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002887pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2888 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002889 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002890 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002891 }
2892}
David Tolnay8c81f622018-07-31 23:34:35 -07002893#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002894pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2895 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002896 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002897 }
2898}
David Tolnay8c81f622018-07-31 23:34:35 -07002899#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002900pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002901 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002902 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002903 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002904 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002905 }
2906}
David Tolnay8c81f622018-07-31 23:34:35 -07002907#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002908pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2909 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002910 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002911 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002912 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002913 }
2914}
David Tolnay8c81f622018-07-31 23:34:35 -07002915#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002916pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002917 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002918 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2919 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2920 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2921 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2922 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002923 }
2924}
David Tolnay8c81f622018-07-31 23:34:35 -07002925#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002926pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002927 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002928 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2929 ident: _visitor.fold_ident(_i.ident),
2930 fields: _visitor.fold_fields(_i.fields),
2931 discriminant: (_i.discriminant).map(|it| {
2932 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002933 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002934 _visitor.fold_expr((it).1),
2935 )
2936 }),
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_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002941 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002942 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002943 }
2944}
David Tolnay8c81f622018-07-31 23:34:35 -07002945#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002946pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002947 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04002948 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002949 }
2950}
David Tolnay8c81f622018-07-31 23:34:35 -07002951#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002952pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002953 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04002954 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
2955 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
2956 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002957 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002958 }
2959}
David Tolnay8c81f622018-07-31 23:34:35 -07002960#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002961pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002962 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002963 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2964 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2965 Visibility::Restricted(_binding_0) => {
2966 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002967 }
David Tolnay8c81f622018-07-31 23:34:35 -07002968 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04002969 }
2970}
David Tolnay8c81f622018-07-31 23:34:35 -07002971#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002972pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002973 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04002974 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002975 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002976 }
2977}
David Tolnay8c81f622018-07-31 23:34:35 -07002978#[cfg(any(feature = "full", feature = "derive"))]
2979pub fn fold_where_predicate<V: Fold + ?Sized>(
2980 _visitor: &mut V,
2981 _i: WherePredicate,
2982) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002983 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002984 WherePredicate::Type(_binding_0) => {
2985 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002986 }
David Tolnay8c81f622018-07-31 23:34:35 -07002987 WherePredicate::Lifetime(_binding_0) => {
2988 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002989 }
David Tolnay8c81f622018-07-31 23:34:35 -07002990 WherePredicate::Eq(_binding_0) => {
2991 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002992 }
2993 }
2994}