blob: 520978958eea3558e262027112d217901b0ae40d [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")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400406 fn fold_impl_item_existential(&mut self, i: ImplItemExistential) -> ImplItemExistential {
407 fold_impl_item_existential(self, i)
408 }
409 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700410 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
411 fold_impl_item_macro(self, i)
412 }
413 #[cfg(feature = "full")]
414 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
415 fold_impl_item_method(self, i)
416 }
417 #[cfg(feature = "full")]
418 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
419 fold_impl_item_type(self, i)
420 }
421 #[cfg(feature = "full")]
422 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
423 fold_impl_item_verbatim(self, i)
424 }
425 #[cfg(any(feature = "full", feature = "derive"))]
426 fn fold_index(&mut self, i: Index) -> Index {
427 fold_index(self, i)
428 }
429 #[cfg(feature = "full")]
430 fn fold_item(&mut self, i: Item) -> Item {
431 fold_item(self, i)
432 }
433 #[cfg(feature = "full")]
434 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
435 fold_item_const(self, i)
436 }
437 #[cfg(feature = "full")]
438 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
439 fold_item_enum(self, i)
440 }
441 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400442 fn fold_item_existential(&mut self, i: ItemExistential) -> ItemExistential {
443 fold_item_existential(self, i)
444 }
445 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700446 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
447 fold_item_extern_crate(self, i)
448 }
449 #[cfg(feature = "full")]
450 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
451 fold_item_fn(self, i)
452 }
453 #[cfg(feature = "full")]
454 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
455 fold_item_foreign_mod(self, i)
456 }
457 #[cfg(feature = "full")]
458 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
459 fold_item_impl(self, i)
460 }
461 #[cfg(feature = "full")]
462 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
463 fold_item_macro(self, i)
464 }
465 #[cfg(feature = "full")]
466 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
467 fold_item_macro2(self, i)
468 }
469 #[cfg(feature = "full")]
470 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
471 fold_item_mod(self, i)
472 }
473 #[cfg(feature = "full")]
474 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
475 fold_item_static(self, i)
476 }
477 #[cfg(feature = "full")]
478 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
479 fold_item_struct(self, i)
480 }
481 #[cfg(feature = "full")]
482 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
483 fold_item_trait(self, i)
484 }
485 #[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -0700486 fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias {
487 fold_item_trait_alias(self, i)
488 }
489 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700490 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
491 fold_item_type(self, i)
492 }
493 #[cfg(feature = "full")]
494 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
495 fold_item_union(self, i)
496 }
497 #[cfg(feature = "full")]
498 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
499 fold_item_use(self, i)
500 }
501 #[cfg(feature = "full")]
502 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
503 fold_item_verbatim(self, i)
504 }
505 #[cfg(any(feature = "full", feature = "derive"))]
506 #[cfg(feature = "full")]
507 fn fold_label(&mut self, i: Label) -> Label {
508 fold_label(self, i)
509 }
510 #[cfg(any(feature = "full", feature = "derive"))]
511 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
512 fold_lifetime(self, i)
513 }
514 #[cfg(any(feature = "full", feature = "derive"))]
515 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
516 fold_lifetime_def(self, i)
517 }
518 #[cfg(any(feature = "full", feature = "derive"))]
519 fn fold_lit(&mut self, i: Lit) -> Lit {
520 fold_lit(self, i)
521 }
522 #[cfg(any(feature = "full", feature = "derive"))]
523 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
524 fold_lit_bool(self, i)
525 }
526 #[cfg(any(feature = "full", feature = "derive"))]
527 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
528 fold_lit_byte(self, i)
529 }
530 #[cfg(any(feature = "full", feature = "derive"))]
531 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
532 fold_lit_byte_str(self, i)
533 }
534 #[cfg(any(feature = "full", feature = "derive"))]
535 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
536 fold_lit_char(self, i)
537 }
538 #[cfg(any(feature = "full", feature = "derive"))]
539 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
540 fold_lit_float(self, i)
541 }
542 #[cfg(any(feature = "full", feature = "derive"))]
543 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
544 fold_lit_int(self, i)
545 }
546 #[cfg(any(feature = "full", feature = "derive"))]
547 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
548 fold_lit_str(self, i)
549 }
550 #[cfg(any(feature = "full", feature = "derive"))]
551 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
552 fold_lit_verbatim(self, i)
553 }
554 #[cfg(any(feature = "full", feature = "derive"))]
555 #[cfg(feature = "full")]
556 fn fold_local(&mut self, i: Local) -> Local {
557 fold_local(self, i)
558 }
559 #[cfg(any(feature = "full", feature = "derive"))]
560 fn fold_macro(&mut self, i: Macro) -> Macro {
561 fold_macro(self, i)
562 }
563 #[cfg(any(feature = "full", feature = "derive"))]
564 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
565 fold_macro_delimiter(self, i)
566 }
567 #[cfg(any(feature = "full", feature = "derive"))]
568 fn fold_member(&mut self, i: Member) -> Member {
569 fold_member(self, i)
570 }
571 #[cfg(any(feature = "full", feature = "derive"))]
572 fn fold_meta(&mut self, i: Meta) -> Meta {
573 fold_meta(self, i)
574 }
575 #[cfg(any(feature = "full", feature = "derive"))]
576 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
577 fold_meta_list(self, i)
578 }
579 #[cfg(any(feature = "full", feature = "derive"))]
580 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
581 fold_meta_name_value(self, i)
582 }
583 #[cfg(feature = "full")]
584 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
585 fold_method_sig(self, i)
586 }
587 #[cfg(any(feature = "full", feature = "derive"))]
588 #[cfg(feature = "full")]
589 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
590 fold_method_turbofish(self, i)
591 }
592 #[cfg(any(feature = "full", feature = "derive"))]
593 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
594 fold_nested_meta(self, i)
595 }
596 #[cfg(any(feature = "full", feature = "derive"))]
597 fn fold_parenthesized_generic_arguments(
598 &mut self,
599 i: ParenthesizedGenericArguments,
600 ) -> ParenthesizedGenericArguments {
601 fold_parenthesized_generic_arguments(self, i)
602 }
603 #[cfg(any(feature = "full", feature = "derive"))]
604 #[cfg(feature = "full")]
605 fn fold_pat(&mut self, i: Pat) -> Pat {
606 fold_pat(self, i)
607 }
608 #[cfg(any(feature = "full", feature = "derive"))]
609 #[cfg(feature = "full")]
610 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
611 fold_pat_box(self, i)
612 }
613 #[cfg(any(feature = "full", feature = "derive"))]
614 #[cfg(feature = "full")]
615 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
616 fold_pat_ident(self, i)
617 }
618 #[cfg(any(feature = "full", feature = "derive"))]
619 #[cfg(feature = "full")]
620 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
621 fold_pat_lit(self, i)
622 }
623 #[cfg(any(feature = "full", feature = "derive"))]
624 #[cfg(feature = "full")]
625 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
626 fold_pat_macro(self, i)
627 }
628 #[cfg(any(feature = "full", feature = "derive"))]
629 #[cfg(feature = "full")]
630 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
631 fold_pat_path(self, i)
632 }
633 #[cfg(any(feature = "full", feature = "derive"))]
634 #[cfg(feature = "full")]
635 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
636 fold_pat_range(self, i)
637 }
638 #[cfg(any(feature = "full", feature = "derive"))]
639 #[cfg(feature = "full")]
640 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
641 fold_pat_ref(self, i)
642 }
643 #[cfg(any(feature = "full", feature = "derive"))]
644 #[cfg(feature = "full")]
645 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
646 fold_pat_slice(self, i)
647 }
648 #[cfg(any(feature = "full", feature = "derive"))]
649 #[cfg(feature = "full")]
650 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
651 fold_pat_struct(self, i)
652 }
653 #[cfg(any(feature = "full", feature = "derive"))]
654 #[cfg(feature = "full")]
655 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
656 fold_pat_tuple(self, i)
657 }
658 #[cfg(any(feature = "full", feature = "derive"))]
659 #[cfg(feature = "full")]
660 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
661 fold_pat_tuple_struct(self, i)
662 }
663 #[cfg(any(feature = "full", feature = "derive"))]
664 #[cfg(feature = "full")]
665 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
666 fold_pat_verbatim(self, i)
667 }
668 #[cfg(any(feature = "full", feature = "derive"))]
669 #[cfg(feature = "full")]
670 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
671 fold_pat_wild(self, i)
672 }
673 #[cfg(any(feature = "full", feature = "derive"))]
674 fn fold_path(&mut self, i: Path) -> Path {
675 fold_path(self, i)
676 }
677 #[cfg(any(feature = "full", feature = "derive"))]
678 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
679 fold_path_arguments(self, i)
680 }
681 #[cfg(any(feature = "full", feature = "derive"))]
682 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
683 fold_path_segment(self, i)
684 }
685 #[cfg(any(feature = "full", feature = "derive"))]
686 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
687 fold_predicate_eq(self, i)
688 }
689 #[cfg(any(feature = "full", feature = "derive"))]
690 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
691 fold_predicate_lifetime(self, i)
692 }
693 #[cfg(any(feature = "full", feature = "derive"))]
694 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
695 fold_predicate_type(self, i)
696 }
697 #[cfg(any(feature = "full", feature = "derive"))]
698 fn fold_qself(&mut self, i: QSelf) -> QSelf {
699 fold_qself(self, i)
700 }
701 #[cfg(any(feature = "full", feature = "derive"))]
702 #[cfg(feature = "full")]
703 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
704 fold_range_limits(self, i)
705 }
706 #[cfg(any(feature = "full", feature = "derive"))]
707 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
708 fold_return_type(self, i)
709 }
David Tolnay8c81f622018-07-31 23:34:35 -0700710 fn fold_span(&mut self, i: Span) -> Span {
711 fold_span(self, i)
712 }
713 #[cfg(any(feature = "full", feature = "derive"))]
714 #[cfg(feature = "full")]
715 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
716 fold_stmt(self, i)
717 }
718 #[cfg(any(feature = "full", feature = "derive"))]
719 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
720 fold_trait_bound(self, i)
721 }
722 #[cfg(any(feature = "full", feature = "derive"))]
723 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
724 fold_trait_bound_modifier(self, i)
725 }
726 #[cfg(feature = "full")]
727 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
728 fold_trait_item(self, i)
729 }
730 #[cfg(feature = "full")]
731 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
732 fold_trait_item_const(self, i)
733 }
734 #[cfg(feature = "full")]
735 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
736 fold_trait_item_macro(self, i)
737 }
738 #[cfg(feature = "full")]
739 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
740 fold_trait_item_method(self, i)
741 }
742 #[cfg(feature = "full")]
743 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
744 fold_trait_item_type(self, i)
745 }
746 #[cfg(feature = "full")]
747 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
748 fold_trait_item_verbatim(self, i)
749 }
750 #[cfg(any(feature = "full", feature = "derive"))]
751 fn fold_type(&mut self, i: Type) -> Type {
752 fold_type(self, i)
753 }
754 #[cfg(any(feature = "full", feature = "derive"))]
755 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
756 fold_type_array(self, i)
757 }
758 #[cfg(any(feature = "full", feature = "derive"))]
759 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
760 fold_type_bare_fn(self, i)
761 }
762 #[cfg(any(feature = "full", feature = "derive"))]
763 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
764 fold_type_group(self, i)
765 }
766 #[cfg(any(feature = "full", feature = "derive"))]
767 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
768 fold_type_impl_trait(self, i)
769 }
770 #[cfg(any(feature = "full", feature = "derive"))]
771 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
772 fold_type_infer(self, i)
773 }
774 #[cfg(any(feature = "full", feature = "derive"))]
775 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
776 fold_type_macro(self, i)
777 }
778 #[cfg(any(feature = "full", feature = "derive"))]
779 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
780 fold_type_never(self, i)
781 }
782 #[cfg(any(feature = "full", feature = "derive"))]
783 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
784 fold_type_param(self, i)
785 }
786 #[cfg(any(feature = "full", feature = "derive"))]
787 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
788 fold_type_param_bound(self, i)
789 }
790 #[cfg(any(feature = "full", feature = "derive"))]
791 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
792 fold_type_paren(self, i)
793 }
794 #[cfg(any(feature = "full", feature = "derive"))]
795 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
796 fold_type_path(self, i)
797 }
798 #[cfg(any(feature = "full", feature = "derive"))]
799 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
800 fold_type_ptr(self, i)
801 }
802 #[cfg(any(feature = "full", feature = "derive"))]
803 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
804 fold_type_reference(self, i)
805 }
806 #[cfg(any(feature = "full", feature = "derive"))]
807 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
808 fold_type_slice(self, i)
809 }
810 #[cfg(any(feature = "full", feature = "derive"))]
811 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
812 fold_type_trait_object(self, i)
813 }
814 #[cfg(any(feature = "full", feature = "derive"))]
815 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
816 fold_type_tuple(self, i)
817 }
818 #[cfg(any(feature = "full", feature = "derive"))]
819 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
820 fold_type_verbatim(self, i)
821 }
822 #[cfg(any(feature = "full", feature = "derive"))]
823 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
824 fold_un_op(self, i)
825 }
826 #[cfg(feature = "full")]
827 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
828 fold_use_glob(self, i)
829 }
830 #[cfg(feature = "full")]
831 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
832 fold_use_group(self, i)
833 }
834 #[cfg(feature = "full")]
835 fn fold_use_name(&mut self, i: UseName) -> UseName {
836 fold_use_name(self, i)
837 }
838 #[cfg(feature = "full")]
839 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
840 fold_use_path(self, i)
841 }
842 #[cfg(feature = "full")]
843 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
844 fold_use_rename(self, i)
845 }
846 #[cfg(feature = "full")]
847 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
848 fold_use_tree(self, i)
849 }
850 #[cfg(any(feature = "full", feature = "derive"))]
851 fn fold_variant(&mut self, i: Variant) -> Variant {
852 fold_variant(self, i)
853 }
854 #[cfg(any(feature = "full", feature = "derive"))]
855 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
856 fold_vis_crate(self, i)
857 }
858 #[cfg(any(feature = "full", feature = "derive"))]
859 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
860 fold_vis_public(self, i)
861 }
862 #[cfg(any(feature = "full", feature = "derive"))]
863 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
864 fold_vis_restricted(self, i)
865 }
866 #[cfg(any(feature = "full", feature = "derive"))]
867 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
868 fold_visibility(self, i)
869 }
870 #[cfg(any(feature = "full", feature = "derive"))]
871 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
872 fold_where_clause(self, i)
873 }
874 #[cfg(any(feature = "full", feature = "derive"))]
875 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
876 fold_where_predicate(self, i)
877 }
Nika Layzell27726662017-10-24 23:16:35 -0400878}
David Tolnayd3f32142018-05-20 20:21:12 -0700879#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800880macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700881 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800882 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700883 let span = _visitor.fold_span(_i.span());
884 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800885 _i
886 }
David Tolnay8c81f622018-07-31 23:34:35 -0700887 };
David Tolnayd0adf522017-12-29 01:30:07 -0500888}
David Tolnay360efd22018-01-04 23:35:26 -0800889#[cfg(any(feature = "full", feature = "derive"))]
890fold_span_only!(fold_lit_byte: LitByte);
891#[cfg(any(feature = "full", feature = "derive"))]
892fold_span_only!(fold_lit_byte_str: LitByteStr);
893#[cfg(any(feature = "full", feature = "derive"))]
894fold_span_only!(fold_lit_char: LitChar);
895#[cfg(any(feature = "full", feature = "derive"))]
896fold_span_only!(fold_lit_float: LitFloat);
897#[cfg(any(feature = "full", feature = "derive"))]
898fold_span_only!(fold_lit_int: LitInt);
899#[cfg(any(feature = "full", feature = "derive"))]
900fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700901#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800902pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400903 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400904 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700905 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400906 }
907}
David Tolnay8c81f622018-07-31 23:34:35 -0700908#[cfg(any(feature = "full", feature = "derive"))]
909pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
910 _visitor: &mut V,
911 _i: AngleBracketedGenericArguments,
912) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500913 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400914 colon2_token: (_i.colon2_token)
915 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
916 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700917 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400918 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400919 }
920}
David Tolnay8c81f622018-07-31 23:34:35 -0700921#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800922pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400923 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700924 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400925 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700926 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400927 }
928}
David Tolnay8c81f622018-07-31 23:34:35 -0700929#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800930pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400931 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400932 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
933 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400934 }
935}
David Tolnay8c81f622018-07-31 23:34:35 -0700936#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800937pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400938 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400939 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700940 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400941 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
942 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400943 }
944}
David Tolnay8c81f622018-07-31 23:34:35 -0700945#[cfg(any(feature = "full", feature = "derive"))]
946#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800947pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400948 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700949 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400950 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700951 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
952 guard: (_i.guard).map(|it| {
953 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400954 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700955 Box::new(_visitor.fold_expr(*(it).1)),
956 )
957 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400958 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700959 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400960 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400961 }
962}
David Tolnay8c81f622018-07-31 23:34:35 -0700963#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800964pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400965 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700966 AttrStyle::Outer => AttrStyle::Outer,
967 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400968 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400969 }
970 }
971}
David Tolnay8c81f622018-07-31 23:34:35 -0700972#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800973pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400974 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400975 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700976 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400977 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700978 path: _visitor.fold_path(_i.path),
979 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400980 }
981}
David Tolnay8c81f622018-07-31 23:34:35 -0700982#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800983pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400984 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700985 name: (_i.name).map(|it| {
986 (
987 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400988 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700989 )
990 }),
991 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400992 }
993}
David Tolnay8c81f622018-07-31 23:34:35 -0700994#[cfg(any(feature = "full", feature = "derive"))]
995pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
996 _visitor: &mut V,
997 _i: BareFnArgName,
998) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400999 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001000 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
1001 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001002 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001003 }
1004 }
1005}
David Tolnay8c81f622018-07-31 23:34:35 -07001006#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001007pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -04001008 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001009 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001010 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001011 }
David Tolnay8c81f622018-07-31 23:34:35 -07001012 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001013 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001014 }
David Tolnay8c81f622018-07-31 23:34:35 -07001015 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001016 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001017 }
David Tolnay8c81f622018-07-31 23:34:35 -07001018 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001019 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001020 }
David Tolnay8c81f622018-07-31 23:34:35 -07001021 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001022 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001023 }
David Tolnay8c81f622018-07-31 23:34:35 -07001024 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001025 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001026 }
David Tolnay8c81f622018-07-31 23:34:35 -07001027 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001028 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001029 }
David Tolnay8c81f622018-07-31 23:34:35 -07001030 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001031 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001032 }
David Tolnay8c81f622018-07-31 23:34:35 -07001033 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001034 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001035 }
David Tolnay8c81f622018-07-31 23:34:35 -07001036 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001037 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001038 }
David Tolnay8c81f622018-07-31 23:34:35 -07001039 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001040 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001041 }
David Tolnay8c81f622018-07-31 23:34:35 -07001042 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001043 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001044 }
David Tolnay8c81f622018-07-31 23:34:35 -07001045 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001046 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001047 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001048 BinOp::Lt(_binding_0) => {
1049 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1050 }
David Tolnay8c81f622018-07-31 23:34:35 -07001051 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001052 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001053 }
David Tolnay8c81f622018-07-31 23:34:35 -07001054 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001055 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001056 }
David Tolnay8c81f622018-07-31 23:34:35 -07001057 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001058 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001059 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001060 BinOp::Gt(_binding_0) => {
1061 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1062 }
David Tolnay8c81f622018-07-31 23:34:35 -07001063 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001064 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001065 }
David Tolnay8c81f622018-07-31 23:34:35 -07001066 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001067 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001068 }
David Tolnay8c81f622018-07-31 23:34:35 -07001069 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001070 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001071 }
David Tolnay8c81f622018-07-31 23:34:35 -07001072 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001073 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001074 }
David Tolnay8c81f622018-07-31 23:34:35 -07001075 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001076 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001077 }
David Tolnay8c81f622018-07-31 23:34:35 -07001078 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001079 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001080 }
David Tolnay8c81f622018-07-31 23:34:35 -07001081 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001082 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001083 }
David Tolnay8c81f622018-07-31 23:34:35 -07001084 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001085 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001086 }
David Tolnay8c81f622018-07-31 23:34:35 -07001087 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001088 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001089 }
David Tolnay8c81f622018-07-31 23:34:35 -07001090 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001091 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001092 }
1093 }
1094}
David Tolnay8c81f622018-07-31 23:34:35 -07001095#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001096pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001097 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001098 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001099 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001100 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001101 }
1102}
David Tolnay8c81f622018-07-31 23:34:35 -07001103#[cfg(any(feature = "full", feature = "derive"))]
1104#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001105pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001106 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001107 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001108 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001109 }
1110}
David Tolnay8c81f622018-07-31 23:34:35 -07001111#[cfg(any(feature = "full", feature = "derive"))]
1112pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1113 _visitor: &mut V,
1114 _i: BoundLifetimes,
1115) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001116 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001117 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1118 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001119 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001120 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001121 }
1122}
David Tolnay8c81f622018-07-31 23:34:35 -07001123#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001124pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001125 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001126 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001127 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001128 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001129 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001130 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001131 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001132 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001133 }
1134}
David Tolnay8c81f622018-07-31 23:34:35 -07001135#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001136pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001137 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001138 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1139 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1140 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001141 }
1142}
David Tolnay8c81f622018-07-31 23:34:35 -07001143#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001144pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001145 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001146 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1147 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001148 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001149 }
1150}
David Tolnay8c81f622018-07-31 23:34:35 -07001151#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001152pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001153 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001154 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001155 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001156 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001157 }
1158}
David Tolnay8c81f622018-07-31 23:34:35 -07001159#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001160pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001161 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001162 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001163 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001164 }
1165}
David Tolnay8c81f622018-07-31 23:34:35 -07001166#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001167pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001168 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001169 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1170 vis: _visitor.fold_visibility(_i.vis),
1171 ident: _visitor.fold_ident(_i.ident),
1172 generics: _visitor.fold_generics(_i.generics),
1173 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001174 }
1175}
David Tolnay8c81f622018-07-31 23:34:35 -07001176#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001177pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001178 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001179 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1180 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1181 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1182 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1183 Expr::MethodCall(_binding_0) => {
1184 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001185 }
David Tolnay8c81f622018-07-31 23:34:35 -07001186 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1187 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1188 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1189 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1190 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1191 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
1192 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
1193 Expr::IfLet(_binding_0) => Expr::IfLet(full!(_visitor.fold_expr_if_let(_binding_0))),
1194 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
1195 Expr::WhileLet(_binding_0) => {
1196 Expr::WhileLet(full!(_visitor.fold_expr_while_let(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001197 }
David Tolnay8c81f622018-07-31 23:34:35 -07001198 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1199 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1200 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1201 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1202 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1203 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1204 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1205 Expr::AssignOp(_binding_0) => {
1206 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001207 }
David Tolnay8c81f622018-07-31 23:34:35 -07001208 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1209 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1210 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1211 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1212 Expr::Reference(_binding_0) => {
1213 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001214 }
David Tolnay8c81f622018-07-31 23:34:35 -07001215 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1216 Expr::Continue(_binding_0) => {
1217 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001218 }
David Tolnay8c81f622018-07-31 23:34:35 -07001219 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1220 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1221 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1222 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1223 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1224 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1225 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001226 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001227 Expr::TryBlock(_binding_0) => {
1228 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1229 }
David Tolnay8c81f622018-07-31 23:34:35 -07001230 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1231 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001232 }
1233}
David Tolnay8c81f622018-07-31 23:34:35 -07001234#[cfg(feature = "full")]
1235#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001236pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001237 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001238 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001239 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001240 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001241 }
1242}
David Tolnay8c81f622018-07-31 23:34:35 -07001243#[cfg(feature = "full")]
1244#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001245pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001246 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001247 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1248 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001249 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001250 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001251 }
1252}
David Tolnay8c81f622018-07-31 23:34:35 -07001253#[cfg(feature = "full")]
1254#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001255pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001256 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001257 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1258 left: Box::new(_visitor.fold_expr(*_i.left)),
1259 op: _visitor.fold_bin_op(_i.op),
1260 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001261 }
1262}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001263#[cfg(feature = "full")]
1264#[cfg(any(feature = "full", feature = "derive"))]
1265pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1266 ExprAsync {
1267 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1268 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
1269 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1270 block: _visitor.fold_block(_i.block),
1271 }
1272}
David Tolnay8c81f622018-07-31 23:34:35 -07001273#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001274pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001275 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001276 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1277 left: Box::new(_visitor.fold_expr(*_i.left)),
1278 op: _visitor.fold_bin_op(_i.op),
1279 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001280 }
1281}
David Tolnay8c81f622018-07-31 23:34:35 -07001282#[cfg(feature = "full")]
1283#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001284pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001285 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001286 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001287 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001288 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001289 }
1290}
David Tolnay8c81f622018-07-31 23:34:35 -07001291#[cfg(feature = "full")]
1292#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001293pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001294 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001295 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001296 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001297 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001298 }
1299}
David Tolnay8c81f622018-07-31 23:34:35 -07001300#[cfg(feature = "full")]
1301#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001302pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001303 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001304 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001305 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001306 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1307 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001308 }
1309}
David Tolnay8c81f622018-07-31 23:34:35 -07001310#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001311pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001312 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001313 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1314 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001315 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001316 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001317 }
1318}
David Tolnay8c81f622018-07-31 23:34:35 -07001319#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001320pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001321 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001322 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1323 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001324 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001325 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001326 }
1327}
David Tolnay8c81f622018-07-31 23:34:35 -07001328#[cfg(feature = "full")]
1329#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001330pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001331 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001332 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001333 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001334 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1335 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1336 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001337 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001338 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001339 output: _visitor.fold_return_type(_i.output),
1340 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001341 }
1342}
David Tolnay8c81f622018-07-31 23:34:35 -07001343#[cfg(feature = "full")]
1344#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001345pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001346 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001347 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001348 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001349 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001350 }
1351}
David Tolnay8c81f622018-07-31 23:34:35 -07001352#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001353pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001354 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001355 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1356 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001357 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001358 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001359 }
1360}
David Tolnay8c81f622018-07-31 23:34:35 -07001361#[cfg(feature = "full")]
1362#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001363pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001364 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001365 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1366 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001367 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001368 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001369 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001370 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1371 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001372 }
1373}
David Tolnay8c81f622018-07-31 23:34:35 -07001374#[cfg(feature = "full")]
1375#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001376pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001377 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001378 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001379 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001380 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001381 }
1382}
David Tolnay8c81f622018-07-31 23:34:35 -07001383#[cfg(feature = "full")]
1384#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001385pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001386 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001387 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001388 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001389 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1390 then_branch: _visitor.fold_block(_i.then_branch),
1391 else_branch: (_i.else_branch).map(|it| {
1392 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001393 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001394 Box::new(_visitor.fold_expr(*(it).1)),
1395 )
1396 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001397 }
1398}
David Tolnay8c81f622018-07-31 23:34:35 -07001399#[cfg(feature = "full")]
1400#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001401pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001402 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001403 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001404 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
1405 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001406 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001407 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001408 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1409 then_branch: _visitor.fold_block(_i.then_branch),
1410 else_branch: (_i.else_branch).map(|it| {
1411 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001412 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001413 Box::new(_visitor.fold_expr(*(it).1)),
1414 )
1415 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001416 }
1417}
David Tolnay8c81f622018-07-31 23:34:35 -07001418#[cfg(feature = "full")]
1419#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001420pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001421 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001422 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1423 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001424 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001425 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001426 }
1427}
David Tolnay8c81f622018-07-31 23:34:35 -07001428#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001429pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001430 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001431 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1432 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001433 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001434 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001435 }
1436}
David Tolnay8c81f622018-07-31 23:34:35 -07001437#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001438pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001439 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001440 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1441 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001442 }
1443}
David Tolnay8c81f622018-07-31 23:34:35 -07001444#[cfg(feature = "full")]
1445#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001446pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001447 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001448 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1449 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001450 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001451 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001452 }
1453}
David Tolnay8c81f622018-07-31 23:34:35 -07001454#[cfg(feature = "full")]
1455#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001456pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001457 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001458 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1459 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001460 }
1461}
David Tolnay8c81f622018-07-31 23:34:35 -07001462#[cfg(feature = "full")]
1463#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001464pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001465 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001466 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001467 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001468 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001469 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001470 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001471 }
1472}
David Tolnay8c81f622018-07-31 23:34:35 -07001473#[cfg(feature = "full")]
1474#[cfg(any(feature = "full", feature = "derive"))]
1475pub fn fold_expr_method_call<V: Fold + ?Sized>(
1476 _visitor: &mut V,
1477 _i: ExprMethodCall,
1478) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001479 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001480 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1481 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001482 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001483 method: _visitor.fold_ident(_i.method),
1484 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001485 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001486 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001487 }
1488}
David Tolnay8c81f622018-07-31 23:34:35 -07001489#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001490pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001491 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001492 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001493 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001494 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001495 }
1496}
David Tolnay8c81f622018-07-31 23:34:35 -07001497#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001498pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001499 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001500 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1501 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1502 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001503 }
1504}
David Tolnay8c81f622018-07-31 23:34:35 -07001505#[cfg(feature = "full")]
1506#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001507pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001508 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001509 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1510 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1511 limits: _visitor.fold_range_limits(_i.limits),
1512 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001513 }
1514}
David Tolnay8c81f622018-07-31 23:34:35 -07001515#[cfg(feature = "full")]
1516#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001517pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1518 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001519 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001520 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1521 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001522 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001523 }
1524}
David Tolnay8c81f622018-07-31 23:34:35 -07001525#[cfg(feature = "full")]
1526#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001527pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001528 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001529 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001530 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001531 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001532 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001533 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001534 }
1535}
David Tolnay8c81f622018-07-31 23:34:35 -07001536#[cfg(feature = "full")]
1537#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001538pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001539 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001540 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001541 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001542 expr: (_i.expr).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_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001548 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001549 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1550 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001551 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001552 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001553 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001554 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001555 }
1556}
David Tolnay8c81f622018-07-31 23:34:35 -07001557#[cfg(feature = "full")]
1558#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001559pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001560 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001561 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1562 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001563 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001564 }
1565}
David Tolnay8c81f622018-07-31 23:34:35 -07001566#[cfg(feature = "full")]
1567#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001568pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1569 ExprTryBlock {
1570 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1571 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1572 block: _visitor.fold_block(_i.block),
1573 }
1574}
1575#[cfg(feature = "full")]
1576#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001577pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001578 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001579 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001580 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001581 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001582 }
1583}
David Tolnay8c81f622018-07-31 23:34:35 -07001584#[cfg(feature = "full")]
1585#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001586pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001587 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001588 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1589 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001590 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001591 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001592 }
1593}
David Tolnay8c81f622018-07-31 23:34:35 -07001594#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001595pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001596 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001597 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1598 op: _visitor.fold_un_op(_i.op),
1599 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001600 }
1601}
David Tolnay8c81f622018-07-31 23:34:35 -07001602#[cfg(feature = "full")]
1603#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001604pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001605 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001606 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001607 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001608 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001609 }
1610}
David Tolnay8c81f622018-07-31 23:34:35 -07001611#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001612pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001613 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001614}
David Tolnay8c81f622018-07-31 23:34:35 -07001615#[cfg(feature = "full")]
1616#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001617pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001618 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001619 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1620 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001621 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001622 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1623 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001624 }
1625}
David Tolnay8c81f622018-07-31 23:34:35 -07001626#[cfg(feature = "full")]
1627#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001628pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001629 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001630 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1631 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001632 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
1633 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001634 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001635 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001636 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1637 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001638 }
1639}
David Tolnay8c81f622018-07-31 23:34:35 -07001640#[cfg(feature = "full")]
1641#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001642pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001643 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001644 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001645 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001646 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001647 }
1648}
David Tolnay8c81f622018-07-31 23:34:35 -07001649#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001650pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001651 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001652 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1653 vis: _visitor.fold_visibility(_i.vis),
1654 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001655 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001656 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001657 }
1658}
David Tolnay8c81f622018-07-31 23:34:35 -07001659#[cfg(any(feature = "full", feature = "derive"))]
1660#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001661pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001662 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001663 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1664 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001665 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001666 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001667 }
1668}
David Tolnay8c81f622018-07-31 23:34:35 -07001669#[cfg(any(feature = "full", feature = "derive"))]
1670#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001671pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001672 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001673 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1674 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001675 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001676 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001677 }
1678}
David Tolnay8c81f622018-07-31 23:34:35 -07001679#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001680pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001681 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001682 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1683 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1684 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001685 }
1686}
David Tolnay8c81f622018-07-31 23:34:35 -07001687#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001688pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001689 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001690 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001691 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001692 }
1693}
David Tolnay8c81f622018-07-31 23:34:35 -07001694#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001695pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001696 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001697 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001698 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001699 }
1700}
David Tolnay8c81f622018-07-31 23:34:35 -07001701#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001702pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001703 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001704 shebang: _i.shebang,
1705 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1706 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001707 }
1708}
David Tolnay8c81f622018-07-31 23:34:35 -07001709#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001710pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001711 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001712 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1713 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1714 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1715 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1716 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001717 }
1718}
David Tolnay8c81f622018-07-31 23:34:35 -07001719#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001720pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001721 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001722 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001723 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001724 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001725 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001726 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001727 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001728 }
1729}
David Tolnay8c81f622018-07-31 23:34:35 -07001730#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001731pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001732 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001733 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1734 ForeignItem::Static(_binding_0) => {
1735 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001736 }
David Tolnay8c81f622018-07-31 23:34:35 -07001737 ForeignItem::Type(_binding_0) => {
1738 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001739 }
David Tolnay435c1782018-08-24 16:15:44 -04001740 ForeignItem::Macro(_binding_0) => {
1741 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1742 }
David Tolnay8c81f622018-07-31 23:34:35 -07001743 ForeignItem::Verbatim(_binding_0) => {
1744 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001745 }
Nika Layzell27726662017-10-24 23:16:35 -04001746 }
1747}
David Tolnay8c81f622018-07-31 23:34:35 -07001748#[cfg(feature = "full")]
1749pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1750 _visitor: &mut V,
1751 _i: ForeignItemFn,
1752) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001753 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001754 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1755 vis: _visitor.fold_visibility(_i.vis),
1756 ident: _visitor.fold_ident(_i.ident),
1757 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001758 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001759 }
1760}
David Tolnay8c81f622018-07-31 23:34:35 -07001761#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001762pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1763 _visitor: &mut V,
1764 _i: ForeignItemMacro,
1765) -> ForeignItemMacro {
1766 ForeignItemMacro {
1767 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1768 mac: _visitor.fold_macro(_i.mac),
1769 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1770 }
1771}
1772#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001773pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1774 _visitor: &mut V,
1775 _i: ForeignItemStatic,
1776) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001777 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001778 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1779 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001780 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1781 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001782 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001783 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001784 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001785 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001786 }
1787}
David Tolnay8c81f622018-07-31 23:34:35 -07001788#[cfg(feature = "full")]
1789pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1790 _visitor: &mut V,
1791 _i: ForeignItemType,
1792) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001793 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001794 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1795 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001796 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001797 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001798 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001799 }
1800}
David Tolnay8c81f622018-07-31 23:34:35 -07001801#[cfg(feature = "full")]
1802pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1803 _visitor: &mut V,
1804 _i: ForeignItemVerbatim,
1805) -> ForeignItemVerbatim {
1806 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001807}
David Tolnay8c81f622018-07-31 23:34:35 -07001808#[cfg(any(feature = "full", feature = "derive"))]
1809pub fn fold_generic_argument<V: Fold + ?Sized>(
1810 _visitor: &mut V,
1811 _i: GenericArgument,
1812) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001813 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001814 GenericArgument::Lifetime(_binding_0) => {
1815 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001816 }
David Tolnay8c81f622018-07-31 23:34:35 -07001817 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1818 GenericArgument::Binding(_binding_0) => {
1819 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001820 }
David Tolnay8c81f622018-07-31 23:34:35 -07001821 GenericArgument::Const(_binding_0) => {
1822 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001823 }
Nika Layzell357885a2017-12-04 15:47:07 -05001824 }
1825}
David Tolnay8c81f622018-07-31 23:34:35 -07001826#[cfg(any(feature = "full", feature = "derive"))]
1827#[cfg(feature = "full")]
1828pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1829 _visitor: &mut V,
1830 _i: GenericMethodArgument,
1831) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001832 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001833 GenericMethodArgument::Type(_binding_0) => {
1834 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001835 }
David Tolnay8c81f622018-07-31 23:34:35 -07001836 GenericMethodArgument::Const(_binding_0) => {
1837 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001838 }
1839 }
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_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001843 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001844 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1845 GenericParam::Lifetime(_binding_0) => {
1846 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001847 }
David Tolnay8c81f622018-07-31 23:34:35 -07001848 GenericParam::Const(_binding_0) => {
1849 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001850 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001851 }
1852}
David Tolnay8c81f622018-07-31 23:34:35 -07001853#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001854pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001855 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001856 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001857 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001858 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001859 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001860 }
1861}
Alex Crichtond261d092018-05-18 13:47:35 -07001862pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001863 let mut _i = _i;
1864 let span = _visitor.fold_span(_i.span());
1865 _i.set_span(span);
1866 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001867}
David Tolnay8c81f622018-07-31 23:34:35 -07001868#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001869pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001870 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001871 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1872 ImplItem::Method(_binding_0) => {
1873 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001874 }
David Tolnay8c81f622018-07-31 23:34:35 -07001875 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001876 ImplItem::Existential(_binding_0) => {
1877 ImplItem::Existential(_visitor.fold_impl_item_existential(_binding_0))
1878 }
David Tolnay8c81f622018-07-31 23:34:35 -07001879 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1880 ImplItem::Verbatim(_binding_0) => {
1881 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001882 }
Nika Layzell27726662017-10-24 23:16:35 -04001883 }
1884}
David Tolnay8c81f622018-07-31 23:34:35 -07001885#[cfg(feature = "full")]
1886pub fn fold_impl_item_const<V: Fold + ?Sized>(
1887 _visitor: &mut V,
1888 _i: ImplItemConst,
1889) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001890 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001891 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1892 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001893 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1894 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001895 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001896 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001897 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001898 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001899 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001900 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001901 }
1902}
David Tolnay8c81f622018-07-31 23:34:35 -07001903#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001904pub fn fold_impl_item_existential<V: Fold + ?Sized>(
1905 _visitor: &mut V,
1906 _i: ImplItemExistential,
1907) -> ImplItemExistential {
1908 ImplItemExistential {
1909 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1910 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
1911 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
1912 ident: _visitor.fold_ident(_i.ident),
1913 generics: _visitor.fold_generics(_i.generics),
1914 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1915 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1916 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1917 }
1918}
1919#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001920pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1921 _visitor: &mut V,
1922 _i: ImplItemMacro,
1923) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001924 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001925 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1926 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001927 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001928 }
1929}
David Tolnay8c81f622018-07-31 23:34:35 -07001930#[cfg(feature = "full")]
1931pub fn fold_impl_item_method<V: Fold + ?Sized>(
1932 _visitor: &mut V,
1933 _i: ImplItemMethod,
1934) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001935 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001936 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1937 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001938 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001939 sig: _visitor.fold_method_sig(_i.sig),
1940 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001941 }
1942}
David Tolnay8c81f622018-07-31 23:34:35 -07001943#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001944pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001945 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001946 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1947 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001948 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1949 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001950 ident: _visitor.fold_ident(_i.ident),
1951 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001952 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001953 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001954 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001955 }
1956}
David Tolnay8c81f622018-07-31 23:34:35 -07001957#[cfg(feature = "full")]
1958pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1959 _visitor: &mut V,
1960 _i: ImplItemVerbatim,
1961) -> ImplItemVerbatim {
1962 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001963}
David Tolnay8c81f622018-07-31 23:34:35 -07001964#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001965pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001966 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001967 index: _i.index,
1968 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001969 }
1970}
David Tolnay8c81f622018-07-31 23:34:35 -07001971#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001972pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001973 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001974 Item::ExternCrate(_binding_0) => {
1975 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001976 }
David Tolnay8c81f622018-07-31 23:34:35 -07001977 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1978 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1979 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1980 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1981 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1982 Item::ForeignMod(_binding_0) => {
1983 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001984 }
David Tolnay8c81f622018-07-31 23:34:35 -07001985 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001986 Item::Existential(_binding_0) => {
1987 Item::Existential(_visitor.fold_item_existential(_binding_0))
1988 }
David Tolnay8c81f622018-07-31 23:34:35 -07001989 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1990 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1991 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1992 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07001993 Item::TraitAlias(_binding_0) => {
1994 Item::TraitAlias(_visitor.fold_item_trait_alias(_binding_0))
1995 }
David Tolnay8c81f622018-07-31 23:34:35 -07001996 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1997 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1998 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1999 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002000 }
2001}
David Tolnay8c81f622018-07-31 23:34:35 -07002002#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002003pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002004 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002005 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2006 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002007 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002008 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002009 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002010 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002011 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002012 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002013 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002014 }
2015}
David Tolnay8c81f622018-07-31 23:34:35 -07002016#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002017pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002018 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07002019 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2020 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002021 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002022 ident: _visitor.fold_ident(_i.ident),
2023 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002024 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002025 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002026 }
2027}
David Tolnay8c81f622018-07-31 23:34:35 -07002028#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04002029pub fn fold_item_existential<V: Fold + ?Sized>(
2030 _visitor: &mut V,
2031 _i: ItemExistential,
2032) -> ItemExistential {
2033 ItemExistential {
2034 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2035 vis: _visitor.fold_visibility(_i.vis),
2036 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
2037 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
2038 ident: _visitor.fold_ident(_i.ident),
2039 generics: _visitor.fold_generics(_i.generics),
2040 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
2041 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2042 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2043 }
2044}
2045#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07002046pub fn fold_item_extern_crate<V: Fold + ?Sized>(
2047 _visitor: &mut V,
2048 _i: ItemExternCrate,
2049) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002050 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07002051 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2052 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002053 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
2054 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002055 ident: _visitor.fold_ident(_i.ident),
2056 rename: (_i.rename).map(|it| {
2057 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002058 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002059 _visitor.fold_ident((it).1),
2060 )
2061 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002062 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002063 }
2064}
David Tolnay8c81f622018-07-31 23:34:35 -07002065#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002066pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002067 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07002068 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2069 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002070 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2071 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002072 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002073 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2074 ident: _visitor.fold_ident(_i.ident),
2075 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2076 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002077 }
2078}
David Tolnay8c81f622018-07-31 23:34:35 -07002079#[cfg(feature = "full")]
2080pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2081 _visitor: &mut V,
2082 _i: ItemForeignMod,
2083) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002084 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002085 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2086 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002087 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002088 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002089 }
2090}
David Tolnay8c81f622018-07-31 23:34:35 -07002091#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002092pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002093 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002094 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002095 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2096 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2097 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002098 generics: _visitor.fold_generics(_i.generics),
2099 trait_: (_i.trait_).map(|it| {
2100 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002101 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002102 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002103 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002104 )
2105 }),
2106 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002107 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002108 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002109 }
2110}
David Tolnay8c81f622018-07-31 23:34:35 -07002111#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002112pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002113 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002114 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2115 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2116 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002117 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002118 }
2119}
David Tolnay8c81f622018-07-31 23:34:35 -07002120#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002121pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002122 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002123 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2124 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002125 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002126 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002127 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002128 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002129 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002130 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002131 }
2132}
David Tolnay8c81f622018-07-31 23:34:35 -07002133#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002134pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002135 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002136 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2137 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002138 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002139 ident: _visitor.fold_ident(_i.ident),
2140 content: (_i.content).map(|it| {
2141 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002142 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002143 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2144 )
2145 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002146 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002147 }
2148}
David Tolnay8c81f622018-07-31 23:34:35 -07002149#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002150pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002151 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002152 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2153 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002154 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2155 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002156 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002157 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002158 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002159 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002160 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002161 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002162 }
2163}
David Tolnay8c81f622018-07-31 23:34:35 -07002164#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002165pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002166 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002167 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2168 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002169 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002170 ident: _visitor.fold_ident(_i.ident),
2171 generics: _visitor.fold_generics(_i.generics),
2172 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002173 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002174 }
2175}
David Tolnay8c81f622018-07-31 23:34:35 -07002176#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002177pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002178 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002179 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2180 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002181 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2182 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2183 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002184 ident: _visitor.fold_ident(_i.ident),
2185 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002186 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002187 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002188 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002189 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002190 }
2191}
David Tolnay8c81f622018-07-31 23:34:35 -07002192#[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -07002193pub fn fold_item_trait_alias<V: Fold + ?Sized>(
2194 _visitor: &mut V,
2195 _i: ItemTraitAlias,
2196) -> ItemTraitAlias {
2197 ItemTraitAlias {
2198 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2199 vis: _visitor.fold_visibility(_i.vis),
2200 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
2201 ident: _visitor.fold_ident(_i.ident),
2202 generics: _visitor.fold_generics(_i.generics),
2203 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
2204 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2205 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2206 }
2207}
2208#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002209pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002210 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002211 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2212 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002213 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002214 ident: _visitor.fold_ident(_i.ident),
2215 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002216 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002217 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002218 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002219 }
2220}
David Tolnay8c81f622018-07-31 23:34:35 -07002221#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002222pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002223 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002224 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2225 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002226 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002227 ident: _visitor.fold_ident(_i.ident),
2228 generics: _visitor.fold_generics(_i.generics),
2229 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002230 }
2231}
David Tolnay8c81f622018-07-31 23:34:35 -07002232#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002233pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002234 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002235 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2236 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002237 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002238 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002239 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002240 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002241 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002242 }
2243}
David Tolnay8c81f622018-07-31 23:34:35 -07002244#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002245pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002246 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002247}
David Tolnay8c81f622018-07-31 23:34:35 -07002248#[cfg(any(feature = "full", feature = "derive"))]
2249#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002250pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002251 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002252 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002253 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002254 }
2255}
David Tolnay8c81f622018-07-31 23:34:35 -07002256#[cfg(any(feature = "full", feature = "derive"))]
Alex Crichton131308c2018-05-18 14:00:24 -07002257pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2258 Lifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002259 apostrophe: _i.apostrophe,
2260 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002261 }
2262}
David Tolnay8c81f622018-07-31 23:34:35 -07002263#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002264pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002265 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002266 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2267 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002268 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002269 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002270 }
2271}
David Tolnay8c81f622018-07-31 23:34:35 -07002272#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002273pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002274 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002275 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2276 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2277 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2278 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2279 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2280 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2281 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2282 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002283 }
2284}
David Tolnay8c81f622018-07-31 23:34:35 -07002285#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002286pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002287 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002288 value: _i.value,
2289 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002290 }
2291}
David Tolnay8c81f622018-07-31 23:34:35 -07002292#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002293pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002294 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002295}
David Tolnay8c81f622018-07-31 23:34:35 -07002296#[cfg(any(feature = "full", feature = "derive"))]
2297#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002298pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002299 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002300 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002301 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002302 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2303 ty: (_i.ty).map(|it| {
2304 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002305 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002306 Box::new(_visitor.fold_type(*(it).1)),
2307 )
2308 }),
2309 init: (_i.init).map(|it| {
2310 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002311 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002312 Box::new(_visitor.fold_expr(*(it).1)),
2313 )
2314 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002315 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002316 }
2317}
David Tolnay8c81f622018-07-31 23:34:35 -07002318#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002319pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002320 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002321 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002322 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002323 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2324 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002325 }
2326}
David Tolnay8c81f622018-07-31 23:34:35 -07002327#[cfg(any(feature = "full", feature = "derive"))]
2328pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2329 _visitor: &mut V,
2330 _i: MacroDelimiter,
2331) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002332 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002333 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002334 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002335 }
David Tolnay8c81f622018-07-31 23:34:35 -07002336 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002337 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002338 }
David Tolnay8c81f622018-07-31 23:34:35 -07002339 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002340 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002341 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002342 }
2343}
David Tolnay8c81f622018-07-31 23:34:35 -07002344#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002345pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002346 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002347 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2348 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002349 }
2350}
David Tolnay8c81f622018-07-31 23:34:35 -07002351#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002352pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002353 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002354 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2355 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2356 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002357 }
2358}
David Tolnay8c81f622018-07-31 23:34:35 -07002359#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002360pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2361 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002362 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002363 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002364 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002365 }
2366}
David Tolnay8c81f622018-07-31 23:34:35 -07002367#[cfg(any(feature = "full", feature = "derive"))]
2368pub fn fold_meta_name_value<V: Fold + ?Sized>(
2369 _visitor: &mut V,
2370 _i: MetaNameValue,
2371) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002372 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002373 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002374 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002375 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002376 }
2377}
David Tolnay8c81f622018-07-31 23:34:35 -07002378#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002379pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002380 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002381 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2382 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002383 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002384 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2385 ident: _visitor.fold_ident(_i.ident),
2386 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002387 }
2388}
David Tolnay8c81f622018-07-31 23:34:35 -07002389#[cfg(any(feature = "full", feature = "derive"))]
2390#[cfg(feature = "full")]
2391pub fn fold_method_turbofish<V: Fold + ?Sized>(
2392 _visitor: &mut V,
2393 _i: MethodTurbofish,
2394) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002395 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002396 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2397 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002398 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002399 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002400 }
2401}
David Tolnay8c81f622018-07-31 23:34:35 -07002402#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002403pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002404 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002405 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2406 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002407 }
2408}
David Tolnay8c81f622018-07-31 23:34:35 -07002409#[cfg(any(feature = "full", feature = "derive"))]
2410pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2411 _visitor: &mut V,
2412 _i: ParenthesizedGenericArguments,
2413) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002414 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002415 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002416 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2417 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002418 }
2419}
David Tolnay8c81f622018-07-31 23:34:35 -07002420#[cfg(any(feature = "full", feature = "derive"))]
2421#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002422pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002423 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002424 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2425 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2426 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2427 Pat::TupleStruct(_binding_0) => {
2428 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002429 }
David Tolnay8c81f622018-07-31 23:34:35 -07002430 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2431 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2432 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2433 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2434 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2435 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2436 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2437 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2438 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002439 }
2440}
David Tolnay8c81f622018-07-31 23:34:35 -07002441#[cfg(any(feature = "full", feature = "derive"))]
2442#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002443pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002444 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002445 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002446 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002447 }
2448}
David Tolnay8c81f622018-07-31 23:34:35 -07002449#[cfg(any(feature = "full", feature = "derive"))]
2450#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002451pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002452 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002453 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2454 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002455 ident: _visitor.fold_ident(_i.ident),
2456 subpat: (_i.subpat).map(|it| {
2457 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002458 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002459 Box::new(_visitor.fold_pat(*(it).1)),
2460 )
2461 }),
Nika Layzell27726662017-10-24 23:16:35 -04002462 }
2463}
David Tolnay8c81f622018-07-31 23:34:35 -07002464#[cfg(any(feature = "full", feature = "derive"))]
2465#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002466pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002467 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002468 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002469 }
2470}
David Tolnay8c81f622018-07-31 23:34:35 -07002471#[cfg(any(feature = "full", feature = "derive"))]
2472#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002473pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002474 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002475 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002476 }
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_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002481 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002482 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2483 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002484 }
2485}
David Tolnay8c81f622018-07-31 23:34:35 -07002486#[cfg(any(feature = "full", feature = "derive"))]
2487#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002488pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002489 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002490 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2491 limits: _visitor.fold_range_limits(_i.limits),
2492 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002493 }
2494}
David Tolnay8c81f622018-07-31 23:34:35 -07002495#[cfg(any(feature = "full", feature = "derive"))]
2496#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002497pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002498 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002499 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2500 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002501 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002502 }
2503}
David Tolnay8c81f622018-07-31 23:34:35 -07002504#[cfg(any(feature = "full", feature = "derive"))]
2505#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002506pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002507 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002508 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002509 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2510 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002511 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2512 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002513 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002514 }
2515}
David Tolnay8c81f622018-07-31 23:34:35 -07002516#[cfg(any(feature = "full", feature = "derive"))]
2517#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002518pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002519 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002520 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002521 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002522 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002523 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002524 }
2525}
David Tolnay8c81f622018-07-31 23:34:35 -07002526#[cfg(any(feature = "full", feature = "derive"))]
2527#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002528pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002529 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002530 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002531 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002532 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2533 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002534 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002535 }
2536}
David Tolnay8c81f622018-07-31 23:34:35 -07002537#[cfg(any(feature = "full", feature = "derive"))]
2538#[cfg(feature = "full")]
2539pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2540 _visitor: &mut V,
2541 _i: PatTupleStruct,
2542) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002543 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002544 path: _visitor.fold_path(_i.path),
2545 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002546 }
2547}
David Tolnay8c81f622018-07-31 23:34:35 -07002548#[cfg(any(feature = "full", feature = "derive"))]
2549#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002550pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002551 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002552}
David Tolnay8c81f622018-07-31 23:34:35 -07002553#[cfg(any(feature = "full", feature = "derive"))]
2554#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002555pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002556 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002557 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002558 }
2559}
David Tolnay8c81f622018-07-31 23:34:35 -07002560#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002561pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002562 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002563 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002564 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002565 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002566 }
2567}
David Tolnay8c81f622018-07-31 23:34:35 -07002568#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002569pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002570 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002571 PathArguments::None => PathArguments::None,
2572 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2573 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2574 ),
2575 PathArguments::Parenthesized(_binding_0) => {
2576 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002577 }
2578 }
2579}
David Tolnay8c81f622018-07-31 23:34:35 -07002580#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002581pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002582 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002583 ident: _visitor.fold_ident(_i.ident),
2584 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002585 }
2586}
David Tolnay8c81f622018-07-31 23:34:35 -07002587#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002588pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002589 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002590 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002591 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002592 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002593 }
2594}
David Tolnay8c81f622018-07-31 23:34:35 -07002595#[cfg(any(feature = "full", feature = "derive"))]
2596pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2597 _visitor: &mut V,
2598 _i: PredicateLifetime,
2599) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002600 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002601 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay1b8e2852018-08-26 08:25:18 -04002602 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002603 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002604 }
2605}
David Tolnay8c81f622018-07-31 23:34:35 -07002606#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002607pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002608 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002609 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2610 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002611 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002612 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002613 }
2614}
David Tolnay8c81f622018-07-31 23:34:35 -07002615#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002616pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002617 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002618 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002619 ty: Box::new(_visitor.fold_type(*_i.ty)),
2620 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002621 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2622 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002623 }
2624}
David Tolnay8c81f622018-07-31 23:34:35 -07002625#[cfg(any(feature = "full", feature = "derive"))]
2626#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002627pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002628 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002629 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002630 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002631 }
David Tolnay8c81f622018-07-31 23:34:35 -07002632 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002633 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002634 }
2635 }
2636}
David Tolnay8c81f622018-07-31 23:34:35 -07002637#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002638pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002639 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002640 ReturnType::Default => ReturnType::Default,
2641 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002642 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002643 Box::new(_visitor.fold_type(*_binding_1)),
2644 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002645 }
2646}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002647pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002648 _i
2649}
David Tolnay8c81f622018-07-31 23:34:35 -07002650#[cfg(any(feature = "full", feature = "derive"))]
2651#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002652pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002653 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002654 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2655 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2656 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2657 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2658 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002659 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002660 ),
Nika Layzell27726662017-10-24 23:16:35 -04002661 }
2662}
David Tolnay8c81f622018-07-31 23:34:35 -07002663#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002664pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002665 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002666 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002667 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2668 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2669 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002670 }
2671}
David Tolnay8c81f622018-07-31 23:34:35 -07002672#[cfg(any(feature = "full", feature = "derive"))]
2673pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2674 _visitor: &mut V,
2675 _i: TraitBoundModifier,
2676) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002677 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002678 TraitBoundModifier::None => TraitBoundModifier::None,
2679 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002680 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002681 }
2682 }
2683}
David Tolnay8c81f622018-07-31 23:34:35 -07002684#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002685pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002686 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002687 TraitItem::Const(_binding_0) => {
2688 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002689 }
David Tolnay8c81f622018-07-31 23:34:35 -07002690 TraitItem::Method(_binding_0) => {
2691 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002692 }
David Tolnay8c81f622018-07-31 23:34:35 -07002693 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2694 TraitItem::Macro(_binding_0) => {
2695 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002696 }
David Tolnay8c81f622018-07-31 23:34:35 -07002697 TraitItem::Verbatim(_binding_0) => {
2698 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002699 }
Nika Layzell27726662017-10-24 23:16:35 -04002700 }
2701}
David Tolnay8c81f622018-07-31 23:34:35 -07002702#[cfg(feature = "full")]
2703pub fn fold_trait_item_const<V: Fold + ?Sized>(
2704 _visitor: &mut V,
2705 _i: TraitItemConst,
2706) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002707 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002708 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002709 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002710 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002711 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002712 ty: _visitor.fold_type(_i.ty),
2713 default: (_i.default).map(|it| {
2714 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002715 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002716 _visitor.fold_expr((it).1),
2717 )
2718 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002719 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002720 }
2721}
David Tolnay8c81f622018-07-31 23:34:35 -07002722#[cfg(feature = "full")]
2723pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2724 _visitor: &mut V,
2725 _i: TraitItemMacro,
2726) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002727 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002728 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2729 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002730 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002731 }
2732}
David Tolnay8c81f622018-07-31 23:34:35 -07002733#[cfg(feature = "full")]
2734pub fn fold_trait_item_method<V: Fold + ?Sized>(
2735 _visitor: &mut V,
2736 _i: TraitItemMethod,
2737) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002738 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002739 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2740 sig: _visitor.fold_method_sig(_i.sig),
2741 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002742 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002743 }
2744}
David Tolnay8c81f622018-07-31 23:34:35 -07002745#[cfg(feature = "full")]
2746pub fn fold_trait_item_type<V: Fold + ?Sized>(
2747 _visitor: &mut V,
2748 _i: TraitItemType,
2749) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002750 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002751 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002752 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002753 ident: _visitor.fold_ident(_i.ident),
2754 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002755 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002756 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2757 default: (_i.default).map(|it| {
2758 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002759 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002760 _visitor.fold_type((it).1),
2761 )
2762 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002763 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002764 }
2765}
David Tolnay8c81f622018-07-31 23:34:35 -07002766#[cfg(feature = "full")]
2767pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2768 _visitor: &mut V,
2769 _i: TraitItemVerbatim,
2770) -> TraitItemVerbatim {
2771 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002772}
David Tolnay8c81f622018-07-31 23:34:35 -07002773#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002774pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002775 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002776 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2777 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2778 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2779 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2780 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2781 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2782 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2783 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2784 Type::TraitObject(_binding_0) => {
2785 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002786 }
David Tolnay8c81f622018-07-31 23:34:35 -07002787 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2788 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2789 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2790 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2791 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2792 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002793 }
2794}
David Tolnay8c81f622018-07-31 23:34:35 -07002795#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002796pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002797 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002798 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002799 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002800 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002801 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002802 }
2803}
David Tolnay8c81f622018-07-31 23:34:35 -07002804#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002805pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002806 TypeBareFn {
David Tolnay3779bb72018-08-26 18:46:07 -07002807 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002808 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002809 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002810 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002811 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002812 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002813 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002814 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002815 }
2816}
David Tolnay8c81f622018-07-31 23:34:35 -07002817#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002818pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002819 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002820 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002821 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002822 }
2823}
David Tolnay8c81f622018-07-31 23:34:35 -07002824#[cfg(any(feature = "full", feature = "derive"))]
2825pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2826 _visitor: &mut V,
2827 _i: TypeImplTrait,
2828) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002829 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002830 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002831 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002832 }
2833}
David Tolnay8c81f622018-07-31 23:34:35 -07002834#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002835pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002836 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002837 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
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_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002842 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002843 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002844 }
2845}
David Tolnay8c81f622018-07-31 23:34:35 -07002846#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002847pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002848 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002849 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002850 }
2851}
David Tolnay8c81f622018-07-31 23:34:35 -07002852#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002853pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002854 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002855 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2856 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002857 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002858 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002859 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002860 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002861 }
2862}
David Tolnay8c81f622018-07-31 23:34:35 -07002863#[cfg(any(feature = "full", feature = "derive"))]
2864pub fn fold_type_param_bound<V: Fold + ?Sized>(
2865 _visitor: &mut V,
2866 _i: TypeParamBound,
2867) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002868 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002869 TypeParamBound::Trait(_binding_0) => {
2870 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002871 }
David Tolnay8c81f622018-07-31 23:34:35 -07002872 TypeParamBound::Lifetime(_binding_0) => {
2873 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002874 }
2875 }
2876}
David Tolnay8c81f622018-07-31 23:34:35 -07002877#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002878pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002879 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002880 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002881 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002882 }
2883}
David Tolnay8c81f622018-07-31 23:34:35 -07002884#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002885pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002886 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002887 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2888 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002889 }
2890}
David Tolnay8c81f622018-07-31 23:34:35 -07002891#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002892pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002893 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002894 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2895 const_token: (_i.const_token)
2896 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2897 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002898 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002899 }
2900}
David Tolnay8c81f622018-07-31 23:34:35 -07002901#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002902pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002903 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002904 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002905 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002906 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002907 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002908 }
2909}
David Tolnay8c81f622018-07-31 23:34:35 -07002910#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002911pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002912 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002913 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002914 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002915 }
2916}
David Tolnay8c81f622018-07-31 23:34:35 -07002917#[cfg(any(feature = "full", feature = "derive"))]
2918pub fn fold_type_trait_object<V: Fold + ?Sized>(
2919 _visitor: &mut V,
2920 _i: TypeTraitObject,
2921) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002922 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002923 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002924 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002925 }
2926}
David Tolnay8c81f622018-07-31 23:34:35 -07002927#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002928pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002929 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002930 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002931 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002932 }
2933}
David Tolnay8c81f622018-07-31 23:34:35 -07002934#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002935pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002936 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002937}
David Tolnay8c81f622018-07-31 23:34:35 -07002938#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002939pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002940 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002941 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002942 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002943 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002944 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2945 UnOp::Neg(_binding_0) => {
2946 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2947 }
Nika Layzell27726662017-10-24 23:16:35 -04002948 }
2949}
David Tolnay8c81f622018-07-31 23:34:35 -07002950#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002951pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002952 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002953 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002954 }
2955}
David Tolnay8c81f622018-07-31 23:34:35 -07002956#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002957pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2958 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002959 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002960 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002961 }
2962}
David Tolnay8c81f622018-07-31 23:34:35 -07002963#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002964pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2965 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002966 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002967 }
2968}
David Tolnay8c81f622018-07-31 23:34:35 -07002969#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002970pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002971 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002972 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002973 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002974 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002975 }
2976}
David Tolnay8c81f622018-07-31 23:34:35 -07002977#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002978pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2979 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002980 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002981 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002982 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002983 }
2984}
David Tolnay8c81f622018-07-31 23:34:35 -07002985#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002986pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002987 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002988 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2989 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2990 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2991 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2992 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002993 }
2994}
David Tolnay8c81f622018-07-31 23:34:35 -07002995#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002996pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002997 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002998 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2999 ident: _visitor.fold_ident(_i.ident),
3000 fields: _visitor.fold_fields(_i.fields),
3001 discriminant: (_i.discriminant).map(|it| {
3002 (
David Tolnay7ac699c2018-08-24 14:00:58 -04003003 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07003004 _visitor.fold_expr((it).1),
3005 )
3006 }),
Nika Layzell27726662017-10-24 23:16:35 -04003007 }
3008}
David Tolnay8c81f622018-07-31 23:34:35 -07003009#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003010pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04003011 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04003012 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04003013 }
3014}
David Tolnay8c81f622018-07-31 23:34:35 -07003015#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003016pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04003017 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04003018 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04003019 }
3020}
David Tolnay8c81f622018-07-31 23:34:35 -07003021#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003022pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04003023 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04003024 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
3025 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
3026 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07003027 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04003028 }
3029}
David Tolnay8c81f622018-07-31 23:34:35 -07003030#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003031pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04003032 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003033 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
3034 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
3035 Visibility::Restricted(_binding_0) => {
3036 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003037 }
David Tolnay8c81f622018-07-31 23:34:35 -07003038 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04003039 }
3040}
David Tolnay8c81f622018-07-31 23:34:35 -07003041#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003042pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04003043 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04003044 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07003045 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04003046 }
3047}
David Tolnay8c81f622018-07-31 23:34:35 -07003048#[cfg(any(feature = "full", feature = "derive"))]
3049pub fn fold_where_predicate<V: Fold + ?Sized>(
3050 _visitor: &mut V,
3051 _i: WherePredicate,
3052) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04003053 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003054 WherePredicate::Type(_binding_0) => {
3055 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003056 }
David Tolnay8c81f622018-07-31 23:34:35 -07003057 WherePredicate::Lifetime(_binding_0) => {
3058 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003059 }
David Tolnay8c81f622018-07-31 23:34:35 -07003060 WherePredicate::Eq(_binding_0) => {
3061 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003062 }
3063 }
3064}