blob: b79205394ea45b9b3d938c5f69ebe9c28a266413 [file] [log] [blame]
Nika Layzell27726662017-10-24 23:16:35 -04001// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
2
Nika Layzell27726662017-10-24 23:16:35 -04003#![allow(unreachable_code)]
David Tolnayf0d63bf2017-12-26 12:29:47 -05004#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
David Tolnay0a0d78c2018-01-05 15:24:01 -08005#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05006use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07007use proc_macro2::Span;
8#[cfg(any(feature = "full", feature = "derive"))]
9use token::{Brace, Bracket, Group, Paren};
10use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040011#[cfg(feature = "full")]
12macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070013 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070014 $e
15 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040016}
David Tolnay0a0d78c2018-01-05 15:24:01 -080017#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040018macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070019 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070020 unreachable!()
21 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040022}
David Tolnay6af48992018-08-01 11:16:28 -070023#[doc = r" Syntax tree traversal to transform the nodes of an owned syntax tree."]
24#[doc = r""]
25#[doc = r" See the [module documentation] for details."]
26#[doc = r""]
27#[doc = r" [module documentation]: index.html"]
28#[doc = r""]
29#[doc = r#" *This trait is available if Syn is built with the `"fold"` feature.*"#]
David Tolnay4b4c4b62018-01-06 13:48:05 -080030pub trait Fold {
David Tolnay8c81f622018-07-31 23:34:35 -070031 #[cfg(any(feature = "full", feature = "derive"))]
32 fn fold_abi(&mut self, i: Abi) -> Abi {
33 fold_abi(self, i)
34 }
35 #[cfg(any(feature = "full", feature = "derive"))]
36 fn fold_angle_bracketed_generic_arguments(
37 &mut self,
38 i: AngleBracketedGenericArguments,
39 ) -> AngleBracketedGenericArguments {
40 fold_angle_bracketed_generic_arguments(self, i)
41 }
42 #[cfg(feature = "full")]
43 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
44 fold_arg_captured(self, i)
45 }
46 #[cfg(feature = "full")]
47 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
48 fold_arg_self(self, i)
49 }
50 #[cfg(feature = "full")]
51 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
52 fold_arg_self_ref(self, i)
53 }
54 #[cfg(any(feature = "full", feature = "derive"))]
55 #[cfg(feature = "full")]
56 fn fold_arm(&mut self, i: Arm) -> Arm {
57 fold_arm(self, i)
58 }
59 #[cfg(any(feature = "full", feature = "derive"))]
60 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
61 fold_attr_style(self, i)
62 }
63 #[cfg(any(feature = "full", feature = "derive"))]
64 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
65 fold_attribute(self, i)
66 }
67 #[cfg(any(feature = "full", feature = "derive"))]
68 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
69 fold_bare_fn_arg(self, i)
70 }
71 #[cfg(any(feature = "full", feature = "derive"))]
72 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
73 fold_bare_fn_arg_name(self, i)
74 }
75 #[cfg(any(feature = "full", feature = "derive"))]
76 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
77 fold_bin_op(self, i)
78 }
79 #[cfg(any(feature = "full", feature = "derive"))]
80 fn fold_binding(&mut self, i: Binding) -> Binding {
81 fold_binding(self, i)
82 }
83 #[cfg(any(feature = "full", feature = "derive"))]
84 #[cfg(feature = "full")]
85 fn fold_block(&mut self, i: Block) -> Block {
86 fold_block(self, i)
87 }
88 #[cfg(any(feature = "full", feature = "derive"))]
89 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
90 fold_bound_lifetimes(self, i)
91 }
92 #[cfg(any(feature = "full", feature = "derive"))]
93 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
94 fold_const_param(self, i)
95 }
96 #[cfg(feature = "derive")]
97 fn fold_data(&mut self, i: Data) -> Data {
98 fold_data(self, i)
99 }
100 #[cfg(feature = "derive")]
101 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
102 fold_data_enum(self, i)
103 }
104 #[cfg(feature = "derive")]
105 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
106 fold_data_struct(self, i)
107 }
108 #[cfg(feature = "derive")]
109 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
110 fold_data_union(self, i)
111 }
112 #[cfg(feature = "derive")]
113 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
114 fold_derive_input(self, i)
115 }
116 #[cfg(any(feature = "full", feature = "derive"))]
117 fn fold_expr(&mut self, i: Expr) -> Expr {
118 fold_expr(self, i)
119 }
120 #[cfg(feature = "full")]
121 #[cfg(any(feature = "full", feature = "derive"))]
122 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
123 fold_expr_array(self, i)
124 }
125 #[cfg(feature = "full")]
126 #[cfg(any(feature = "full", feature = "derive"))]
127 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
128 fold_expr_assign(self, i)
129 }
130 #[cfg(feature = "full")]
131 #[cfg(any(feature = "full", feature = "derive"))]
132 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
133 fold_expr_assign_op(self, i)
134 }
David Tolnay02a9c6f2018-08-24 18:58:45 -0400135 #[cfg(feature = "full")]
136 #[cfg(any(feature = "full", feature = "derive"))]
137 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
138 fold_expr_async(self, i)
139 }
David Tolnay8c81f622018-07-31 23:34:35 -0700140 #[cfg(any(feature = "full", feature = "derive"))]
141 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
142 fold_expr_binary(self, i)
143 }
144 #[cfg(feature = "full")]
145 #[cfg(any(feature = "full", feature = "derive"))]
146 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
147 fold_expr_block(self, i)
148 }
149 #[cfg(feature = "full")]
150 #[cfg(any(feature = "full", feature = "derive"))]
151 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
152 fold_expr_box(self, i)
153 }
154 #[cfg(feature = "full")]
155 #[cfg(any(feature = "full", feature = "derive"))]
156 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
157 fold_expr_break(self, i)
158 }
159 #[cfg(any(feature = "full", feature = "derive"))]
160 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
161 fold_expr_call(self, i)
162 }
163 #[cfg(any(feature = "full", feature = "derive"))]
164 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
165 fold_expr_cast(self, i)
166 }
167 #[cfg(feature = "full")]
168 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700169 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
170 fold_expr_closure(self, i)
171 }
172 #[cfg(feature = "full")]
173 #[cfg(any(feature = "full", feature = "derive"))]
174 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
175 fold_expr_continue(self, i)
176 }
177 #[cfg(any(feature = "full", feature = "derive"))]
178 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
179 fold_expr_field(self, i)
180 }
181 #[cfg(feature = "full")]
182 #[cfg(any(feature = "full", feature = "derive"))]
183 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
184 fold_expr_for_loop(self, i)
185 }
186 #[cfg(feature = "full")]
187 #[cfg(any(feature = "full", feature = "derive"))]
188 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
189 fold_expr_group(self, i)
190 }
191 #[cfg(feature = "full")]
192 #[cfg(any(feature = "full", feature = "derive"))]
193 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
194 fold_expr_if(self, i)
195 }
196 #[cfg(feature = "full")]
197 #[cfg(any(feature = "full", feature = "derive"))]
198 fn fold_expr_if_let(&mut self, i: ExprIfLet) -> ExprIfLet {
199 fold_expr_if_let(self, i)
200 }
201 #[cfg(feature = "full")]
202 #[cfg(any(feature = "full", feature = "derive"))]
203 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
204 fold_expr_in_place(self, i)
205 }
206 #[cfg(any(feature = "full", feature = "derive"))]
207 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
208 fold_expr_index(self, i)
209 }
210 #[cfg(any(feature = "full", feature = "derive"))]
211 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
212 fold_expr_lit(self, i)
213 }
214 #[cfg(feature = "full")]
215 #[cfg(any(feature = "full", feature = "derive"))]
216 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
217 fold_expr_loop(self, i)
218 }
219 #[cfg(feature = "full")]
220 #[cfg(any(feature = "full", feature = "derive"))]
221 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
222 fold_expr_macro(self, i)
223 }
224 #[cfg(feature = "full")]
225 #[cfg(any(feature = "full", feature = "derive"))]
226 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
227 fold_expr_match(self, i)
228 }
229 #[cfg(feature = "full")]
230 #[cfg(any(feature = "full", feature = "derive"))]
231 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
232 fold_expr_method_call(self, i)
233 }
234 #[cfg(any(feature = "full", feature = "derive"))]
235 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
236 fold_expr_paren(self, i)
237 }
238 #[cfg(any(feature = "full", feature = "derive"))]
239 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
240 fold_expr_path(self, i)
241 }
242 #[cfg(feature = "full")]
243 #[cfg(any(feature = "full", feature = "derive"))]
244 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
245 fold_expr_range(self, i)
246 }
247 #[cfg(feature = "full")]
248 #[cfg(any(feature = "full", feature = "derive"))]
249 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
250 fold_expr_reference(self, i)
251 }
252 #[cfg(feature = "full")]
253 #[cfg(any(feature = "full", feature = "derive"))]
254 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
255 fold_expr_repeat(self, i)
256 }
257 #[cfg(feature = "full")]
258 #[cfg(any(feature = "full", feature = "derive"))]
259 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
260 fold_expr_return(self, i)
261 }
262 #[cfg(feature = "full")]
263 #[cfg(any(feature = "full", feature = "derive"))]
264 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
265 fold_expr_struct(self, i)
266 }
267 #[cfg(feature = "full")]
268 #[cfg(any(feature = "full", feature = "derive"))]
269 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
270 fold_expr_try(self, i)
271 }
272 #[cfg(feature = "full")]
273 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -0400274 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
275 fold_expr_try_block(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700279 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
280 fold_expr_tuple(self, i)
281 }
282 #[cfg(feature = "full")]
283 #[cfg(any(feature = "full", feature = "derive"))]
284 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
285 fold_expr_type(self, i)
286 }
287 #[cfg(any(feature = "full", feature = "derive"))]
288 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
289 fold_expr_unary(self, i)
290 }
291 #[cfg(feature = "full")]
292 #[cfg(any(feature = "full", feature = "derive"))]
293 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
294 fold_expr_unsafe(self, i)
295 }
296 #[cfg(any(feature = "full", feature = "derive"))]
297 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
298 fold_expr_verbatim(self, i)
299 }
300 #[cfg(feature = "full")]
301 #[cfg(any(feature = "full", feature = "derive"))]
302 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
303 fold_expr_while(self, i)
304 }
305 #[cfg(feature = "full")]
306 #[cfg(any(feature = "full", feature = "derive"))]
307 fn fold_expr_while_let(&mut self, i: ExprWhileLet) -> ExprWhileLet {
308 fold_expr_while_let(self, i)
309 }
310 #[cfg(feature = "full")]
311 #[cfg(any(feature = "full", feature = "derive"))]
312 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
313 fold_expr_yield(self, i)
314 }
315 #[cfg(any(feature = "full", feature = "derive"))]
316 fn fold_field(&mut self, i: Field) -> Field {
317 fold_field(self, i)
318 }
319 #[cfg(any(feature = "full", feature = "derive"))]
320 #[cfg(feature = "full")]
321 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
322 fold_field_pat(self, i)
323 }
324 #[cfg(any(feature = "full", feature = "derive"))]
325 #[cfg(feature = "full")]
326 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
327 fold_field_value(self, i)
328 }
329 #[cfg(any(feature = "full", feature = "derive"))]
330 fn fold_fields(&mut self, i: Fields) -> Fields {
331 fold_fields(self, i)
332 }
333 #[cfg(any(feature = "full", feature = "derive"))]
334 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
335 fold_fields_named(self, i)
336 }
337 #[cfg(any(feature = "full", feature = "derive"))]
338 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
339 fold_fields_unnamed(self, i)
340 }
341 #[cfg(feature = "full")]
342 fn fold_file(&mut self, i: File) -> File {
343 fold_file(self, i)
344 }
345 #[cfg(feature = "full")]
346 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
347 fold_fn_arg(self, i)
348 }
349 #[cfg(feature = "full")]
350 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
351 fold_fn_decl(self, i)
352 }
353 #[cfg(feature = "full")]
354 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
355 fold_foreign_item(self, i)
356 }
357 #[cfg(feature = "full")]
358 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
359 fold_foreign_item_fn(self, i)
360 }
361 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400362 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
363 fold_foreign_item_macro(self, i)
364 }
365 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700366 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
367 fold_foreign_item_static(self, i)
368 }
369 #[cfg(feature = "full")]
370 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
371 fold_foreign_item_type(self, i)
372 }
373 #[cfg(feature = "full")]
374 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
375 fold_foreign_item_verbatim(self, i)
376 }
377 #[cfg(any(feature = "full", feature = "derive"))]
378 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
379 fold_generic_argument(self, i)
380 }
381 #[cfg(any(feature = "full", feature = "derive"))]
382 #[cfg(feature = "full")]
383 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
384 fold_generic_method_argument(self, i)
385 }
386 #[cfg(any(feature = "full", feature = "derive"))]
387 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
388 fold_generic_param(self, i)
389 }
390 #[cfg(any(feature = "full", feature = "derive"))]
391 fn fold_generics(&mut self, i: Generics) -> Generics {
392 fold_generics(self, i)
393 }
David Tolnay8c81f622018-07-31 23:34:35 -0700394 fn fold_ident(&mut self, i: Ident) -> Ident {
395 fold_ident(self, i)
396 }
397 #[cfg(feature = "full")]
398 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
399 fold_impl_item(self, i)
400 }
401 #[cfg(feature = "full")]
402 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
403 fold_impl_item_const(self, i)
404 }
405 #[cfg(feature = "full")]
406 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
407 fold_impl_item_macro(self, i)
408 }
409 #[cfg(feature = "full")]
410 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
411 fold_impl_item_method(self, i)
412 }
413 #[cfg(feature = "full")]
414 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
415 fold_impl_item_type(self, i)
416 }
417 #[cfg(feature = "full")]
418 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
419 fold_impl_item_verbatim(self, i)
420 }
421 #[cfg(any(feature = "full", feature = "derive"))]
422 fn fold_index(&mut self, i: Index) -> Index {
423 fold_index(self, i)
424 }
425 #[cfg(feature = "full")]
426 fn fold_item(&mut self, i: Item) -> Item {
427 fold_item(self, i)
428 }
429 #[cfg(feature = "full")]
430 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
431 fold_item_const(self, i)
432 }
433 #[cfg(feature = "full")]
434 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
435 fold_item_enum(self, i)
436 }
437 #[cfg(feature = "full")]
438 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
439 fold_item_extern_crate(self, i)
440 }
441 #[cfg(feature = "full")]
442 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
443 fold_item_fn(self, i)
444 }
445 #[cfg(feature = "full")]
446 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
447 fold_item_foreign_mod(self, i)
448 }
449 #[cfg(feature = "full")]
450 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
451 fold_item_impl(self, i)
452 }
453 #[cfg(feature = "full")]
454 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
455 fold_item_macro(self, i)
456 }
457 #[cfg(feature = "full")]
458 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
459 fold_item_macro2(self, i)
460 }
461 #[cfg(feature = "full")]
462 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
463 fold_item_mod(self, i)
464 }
465 #[cfg(feature = "full")]
466 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
467 fold_item_static(self, i)
468 }
469 #[cfg(feature = "full")]
470 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
471 fold_item_struct(self, i)
472 }
473 #[cfg(feature = "full")]
474 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
475 fold_item_trait(self, i)
476 }
477 #[cfg(feature = "full")]
478 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
479 fold_item_type(self, i)
480 }
481 #[cfg(feature = "full")]
482 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
483 fold_item_union(self, i)
484 }
485 #[cfg(feature = "full")]
486 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
487 fold_item_use(self, i)
488 }
489 #[cfg(feature = "full")]
490 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
491 fold_item_verbatim(self, i)
492 }
493 #[cfg(any(feature = "full", feature = "derive"))]
494 #[cfg(feature = "full")]
495 fn fold_label(&mut self, i: Label) -> Label {
496 fold_label(self, i)
497 }
498 #[cfg(any(feature = "full", feature = "derive"))]
499 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
500 fold_lifetime(self, i)
501 }
502 #[cfg(any(feature = "full", feature = "derive"))]
503 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
504 fold_lifetime_def(self, i)
505 }
506 #[cfg(any(feature = "full", feature = "derive"))]
507 fn fold_lit(&mut self, i: Lit) -> Lit {
508 fold_lit(self, i)
509 }
510 #[cfg(any(feature = "full", feature = "derive"))]
511 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
512 fold_lit_bool(self, i)
513 }
514 #[cfg(any(feature = "full", feature = "derive"))]
515 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
516 fold_lit_byte(self, i)
517 }
518 #[cfg(any(feature = "full", feature = "derive"))]
519 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
520 fold_lit_byte_str(self, i)
521 }
522 #[cfg(any(feature = "full", feature = "derive"))]
523 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
524 fold_lit_char(self, i)
525 }
526 #[cfg(any(feature = "full", feature = "derive"))]
527 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
528 fold_lit_float(self, i)
529 }
530 #[cfg(any(feature = "full", feature = "derive"))]
531 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
532 fold_lit_int(self, i)
533 }
534 #[cfg(any(feature = "full", feature = "derive"))]
535 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
536 fold_lit_str(self, i)
537 }
538 #[cfg(any(feature = "full", feature = "derive"))]
539 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
540 fold_lit_verbatim(self, i)
541 }
542 #[cfg(any(feature = "full", feature = "derive"))]
543 #[cfg(feature = "full")]
544 fn fold_local(&mut self, i: Local) -> Local {
545 fold_local(self, i)
546 }
547 #[cfg(any(feature = "full", feature = "derive"))]
548 fn fold_macro(&mut self, i: Macro) -> Macro {
549 fold_macro(self, i)
550 }
551 #[cfg(any(feature = "full", feature = "derive"))]
552 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
553 fold_macro_delimiter(self, i)
554 }
555 #[cfg(any(feature = "full", feature = "derive"))]
556 fn fold_member(&mut self, i: Member) -> Member {
557 fold_member(self, i)
558 }
559 #[cfg(any(feature = "full", feature = "derive"))]
560 fn fold_meta(&mut self, i: Meta) -> Meta {
561 fold_meta(self, i)
562 }
563 #[cfg(any(feature = "full", feature = "derive"))]
564 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
565 fold_meta_list(self, i)
566 }
567 #[cfg(any(feature = "full", feature = "derive"))]
568 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
569 fold_meta_name_value(self, i)
570 }
571 #[cfg(feature = "full")]
572 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
573 fold_method_sig(self, i)
574 }
575 #[cfg(any(feature = "full", feature = "derive"))]
576 #[cfg(feature = "full")]
577 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
578 fold_method_turbofish(self, i)
579 }
580 #[cfg(any(feature = "full", feature = "derive"))]
581 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
582 fold_nested_meta(self, i)
583 }
584 #[cfg(any(feature = "full", feature = "derive"))]
585 fn fold_parenthesized_generic_arguments(
586 &mut self,
587 i: ParenthesizedGenericArguments,
588 ) -> ParenthesizedGenericArguments {
589 fold_parenthesized_generic_arguments(self, i)
590 }
591 #[cfg(any(feature = "full", feature = "derive"))]
592 #[cfg(feature = "full")]
593 fn fold_pat(&mut self, i: Pat) -> Pat {
594 fold_pat(self, i)
595 }
596 #[cfg(any(feature = "full", feature = "derive"))]
597 #[cfg(feature = "full")]
598 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
599 fold_pat_box(self, i)
600 }
601 #[cfg(any(feature = "full", feature = "derive"))]
602 #[cfg(feature = "full")]
603 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
604 fold_pat_ident(self, i)
605 }
606 #[cfg(any(feature = "full", feature = "derive"))]
607 #[cfg(feature = "full")]
608 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
609 fold_pat_lit(self, i)
610 }
611 #[cfg(any(feature = "full", feature = "derive"))]
612 #[cfg(feature = "full")]
613 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
614 fold_pat_macro(self, i)
615 }
616 #[cfg(any(feature = "full", feature = "derive"))]
617 #[cfg(feature = "full")]
618 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
619 fold_pat_path(self, i)
620 }
621 #[cfg(any(feature = "full", feature = "derive"))]
622 #[cfg(feature = "full")]
623 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
624 fold_pat_range(self, i)
625 }
626 #[cfg(any(feature = "full", feature = "derive"))]
627 #[cfg(feature = "full")]
628 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
629 fold_pat_ref(self, i)
630 }
631 #[cfg(any(feature = "full", feature = "derive"))]
632 #[cfg(feature = "full")]
633 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
634 fold_pat_slice(self, i)
635 }
636 #[cfg(any(feature = "full", feature = "derive"))]
637 #[cfg(feature = "full")]
638 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
639 fold_pat_struct(self, i)
640 }
641 #[cfg(any(feature = "full", feature = "derive"))]
642 #[cfg(feature = "full")]
643 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
644 fold_pat_tuple(self, i)
645 }
646 #[cfg(any(feature = "full", feature = "derive"))]
647 #[cfg(feature = "full")]
648 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
649 fold_pat_tuple_struct(self, i)
650 }
651 #[cfg(any(feature = "full", feature = "derive"))]
652 #[cfg(feature = "full")]
653 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
654 fold_pat_verbatim(self, i)
655 }
656 #[cfg(any(feature = "full", feature = "derive"))]
657 #[cfg(feature = "full")]
658 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
659 fold_pat_wild(self, i)
660 }
661 #[cfg(any(feature = "full", feature = "derive"))]
662 fn fold_path(&mut self, i: Path) -> Path {
663 fold_path(self, i)
664 }
665 #[cfg(any(feature = "full", feature = "derive"))]
666 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
667 fold_path_arguments(self, i)
668 }
669 #[cfg(any(feature = "full", feature = "derive"))]
670 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
671 fold_path_segment(self, i)
672 }
673 #[cfg(any(feature = "full", feature = "derive"))]
674 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
675 fold_predicate_eq(self, i)
676 }
677 #[cfg(any(feature = "full", feature = "derive"))]
678 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
679 fold_predicate_lifetime(self, i)
680 }
681 #[cfg(any(feature = "full", feature = "derive"))]
682 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
683 fold_predicate_type(self, i)
684 }
685 #[cfg(any(feature = "full", feature = "derive"))]
686 fn fold_qself(&mut self, i: QSelf) -> QSelf {
687 fold_qself(self, i)
688 }
689 #[cfg(any(feature = "full", feature = "derive"))]
690 #[cfg(feature = "full")]
691 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
692 fold_range_limits(self, i)
693 }
694 #[cfg(any(feature = "full", feature = "derive"))]
695 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
696 fold_return_type(self, i)
697 }
David Tolnay8c81f622018-07-31 23:34:35 -0700698 fn fold_span(&mut self, i: Span) -> Span {
699 fold_span(self, i)
700 }
701 #[cfg(any(feature = "full", feature = "derive"))]
702 #[cfg(feature = "full")]
703 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
704 fold_stmt(self, i)
705 }
706 #[cfg(any(feature = "full", feature = "derive"))]
707 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
708 fold_trait_bound(self, i)
709 }
710 #[cfg(any(feature = "full", feature = "derive"))]
711 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
712 fold_trait_bound_modifier(self, i)
713 }
714 #[cfg(feature = "full")]
715 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
716 fold_trait_item(self, i)
717 }
718 #[cfg(feature = "full")]
719 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
720 fold_trait_item_const(self, i)
721 }
722 #[cfg(feature = "full")]
723 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
724 fold_trait_item_macro(self, i)
725 }
726 #[cfg(feature = "full")]
727 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
728 fold_trait_item_method(self, i)
729 }
730 #[cfg(feature = "full")]
731 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
732 fold_trait_item_type(self, i)
733 }
734 #[cfg(feature = "full")]
735 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
736 fold_trait_item_verbatim(self, i)
737 }
738 #[cfg(any(feature = "full", feature = "derive"))]
739 fn fold_type(&mut self, i: Type) -> Type {
740 fold_type(self, i)
741 }
742 #[cfg(any(feature = "full", feature = "derive"))]
743 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
744 fold_type_array(self, i)
745 }
746 #[cfg(any(feature = "full", feature = "derive"))]
747 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
748 fold_type_bare_fn(self, i)
749 }
750 #[cfg(any(feature = "full", feature = "derive"))]
751 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
752 fold_type_group(self, i)
753 }
754 #[cfg(any(feature = "full", feature = "derive"))]
755 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
756 fold_type_impl_trait(self, i)
757 }
758 #[cfg(any(feature = "full", feature = "derive"))]
759 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
760 fold_type_infer(self, i)
761 }
762 #[cfg(any(feature = "full", feature = "derive"))]
763 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
764 fold_type_macro(self, i)
765 }
766 #[cfg(any(feature = "full", feature = "derive"))]
767 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
768 fold_type_never(self, i)
769 }
770 #[cfg(any(feature = "full", feature = "derive"))]
771 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
772 fold_type_param(self, i)
773 }
774 #[cfg(any(feature = "full", feature = "derive"))]
775 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
776 fold_type_param_bound(self, i)
777 }
778 #[cfg(any(feature = "full", feature = "derive"))]
779 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
780 fold_type_paren(self, i)
781 }
782 #[cfg(any(feature = "full", feature = "derive"))]
783 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
784 fold_type_path(self, i)
785 }
786 #[cfg(any(feature = "full", feature = "derive"))]
787 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
788 fold_type_ptr(self, i)
789 }
790 #[cfg(any(feature = "full", feature = "derive"))]
791 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
792 fold_type_reference(self, i)
793 }
794 #[cfg(any(feature = "full", feature = "derive"))]
795 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
796 fold_type_slice(self, i)
797 }
798 #[cfg(any(feature = "full", feature = "derive"))]
799 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
800 fold_type_trait_object(self, i)
801 }
802 #[cfg(any(feature = "full", feature = "derive"))]
803 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
804 fold_type_tuple(self, i)
805 }
806 #[cfg(any(feature = "full", feature = "derive"))]
807 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
808 fold_type_verbatim(self, i)
809 }
810 #[cfg(any(feature = "full", feature = "derive"))]
811 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
812 fold_un_op(self, i)
813 }
814 #[cfg(feature = "full")]
815 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
816 fold_use_glob(self, i)
817 }
818 #[cfg(feature = "full")]
819 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
820 fold_use_group(self, i)
821 }
822 #[cfg(feature = "full")]
823 fn fold_use_name(&mut self, i: UseName) -> UseName {
824 fold_use_name(self, i)
825 }
826 #[cfg(feature = "full")]
827 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
828 fold_use_path(self, i)
829 }
830 #[cfg(feature = "full")]
831 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
832 fold_use_rename(self, i)
833 }
834 #[cfg(feature = "full")]
835 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
836 fold_use_tree(self, i)
837 }
838 #[cfg(any(feature = "full", feature = "derive"))]
839 fn fold_variant(&mut self, i: Variant) -> Variant {
840 fold_variant(self, i)
841 }
842 #[cfg(any(feature = "full", feature = "derive"))]
843 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
844 fold_vis_crate(self, i)
845 }
846 #[cfg(any(feature = "full", feature = "derive"))]
847 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
848 fold_vis_public(self, i)
849 }
850 #[cfg(any(feature = "full", feature = "derive"))]
851 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
852 fold_vis_restricted(self, i)
853 }
854 #[cfg(any(feature = "full", feature = "derive"))]
855 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
856 fold_visibility(self, i)
857 }
858 #[cfg(any(feature = "full", feature = "derive"))]
859 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
860 fold_where_clause(self, i)
861 }
862 #[cfg(any(feature = "full", feature = "derive"))]
863 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
864 fold_where_predicate(self, i)
865 }
Nika Layzell27726662017-10-24 23:16:35 -0400866}
David Tolnayd3f32142018-05-20 20:21:12 -0700867#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800868macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700869 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800870 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700871 let span = _visitor.fold_span(_i.span());
872 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800873 _i
874 }
David Tolnay8c81f622018-07-31 23:34:35 -0700875 };
David Tolnayd0adf522017-12-29 01:30:07 -0500876}
David Tolnay360efd22018-01-04 23:35:26 -0800877#[cfg(any(feature = "full", feature = "derive"))]
878fold_span_only!(fold_lit_byte: LitByte);
879#[cfg(any(feature = "full", feature = "derive"))]
880fold_span_only!(fold_lit_byte_str: LitByteStr);
881#[cfg(any(feature = "full", feature = "derive"))]
882fold_span_only!(fold_lit_char: LitChar);
883#[cfg(any(feature = "full", feature = "derive"))]
884fold_span_only!(fold_lit_float: LitFloat);
885#[cfg(any(feature = "full", feature = "derive"))]
886fold_span_only!(fold_lit_int: LitInt);
887#[cfg(any(feature = "full", feature = "derive"))]
888fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700889#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800890pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400891 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400892 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700893 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400894 }
895}
David Tolnay8c81f622018-07-31 23:34:35 -0700896#[cfg(any(feature = "full", feature = "derive"))]
897pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
898 _visitor: &mut V,
899 _i: AngleBracketedGenericArguments,
900) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500901 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400902 colon2_token: (_i.colon2_token)
903 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
904 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700905 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400906 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400907 }
908}
David Tolnay8c81f622018-07-31 23:34:35 -0700909#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800910pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400911 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700912 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400913 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700914 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400915 }
916}
David Tolnay8c81f622018-07-31 23:34:35 -0700917#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800918pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400919 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400920 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
921 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400922 }
923}
David Tolnay8c81f622018-07-31 23:34:35 -0700924#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800925pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400926 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400927 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700928 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400929 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
930 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400931 }
932}
David Tolnay8c81f622018-07-31 23:34:35 -0700933#[cfg(any(feature = "full", feature = "derive"))]
934#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800935pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400936 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700937 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400938 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700939 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
940 guard: (_i.guard).map(|it| {
941 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400942 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700943 Box::new(_visitor.fold_expr(*(it).1)),
944 )
945 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400946 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700947 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400948 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400949 }
950}
David Tolnay8c81f622018-07-31 23:34:35 -0700951#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800952pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400953 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700954 AttrStyle::Outer => AttrStyle::Outer,
955 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400956 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400957 }
958 }
959}
David Tolnay8c81f622018-07-31 23:34:35 -0700960#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800961pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400962 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400963 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700964 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400965 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700966 path: _visitor.fold_path(_i.path),
967 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400968 }
969}
David Tolnay8c81f622018-07-31 23:34:35 -0700970#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800971pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400972 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700973 name: (_i.name).map(|it| {
974 (
975 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400976 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700977 )
978 }),
979 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400980 }
981}
David Tolnay8c81f622018-07-31 23:34:35 -0700982#[cfg(any(feature = "full", feature = "derive"))]
983pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
984 _visitor: &mut V,
985 _i: BareFnArgName,
986) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400987 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700988 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
989 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400990 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400991 }
992 }
993}
David Tolnay8c81f622018-07-31 23:34:35 -0700994#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800995pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -0400996 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700997 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400998 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400999 }
David Tolnay8c81f622018-07-31 23:34:35 -07001000 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001001 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001002 }
David Tolnay8c81f622018-07-31 23:34:35 -07001003 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001004 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001005 }
David Tolnay8c81f622018-07-31 23:34:35 -07001006 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001007 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001008 }
David Tolnay8c81f622018-07-31 23:34:35 -07001009 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001010 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001011 }
David Tolnay8c81f622018-07-31 23:34:35 -07001012 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001013 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001014 }
David Tolnay8c81f622018-07-31 23:34:35 -07001015 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001016 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001017 }
David Tolnay8c81f622018-07-31 23:34:35 -07001018 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001019 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001020 }
David Tolnay8c81f622018-07-31 23:34:35 -07001021 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001022 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001023 }
David Tolnay8c81f622018-07-31 23:34:35 -07001024 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001025 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001026 }
David Tolnay8c81f622018-07-31 23:34:35 -07001027 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001028 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001029 }
David Tolnay8c81f622018-07-31 23:34:35 -07001030 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001031 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001032 }
David Tolnay8c81f622018-07-31 23:34:35 -07001033 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001034 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001035 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001036 BinOp::Lt(_binding_0) => {
1037 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1038 }
David Tolnay8c81f622018-07-31 23:34:35 -07001039 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001040 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001041 }
David Tolnay8c81f622018-07-31 23:34:35 -07001042 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001043 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001044 }
David Tolnay8c81f622018-07-31 23:34:35 -07001045 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001046 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001047 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001048 BinOp::Gt(_binding_0) => {
1049 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1050 }
David Tolnay8c81f622018-07-31 23:34:35 -07001051 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001052 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001053 }
David Tolnay8c81f622018-07-31 23:34:35 -07001054 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001055 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001056 }
David Tolnay8c81f622018-07-31 23:34:35 -07001057 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001058 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001059 }
David Tolnay8c81f622018-07-31 23:34:35 -07001060 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001061 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001062 }
David Tolnay8c81f622018-07-31 23:34:35 -07001063 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001064 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001065 }
David Tolnay8c81f622018-07-31 23:34:35 -07001066 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001067 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001068 }
David Tolnay8c81f622018-07-31 23:34:35 -07001069 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001070 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001071 }
David Tolnay8c81f622018-07-31 23:34:35 -07001072 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001073 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001074 }
David Tolnay8c81f622018-07-31 23:34:35 -07001075 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001076 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001077 }
David Tolnay8c81f622018-07-31 23:34:35 -07001078 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001079 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001080 }
1081 }
1082}
David Tolnay8c81f622018-07-31 23:34:35 -07001083#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001084pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001085 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001086 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001087 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001088 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001089 }
1090}
David Tolnay8c81f622018-07-31 23:34:35 -07001091#[cfg(any(feature = "full", feature = "derive"))]
1092#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001093pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001094 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001095 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001096 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001097 }
1098}
David Tolnay8c81f622018-07-31 23:34:35 -07001099#[cfg(any(feature = "full", feature = "derive"))]
1100pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1101 _visitor: &mut V,
1102 _i: BoundLifetimes,
1103) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001104 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001105 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1106 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001107 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001108 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001109 }
1110}
David Tolnay8c81f622018-07-31 23:34:35 -07001111#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001112pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001113 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001114 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001115 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001116 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001117 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001118 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001119 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001120 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001121 }
1122}
David Tolnay8c81f622018-07-31 23:34:35 -07001123#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001124pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001125 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001126 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1127 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1128 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001129 }
1130}
David Tolnay8c81f622018-07-31 23:34:35 -07001131#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001132pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001133 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001134 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1135 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001136 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001137 }
1138}
David Tolnay8c81f622018-07-31 23:34:35 -07001139#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001140pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001141 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001142 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001143 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001144 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001145 }
1146}
David Tolnay8c81f622018-07-31 23:34:35 -07001147#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001148pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001149 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001150 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001151 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001152 }
1153}
David Tolnay8c81f622018-07-31 23:34:35 -07001154#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001155pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001156 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001157 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1158 vis: _visitor.fold_visibility(_i.vis),
1159 ident: _visitor.fold_ident(_i.ident),
1160 generics: _visitor.fold_generics(_i.generics),
1161 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001162 }
1163}
David Tolnay8c81f622018-07-31 23:34:35 -07001164#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001165pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001166 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001167 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1168 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1169 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1170 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1171 Expr::MethodCall(_binding_0) => {
1172 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001173 }
David Tolnay8c81f622018-07-31 23:34:35 -07001174 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1175 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1176 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1177 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1178 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1179 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
1180 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
1181 Expr::IfLet(_binding_0) => Expr::IfLet(full!(_visitor.fold_expr_if_let(_binding_0))),
1182 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
1183 Expr::WhileLet(_binding_0) => {
1184 Expr::WhileLet(full!(_visitor.fold_expr_while_let(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001185 }
David Tolnay8c81f622018-07-31 23:34:35 -07001186 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1187 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1188 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1189 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1190 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1191 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1192 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1193 Expr::AssignOp(_binding_0) => {
1194 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001195 }
David Tolnay8c81f622018-07-31 23:34:35 -07001196 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1197 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1198 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1199 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1200 Expr::Reference(_binding_0) => {
1201 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001202 }
David Tolnay8c81f622018-07-31 23:34:35 -07001203 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1204 Expr::Continue(_binding_0) => {
1205 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001206 }
David Tolnay8c81f622018-07-31 23:34:35 -07001207 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1208 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1209 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1210 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1211 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1212 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1213 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001214 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001215 Expr::TryBlock(_binding_0) => {
1216 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1217 }
David Tolnay8c81f622018-07-31 23:34:35 -07001218 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1219 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001220 }
1221}
David Tolnay8c81f622018-07-31 23:34:35 -07001222#[cfg(feature = "full")]
1223#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001224pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001225 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001226 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001227 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001228 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001229 }
1230}
David Tolnay8c81f622018-07-31 23:34:35 -07001231#[cfg(feature = "full")]
1232#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001233pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001234 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001235 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1236 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001237 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001238 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001239 }
1240}
David Tolnay8c81f622018-07-31 23:34:35 -07001241#[cfg(feature = "full")]
1242#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001243pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001244 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001245 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1246 left: Box::new(_visitor.fold_expr(*_i.left)),
1247 op: _visitor.fold_bin_op(_i.op),
1248 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001249 }
1250}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001251#[cfg(feature = "full")]
1252#[cfg(any(feature = "full", feature = "derive"))]
1253pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1254 ExprAsync {
1255 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1256 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
1257 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1258 block: _visitor.fold_block(_i.block),
1259 }
1260}
David Tolnay8c81f622018-07-31 23:34:35 -07001261#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001262pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001263 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001264 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1265 left: Box::new(_visitor.fold_expr(*_i.left)),
1266 op: _visitor.fold_bin_op(_i.op),
1267 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001268 }
1269}
David Tolnay8c81f622018-07-31 23:34:35 -07001270#[cfg(feature = "full")]
1271#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001272pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001273 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001274 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1275 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001276 }
1277}
David Tolnay8c81f622018-07-31 23:34:35 -07001278#[cfg(feature = "full")]
1279#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001280pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001281 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001282 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001283 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001284 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001285 }
1286}
David Tolnay8c81f622018-07-31 23:34:35 -07001287#[cfg(feature = "full")]
1288#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001289pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001290 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001291 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001292 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001293 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1294 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001295 }
1296}
David Tolnay8c81f622018-07-31 23:34:35 -07001297#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001298pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001299 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001300 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1301 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001302 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001303 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001304 }
1305}
David Tolnay8c81f622018-07-31 23:34:35 -07001306#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001307pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001308 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001309 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1310 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001311 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001312 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001313 }
1314}
David Tolnay8c81f622018-07-31 23:34:35 -07001315#[cfg(feature = "full")]
1316#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001317pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001318 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001319 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001320 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001321 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1322 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1323 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001324 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001325 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001326 output: _visitor.fold_return_type(_i.output),
1327 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001328 }
1329}
David Tolnay8c81f622018-07-31 23:34:35 -07001330#[cfg(feature = "full")]
1331#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001332pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001333 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001334 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001335 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001336 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001337 }
1338}
David Tolnay8c81f622018-07-31 23:34:35 -07001339#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001340pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001341 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001342 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1343 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001344 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001345 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001346 }
1347}
David Tolnay8c81f622018-07-31 23:34:35 -07001348#[cfg(feature = "full")]
1349#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001350pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001351 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001352 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1353 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001354 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001355 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001356 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001357 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1358 body: _visitor.fold_block(_i.body),
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_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001364 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001365 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001366 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001367 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001368 }
1369}
David Tolnay8c81f622018-07-31 23:34:35 -07001370#[cfg(feature = "full")]
1371#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001372pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001373 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001374 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001375 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001376 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1377 then_branch: _visitor.fold_block(_i.then_branch),
1378 else_branch: (_i.else_branch).map(|it| {
1379 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001380 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001381 Box::new(_visitor.fold_expr(*(it).1)),
1382 )
1383 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001384 }
1385}
David Tolnay8c81f622018-07-31 23:34:35 -07001386#[cfg(feature = "full")]
1387#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001388pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001389 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001390 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001391 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
1392 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001393 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001394 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001395 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1396 then_branch: _visitor.fold_block(_i.then_branch),
1397 else_branch: (_i.else_branch).map(|it| {
1398 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001399 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001400 Box::new(_visitor.fold_expr(*(it).1)),
1401 )
1402 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001403 }
1404}
David Tolnay8c81f622018-07-31 23:34:35 -07001405#[cfg(feature = "full")]
1406#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001407pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001408 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001409 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1410 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001411 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001412 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001413 }
1414}
David Tolnay8c81f622018-07-31 23:34:35 -07001415#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001416pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001417 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001418 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1419 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001420 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001421 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001422 }
1423}
David Tolnay8c81f622018-07-31 23:34:35 -07001424#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001425pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001426 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001427 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1428 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001429 }
1430}
David Tolnay8c81f622018-07-31 23:34:35 -07001431#[cfg(feature = "full")]
1432#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001433pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001434 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001435 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1436 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001437 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001438 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001439 }
1440}
David Tolnay8c81f622018-07-31 23:34:35 -07001441#[cfg(feature = "full")]
1442#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001443pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001444 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001445 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1446 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001447 }
1448}
David Tolnay8c81f622018-07-31 23:34:35 -07001449#[cfg(feature = "full")]
1450#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001451pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001452 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001453 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001454 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001455 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001456 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001457 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001458 }
1459}
David Tolnay8c81f622018-07-31 23:34:35 -07001460#[cfg(feature = "full")]
1461#[cfg(any(feature = "full", feature = "derive"))]
1462pub fn fold_expr_method_call<V: Fold + ?Sized>(
1463 _visitor: &mut V,
1464 _i: ExprMethodCall,
1465) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001466 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001467 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1468 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001469 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001470 method: _visitor.fold_ident(_i.method),
1471 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001472 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001473 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001474 }
1475}
David Tolnay8c81f622018-07-31 23:34:35 -07001476#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001477pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001478 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001479 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001480 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001481 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001482 }
1483}
David Tolnay8c81f622018-07-31 23:34:35 -07001484#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001485pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001486 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001487 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1488 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1489 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001490 }
1491}
David Tolnay8c81f622018-07-31 23:34:35 -07001492#[cfg(feature = "full")]
1493#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001494pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001495 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001496 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1497 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1498 limits: _visitor.fold_range_limits(_i.limits),
1499 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001500 }
1501}
David Tolnay8c81f622018-07-31 23:34:35 -07001502#[cfg(feature = "full")]
1503#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001504pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1505 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001506 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001507 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1508 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001509 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001510 }
1511}
David Tolnay8c81f622018-07-31 23:34:35 -07001512#[cfg(feature = "full")]
1513#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001514pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001515 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001516 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001517 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001518 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001519 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001520 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001521 }
1522}
David Tolnay8c81f622018-07-31 23:34:35 -07001523#[cfg(feature = "full")]
1524#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001525pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001526 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001527 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001528 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001529 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001530 }
1531}
David Tolnay8c81f622018-07-31 23:34:35 -07001532#[cfg(feature = "full")]
1533#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001534pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001535 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001536 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1537 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001538 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001539 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001540 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001541 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001542 }
1543}
David Tolnay8c81f622018-07-31 23:34:35 -07001544#[cfg(feature = "full")]
1545#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001546pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001547 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001548 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1549 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001550 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001551 }
1552}
David Tolnay8c81f622018-07-31 23:34:35 -07001553#[cfg(feature = "full")]
1554#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001555pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1556 ExprTryBlock {
1557 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1558 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1559 block: _visitor.fold_block(_i.block),
1560 }
1561}
1562#[cfg(feature = "full")]
1563#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001564pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001565 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001566 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001567 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001568 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001569 }
1570}
David Tolnay8c81f622018-07-31 23:34:35 -07001571#[cfg(feature = "full")]
1572#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001573pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001574 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001575 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1576 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001577 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001578 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001579 }
1580}
David Tolnay8c81f622018-07-31 23:34:35 -07001581#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001582pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001583 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001584 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1585 op: _visitor.fold_un_op(_i.op),
1586 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001587 }
1588}
David Tolnay8c81f622018-07-31 23:34:35 -07001589#[cfg(feature = "full")]
1590#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001591pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001592 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001593 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001594 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001595 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001596 }
1597}
David Tolnay8c81f622018-07-31 23:34:35 -07001598#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001599pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001600 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001601}
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_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001605 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001606 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1607 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001608 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001609 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1610 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001611 }
1612}
David Tolnay8c81f622018-07-31 23:34:35 -07001613#[cfg(feature = "full")]
1614#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001615pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001616 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001617 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1618 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001619 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
1620 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001621 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001622 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001623 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1624 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001625 }
1626}
David Tolnay8c81f622018-07-31 23:34:35 -07001627#[cfg(feature = "full")]
1628#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001629pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001630 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001631 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001632 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001633 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001634 }
1635}
David Tolnay8c81f622018-07-31 23:34:35 -07001636#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001637pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001638 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001639 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1640 vis: _visitor.fold_visibility(_i.vis),
1641 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001642 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001643 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001644 }
1645}
David Tolnay8c81f622018-07-31 23:34:35 -07001646#[cfg(any(feature = "full", feature = "derive"))]
1647#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001648pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001649 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001650 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1651 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001652 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001653 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001654 }
1655}
David Tolnay8c81f622018-07-31 23:34:35 -07001656#[cfg(any(feature = "full", feature = "derive"))]
1657#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001658pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001659 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001660 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1661 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001662 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001663 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001664 }
1665}
David Tolnay8c81f622018-07-31 23:34:35 -07001666#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001667pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001668 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001669 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1670 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1671 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001672 }
1673}
David Tolnay8c81f622018-07-31 23:34:35 -07001674#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001675pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001676 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001677 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001678 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001679 }
1680}
David Tolnay8c81f622018-07-31 23:34:35 -07001681#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001682pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001683 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001684 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001685 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001686 }
1687}
David Tolnay8c81f622018-07-31 23:34:35 -07001688#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001689pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001690 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001691 shebang: _i.shebang,
1692 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1693 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001694 }
1695}
David Tolnay8c81f622018-07-31 23:34:35 -07001696#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001697pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001698 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001699 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1700 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1701 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1702 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1703 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001704 }
1705}
David Tolnay8c81f622018-07-31 23:34:35 -07001706#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001707pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001708 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001709 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001710 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001711 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001712 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001713 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001714 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001715 }
1716}
David Tolnay8c81f622018-07-31 23:34:35 -07001717#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001718pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001719 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001720 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1721 ForeignItem::Static(_binding_0) => {
1722 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001723 }
David Tolnay8c81f622018-07-31 23:34:35 -07001724 ForeignItem::Type(_binding_0) => {
1725 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001726 }
David Tolnay435c1782018-08-24 16:15:44 -04001727 ForeignItem::Macro(_binding_0) => {
1728 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1729 }
David Tolnay8c81f622018-07-31 23:34:35 -07001730 ForeignItem::Verbatim(_binding_0) => {
1731 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001732 }
Nika Layzell27726662017-10-24 23:16:35 -04001733 }
1734}
David Tolnay8c81f622018-07-31 23:34:35 -07001735#[cfg(feature = "full")]
1736pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1737 _visitor: &mut V,
1738 _i: ForeignItemFn,
1739) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001740 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001741 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1742 vis: _visitor.fold_visibility(_i.vis),
1743 ident: _visitor.fold_ident(_i.ident),
1744 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001745 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001746 }
1747}
David Tolnay8c81f622018-07-31 23:34:35 -07001748#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001749pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1750 _visitor: &mut V,
1751 _i: ForeignItemMacro,
1752) -> ForeignItemMacro {
1753 ForeignItemMacro {
1754 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1755 mac: _visitor.fold_macro(_i.mac),
1756 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1757 }
1758}
1759#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001760pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1761 _visitor: &mut V,
1762 _i: ForeignItemStatic,
1763) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001764 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001765 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1766 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001767 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1768 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001769 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001770 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001771 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001772 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001773 }
1774}
David Tolnay8c81f622018-07-31 23:34:35 -07001775#[cfg(feature = "full")]
1776pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1777 _visitor: &mut V,
1778 _i: ForeignItemType,
1779) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001780 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001781 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1782 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001783 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001784 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001785 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001786 }
1787}
David Tolnay8c81f622018-07-31 23:34:35 -07001788#[cfg(feature = "full")]
1789pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1790 _visitor: &mut V,
1791 _i: ForeignItemVerbatim,
1792) -> ForeignItemVerbatim {
1793 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001794}
David Tolnay8c81f622018-07-31 23:34:35 -07001795#[cfg(any(feature = "full", feature = "derive"))]
1796pub fn fold_generic_argument<V: Fold + ?Sized>(
1797 _visitor: &mut V,
1798 _i: GenericArgument,
1799) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001800 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001801 GenericArgument::Lifetime(_binding_0) => {
1802 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001803 }
David Tolnay8c81f622018-07-31 23:34:35 -07001804 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1805 GenericArgument::Binding(_binding_0) => {
1806 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001807 }
David Tolnay8c81f622018-07-31 23:34:35 -07001808 GenericArgument::Const(_binding_0) => {
1809 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001810 }
Nika Layzell357885a2017-12-04 15:47:07 -05001811 }
1812}
David Tolnay8c81f622018-07-31 23:34:35 -07001813#[cfg(any(feature = "full", feature = "derive"))]
1814#[cfg(feature = "full")]
1815pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1816 _visitor: &mut V,
1817 _i: GenericMethodArgument,
1818) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001819 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001820 GenericMethodArgument::Type(_binding_0) => {
1821 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001822 }
David Tolnay8c81f622018-07-31 23:34:35 -07001823 GenericMethodArgument::Const(_binding_0) => {
1824 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001825 }
1826 }
1827}
David Tolnay8c81f622018-07-31 23:34:35 -07001828#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001829pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001830 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001831 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1832 GenericParam::Lifetime(_binding_0) => {
1833 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001834 }
David Tolnay8c81f622018-07-31 23:34:35 -07001835 GenericParam::Const(_binding_0) => {
1836 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001837 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001838 }
1839}
David Tolnay8c81f622018-07-31 23:34:35 -07001840#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001841pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001842 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001843 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001844 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001845 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001846 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001847 }
1848}
Alex Crichtond261d092018-05-18 13:47:35 -07001849pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001850 let mut _i = _i;
1851 let span = _visitor.fold_span(_i.span());
1852 _i.set_span(span);
1853 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001854}
David Tolnay8c81f622018-07-31 23:34:35 -07001855#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001856pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001857 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001858 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1859 ImplItem::Method(_binding_0) => {
1860 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001861 }
David Tolnay8c81f622018-07-31 23:34:35 -07001862 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
1863 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1864 ImplItem::Verbatim(_binding_0) => {
1865 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001866 }
Nika Layzell27726662017-10-24 23:16:35 -04001867 }
1868}
David Tolnay8c81f622018-07-31 23:34:35 -07001869#[cfg(feature = "full")]
1870pub fn fold_impl_item_const<V: Fold + ?Sized>(
1871 _visitor: &mut V,
1872 _i: ImplItemConst,
1873) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001874 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001875 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1876 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001877 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1878 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001879 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001880 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001881 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001882 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001883 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001884 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001885 }
1886}
David Tolnay8c81f622018-07-31 23:34:35 -07001887#[cfg(feature = "full")]
1888pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1889 _visitor: &mut V,
1890 _i: ImplItemMacro,
1891) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001892 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001893 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1894 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001895 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001896 }
1897}
David Tolnay8c81f622018-07-31 23:34:35 -07001898#[cfg(feature = "full")]
1899pub fn fold_impl_item_method<V: Fold + ?Sized>(
1900 _visitor: &mut V,
1901 _i: ImplItemMethod,
1902) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001903 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001904 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1905 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001906 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001907 sig: _visitor.fold_method_sig(_i.sig),
1908 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001909 }
1910}
David Tolnay8c81f622018-07-31 23:34:35 -07001911#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001912pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001913 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001914 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1915 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001916 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1917 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001918 ident: _visitor.fold_ident(_i.ident),
1919 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001920 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001921 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001922 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001923 }
1924}
David Tolnay8c81f622018-07-31 23:34:35 -07001925#[cfg(feature = "full")]
1926pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1927 _visitor: &mut V,
1928 _i: ImplItemVerbatim,
1929) -> ImplItemVerbatim {
1930 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001931}
David Tolnay8c81f622018-07-31 23:34:35 -07001932#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001933pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001934 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001935 index: _i.index,
1936 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001937 }
1938}
David Tolnay8c81f622018-07-31 23:34:35 -07001939#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001940pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001941 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001942 Item::ExternCrate(_binding_0) => {
1943 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001944 }
David Tolnay8c81f622018-07-31 23:34:35 -07001945 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1946 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1947 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1948 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1949 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1950 Item::ForeignMod(_binding_0) => {
1951 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001952 }
David Tolnay8c81f622018-07-31 23:34:35 -07001953 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
1954 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1955 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1956 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1957 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
1958 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1959 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1960 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1961 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001962 }
1963}
David Tolnay8c81f622018-07-31 23:34:35 -07001964#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001965pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001966 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001967 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1968 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001969 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001970 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001971 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001972 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001973 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001974 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001975 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001976 }
1977}
David Tolnay8c81f622018-07-31 23:34:35 -07001978#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001979pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001980 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001981 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1982 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001983 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001984 ident: _visitor.fold_ident(_i.ident),
1985 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001986 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001987 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001988 }
1989}
David Tolnay8c81f622018-07-31 23:34:35 -07001990#[cfg(feature = "full")]
1991pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1992 _visitor: &mut V,
1993 _i: ItemExternCrate,
1994) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001995 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001996 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1997 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001998 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
1999 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002000 ident: _visitor.fold_ident(_i.ident),
2001 rename: (_i.rename).map(|it| {
2002 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002003 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002004 _visitor.fold_ident((it).1),
2005 )
2006 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002007 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002008 }
2009}
David Tolnay8c81f622018-07-31 23:34:35 -07002010#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002011pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002012 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07002013 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2014 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002015 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2016 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002017 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002018 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2019 ident: _visitor.fold_ident(_i.ident),
2020 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2021 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002022 }
2023}
David Tolnay8c81f622018-07-31 23:34:35 -07002024#[cfg(feature = "full")]
2025pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2026 _visitor: &mut V,
2027 _i: ItemForeignMod,
2028) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002029 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002030 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2031 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002032 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002033 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002034 }
2035}
David Tolnay8c81f622018-07-31 23:34:35 -07002036#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002037pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002038 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002039 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002040 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2041 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2042 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002043 generics: _visitor.fold_generics(_i.generics),
2044 trait_: (_i.trait_).map(|it| {
2045 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002046 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002047 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002048 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002049 )
2050 }),
2051 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002052 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002053 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002054 }
2055}
David Tolnay8c81f622018-07-31 23:34:35 -07002056#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002057pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002058 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002059 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2060 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2061 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002062 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.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_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002067 ItemMacro2 {
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 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002071 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002072 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002073 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002074 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002075 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002076 }
2077}
David Tolnay8c81f622018-07-31 23:34:35 -07002078#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002079pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002080 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002081 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2082 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002083 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002084 ident: _visitor.fold_ident(_i.ident),
2085 content: (_i.content).map(|it| {
2086 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002087 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002088 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2089 )
2090 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002091 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002092 }
2093}
David Tolnay8c81f622018-07-31 23:34:35 -07002094#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002095pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002096 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002097 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2098 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002099 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2100 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002101 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002102 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002103 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002104 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002105 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002106 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002107 }
2108}
David Tolnay8c81f622018-07-31 23:34:35 -07002109#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002110pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002111 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002112 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2113 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002114 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002115 ident: _visitor.fold_ident(_i.ident),
2116 generics: _visitor.fold_generics(_i.generics),
2117 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002118 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002119 }
2120}
David Tolnay8c81f622018-07-31 23:34:35 -07002121#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002122pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002123 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002124 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2125 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002126 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2127 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2128 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002129 ident: _visitor.fold_ident(_i.ident),
2130 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002131 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002132 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002133 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002134 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002135 }
2136}
David Tolnay8c81f622018-07-31 23:34:35 -07002137#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002138pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002139 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002140 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2141 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002142 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002143 ident: _visitor.fold_ident(_i.ident),
2144 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002145 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002146 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002147 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002148 }
2149}
David Tolnay8c81f622018-07-31 23:34:35 -07002150#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002151pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002152 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002153 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2154 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002155 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002156 ident: _visitor.fold_ident(_i.ident),
2157 generics: _visitor.fold_generics(_i.generics),
2158 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002159 }
2160}
David Tolnay8c81f622018-07-31 23:34:35 -07002161#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002162pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002163 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002164 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2165 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002166 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002167 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002168 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002169 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002170 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002171 }
2172}
David Tolnay8c81f622018-07-31 23:34:35 -07002173#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002174pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002175 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002176}
David Tolnay8c81f622018-07-31 23:34:35 -07002177#[cfg(any(feature = "full", feature = "derive"))]
2178#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002179pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002180 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002181 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002182 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002183 }
2184}
David Tolnay8c81f622018-07-31 23:34:35 -07002185#[cfg(any(feature = "full", feature = "derive"))]
Alex Crichton131308c2018-05-18 14:00:24 -07002186pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2187 Lifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002188 apostrophe: _i.apostrophe,
2189 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002190 }
2191}
David Tolnay8c81f622018-07-31 23:34:35 -07002192#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002193pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002194 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002195 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2196 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002197 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002198 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002199 }
2200}
David Tolnay8c81f622018-07-31 23:34:35 -07002201#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002202pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002203 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002204 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2205 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2206 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2207 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2208 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2209 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2210 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2211 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002212 }
2213}
David Tolnay8c81f622018-07-31 23:34:35 -07002214#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002215pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002216 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002217 value: _i.value,
2218 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002219 }
2220}
David Tolnay8c81f622018-07-31 23:34:35 -07002221#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002222pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002223 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002224}
David Tolnay8c81f622018-07-31 23:34:35 -07002225#[cfg(any(feature = "full", feature = "derive"))]
2226#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002227pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002228 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002229 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002230 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002231 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2232 ty: (_i.ty).map(|it| {
2233 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002234 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002235 Box::new(_visitor.fold_type(*(it).1)),
2236 )
2237 }),
2238 init: (_i.init).map(|it| {
2239 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002240 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002241 Box::new(_visitor.fold_expr(*(it).1)),
2242 )
2243 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002244 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002245 }
2246}
David Tolnay8c81f622018-07-31 23:34:35 -07002247#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002248pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002249 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002250 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002251 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002252 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2253 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002254 }
2255}
David Tolnay8c81f622018-07-31 23:34:35 -07002256#[cfg(any(feature = "full", feature = "derive"))]
2257pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2258 _visitor: &mut V,
2259 _i: MacroDelimiter,
2260) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002261 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002262 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002263 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002264 }
David Tolnay8c81f622018-07-31 23:34:35 -07002265 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002266 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002267 }
David Tolnay8c81f622018-07-31 23:34:35 -07002268 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002269 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002270 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002271 }
2272}
David Tolnay8c81f622018-07-31 23:34:35 -07002273#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002274pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002275 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002276 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2277 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002278 }
2279}
David Tolnay8c81f622018-07-31 23:34:35 -07002280#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002281pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002282 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002283 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2284 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2285 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002286 }
2287}
David Tolnay8c81f622018-07-31 23:34:35 -07002288#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002289pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2290 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002291 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002292 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002293 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002294 }
2295}
David Tolnay8c81f622018-07-31 23:34:35 -07002296#[cfg(any(feature = "full", feature = "derive"))]
2297pub fn fold_meta_name_value<V: Fold + ?Sized>(
2298 _visitor: &mut V,
2299 _i: MetaNameValue,
2300) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002301 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002302 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002303 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002304 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002305 }
2306}
David Tolnay8c81f622018-07-31 23:34:35 -07002307#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002308pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002309 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002310 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2311 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002312 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002313 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2314 ident: _visitor.fold_ident(_i.ident),
2315 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002316 }
2317}
David Tolnay8c81f622018-07-31 23:34:35 -07002318#[cfg(any(feature = "full", feature = "derive"))]
2319#[cfg(feature = "full")]
2320pub fn fold_method_turbofish<V: Fold + ?Sized>(
2321 _visitor: &mut V,
2322 _i: MethodTurbofish,
2323) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002324 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002325 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2326 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002327 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002328 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002329 }
2330}
David Tolnay8c81f622018-07-31 23:34:35 -07002331#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002332pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002333 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002334 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2335 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002336 }
2337}
David Tolnay8c81f622018-07-31 23:34:35 -07002338#[cfg(any(feature = "full", feature = "derive"))]
2339pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2340 _visitor: &mut V,
2341 _i: ParenthesizedGenericArguments,
2342) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002343 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002344 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002345 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2346 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002347 }
2348}
David Tolnay8c81f622018-07-31 23:34:35 -07002349#[cfg(any(feature = "full", feature = "derive"))]
2350#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002351pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002352 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002353 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2354 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2355 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2356 Pat::TupleStruct(_binding_0) => {
2357 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002358 }
David Tolnay8c81f622018-07-31 23:34:35 -07002359 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2360 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2361 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2362 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2363 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2364 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2365 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2366 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2367 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002368 }
2369}
David Tolnay8c81f622018-07-31 23:34:35 -07002370#[cfg(any(feature = "full", feature = "derive"))]
2371#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002372pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002373 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002374 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002375 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002376 }
2377}
David Tolnay8c81f622018-07-31 23:34:35 -07002378#[cfg(any(feature = "full", feature = "derive"))]
2379#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002380pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002381 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002382 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2383 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002384 ident: _visitor.fold_ident(_i.ident),
2385 subpat: (_i.subpat).map(|it| {
2386 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002387 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002388 Box::new(_visitor.fold_pat(*(it).1)),
2389 )
2390 }),
Nika Layzell27726662017-10-24 23:16:35 -04002391 }
2392}
David Tolnay8c81f622018-07-31 23:34:35 -07002393#[cfg(any(feature = "full", feature = "derive"))]
2394#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002395pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002396 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002397 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002398 }
2399}
David Tolnay8c81f622018-07-31 23:34:35 -07002400#[cfg(any(feature = "full", feature = "derive"))]
2401#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002402pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002403 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002404 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002405 }
2406}
David Tolnay8c81f622018-07-31 23:34:35 -07002407#[cfg(any(feature = "full", feature = "derive"))]
2408#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002409pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002410 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002411 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2412 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002413 }
2414}
David Tolnay8c81f622018-07-31 23:34:35 -07002415#[cfg(any(feature = "full", feature = "derive"))]
2416#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002417pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002418 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002419 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2420 limits: _visitor.fold_range_limits(_i.limits),
2421 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002422 }
2423}
David Tolnay8c81f622018-07-31 23:34:35 -07002424#[cfg(any(feature = "full", feature = "derive"))]
2425#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002426pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002427 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002428 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2429 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002430 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002431 }
2432}
David Tolnay8c81f622018-07-31 23:34:35 -07002433#[cfg(any(feature = "full", feature = "derive"))]
2434#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002435pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002436 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002437 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002438 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2439 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002440 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2441 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002442 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002443 }
2444}
David Tolnay8c81f622018-07-31 23:34:35 -07002445#[cfg(any(feature = "full", feature = "derive"))]
2446#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002447pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002448 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002449 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002450 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002451 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002452 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002453 }
2454}
David Tolnay8c81f622018-07-31 23:34:35 -07002455#[cfg(any(feature = "full", feature = "derive"))]
2456#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002457pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002458 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002459 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002460 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002461 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2462 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002463 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002464 }
2465}
David Tolnay8c81f622018-07-31 23:34:35 -07002466#[cfg(any(feature = "full", feature = "derive"))]
2467#[cfg(feature = "full")]
2468pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2469 _visitor: &mut V,
2470 _i: PatTupleStruct,
2471) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002472 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002473 path: _visitor.fold_path(_i.path),
2474 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002475 }
2476}
David Tolnay8c81f622018-07-31 23:34:35 -07002477#[cfg(any(feature = "full", feature = "derive"))]
2478#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002479pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002480 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002481}
David Tolnay8c81f622018-07-31 23:34:35 -07002482#[cfg(any(feature = "full", feature = "derive"))]
2483#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002484pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002485 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002486 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002487 }
2488}
David Tolnay8c81f622018-07-31 23:34:35 -07002489#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002490pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002491 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002492 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002493 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002494 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002495 }
2496}
David Tolnay8c81f622018-07-31 23:34:35 -07002497#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002498pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002499 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002500 PathArguments::None => PathArguments::None,
2501 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2502 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2503 ),
2504 PathArguments::Parenthesized(_binding_0) => {
2505 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002506 }
2507 }
2508}
David Tolnay8c81f622018-07-31 23:34:35 -07002509#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002510pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002511 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002512 ident: _visitor.fold_ident(_i.ident),
2513 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002514 }
2515}
David Tolnay8c81f622018-07-31 23:34:35 -07002516#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002517pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002518 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002519 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002520 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002521 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002522 }
2523}
David Tolnay8c81f622018-07-31 23:34:35 -07002524#[cfg(any(feature = "full", feature = "derive"))]
2525pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2526 _visitor: &mut V,
2527 _i: PredicateLifetime,
2528) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002529 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002530 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002531 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002532 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002533 }
2534}
David Tolnay8c81f622018-07-31 23:34:35 -07002535#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002536pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002537 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002538 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2539 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002540 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002541 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002542 }
2543}
David Tolnay8c81f622018-07-31 23:34:35 -07002544#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002545pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002546 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002547 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002548 ty: Box::new(_visitor.fold_type(*_i.ty)),
2549 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002550 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2551 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002552 }
2553}
David Tolnay8c81f622018-07-31 23:34:35 -07002554#[cfg(any(feature = "full", feature = "derive"))]
2555#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002556pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002557 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002558 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002559 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002560 }
David Tolnay8c81f622018-07-31 23:34:35 -07002561 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002562 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002563 }
2564 }
2565}
David Tolnay8c81f622018-07-31 23:34:35 -07002566#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002567pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002568 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002569 ReturnType::Default => ReturnType::Default,
2570 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002571 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002572 Box::new(_visitor.fold_type(*_binding_1)),
2573 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002574 }
2575}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002576pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002577 _i
2578}
David Tolnay8c81f622018-07-31 23:34:35 -07002579#[cfg(any(feature = "full", feature = "derive"))]
2580#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002581pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002582 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002583 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2584 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2585 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2586 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2587 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002588 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002589 ),
Nika Layzell27726662017-10-24 23:16:35 -04002590 }
2591}
David Tolnay8c81f622018-07-31 23:34:35 -07002592#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002593pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002594 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002595 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002596 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2597 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2598 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002599 }
2600}
David Tolnay8c81f622018-07-31 23:34:35 -07002601#[cfg(any(feature = "full", feature = "derive"))]
2602pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2603 _visitor: &mut V,
2604 _i: TraitBoundModifier,
2605) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002606 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002607 TraitBoundModifier::None => TraitBoundModifier::None,
2608 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002609 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002610 }
2611 }
2612}
David Tolnay8c81f622018-07-31 23:34:35 -07002613#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002614pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002615 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002616 TraitItem::Const(_binding_0) => {
2617 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002618 }
David Tolnay8c81f622018-07-31 23:34:35 -07002619 TraitItem::Method(_binding_0) => {
2620 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002621 }
David Tolnay8c81f622018-07-31 23:34:35 -07002622 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2623 TraitItem::Macro(_binding_0) => {
2624 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002625 }
David Tolnay8c81f622018-07-31 23:34:35 -07002626 TraitItem::Verbatim(_binding_0) => {
2627 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002628 }
Nika Layzell27726662017-10-24 23:16:35 -04002629 }
2630}
David Tolnay8c81f622018-07-31 23:34:35 -07002631#[cfg(feature = "full")]
2632pub fn fold_trait_item_const<V: Fold + ?Sized>(
2633 _visitor: &mut V,
2634 _i: TraitItemConst,
2635) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002636 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002637 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002638 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002639 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002640 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002641 ty: _visitor.fold_type(_i.ty),
2642 default: (_i.default).map(|it| {
2643 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002644 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002645 _visitor.fold_expr((it).1),
2646 )
2647 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002648 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002649 }
2650}
David Tolnay8c81f622018-07-31 23:34:35 -07002651#[cfg(feature = "full")]
2652pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2653 _visitor: &mut V,
2654 _i: TraitItemMacro,
2655) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002656 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002657 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2658 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002659 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002660 }
2661}
David Tolnay8c81f622018-07-31 23:34:35 -07002662#[cfg(feature = "full")]
2663pub fn fold_trait_item_method<V: Fold + ?Sized>(
2664 _visitor: &mut V,
2665 _i: TraitItemMethod,
2666) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002667 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002668 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2669 sig: _visitor.fold_method_sig(_i.sig),
2670 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002671 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002672 }
2673}
David Tolnay8c81f622018-07-31 23:34:35 -07002674#[cfg(feature = "full")]
2675pub fn fold_trait_item_type<V: Fold + ?Sized>(
2676 _visitor: &mut V,
2677 _i: TraitItemType,
2678) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002679 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002680 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002681 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002682 ident: _visitor.fold_ident(_i.ident),
2683 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002684 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002685 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2686 default: (_i.default).map(|it| {
2687 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002688 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002689 _visitor.fold_type((it).1),
2690 )
2691 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002692 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002693 }
2694}
David Tolnay8c81f622018-07-31 23:34:35 -07002695#[cfg(feature = "full")]
2696pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2697 _visitor: &mut V,
2698 _i: TraitItemVerbatim,
2699) -> TraitItemVerbatim {
2700 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002701}
David Tolnay8c81f622018-07-31 23:34:35 -07002702#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002703pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002704 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002705 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2706 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2707 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2708 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2709 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2710 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2711 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2712 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2713 Type::TraitObject(_binding_0) => {
2714 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002715 }
David Tolnay8c81f622018-07-31 23:34:35 -07002716 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2717 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2718 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2719 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2720 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2721 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002722 }
2723}
David Tolnay8c81f622018-07-31 23:34:35 -07002724#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002725pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002726 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002727 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002728 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002729 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002730 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002731 }
2732}
David Tolnay8c81f622018-07-31 23:34:35 -07002733#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002734pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002735 TypeBareFn {
David Tolnay7ac699c2018-08-24 14:00:58 -04002736 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002737 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002738 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002739 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002740 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002741 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002742 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002743 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002744 }
2745}
David Tolnay8c81f622018-07-31 23:34:35 -07002746#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002747pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002748 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002749 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002750 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002751 }
2752}
David Tolnay8c81f622018-07-31 23:34:35 -07002753#[cfg(any(feature = "full", feature = "derive"))]
2754pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2755 _visitor: &mut V,
2756 _i: TypeImplTrait,
2757) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002758 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002759 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002760 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002761 }
2762}
David Tolnay8c81f622018-07-31 23:34:35 -07002763#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002764pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002765 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002766 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002767 }
2768}
David Tolnay8c81f622018-07-31 23:34:35 -07002769#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002770pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002771 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002772 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002773 }
2774}
David Tolnay8c81f622018-07-31 23:34:35 -07002775#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002776pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002777 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002778 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002779 }
2780}
David Tolnay8c81f622018-07-31 23:34:35 -07002781#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002782pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002783 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002784 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2785 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002786 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002787 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002788 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002789 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002790 }
2791}
David Tolnay8c81f622018-07-31 23:34:35 -07002792#[cfg(any(feature = "full", feature = "derive"))]
2793pub fn fold_type_param_bound<V: Fold + ?Sized>(
2794 _visitor: &mut V,
2795 _i: TypeParamBound,
2796) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002797 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002798 TypeParamBound::Trait(_binding_0) => {
2799 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002800 }
David Tolnay8c81f622018-07-31 23:34:35 -07002801 TypeParamBound::Lifetime(_binding_0) => {
2802 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002803 }
2804 }
2805}
David Tolnay8c81f622018-07-31 23:34:35 -07002806#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002807pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002808 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002809 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002810 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002811 }
2812}
David Tolnay8c81f622018-07-31 23:34:35 -07002813#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002814pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002815 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002816 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2817 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002818 }
2819}
David Tolnay8c81f622018-07-31 23:34:35 -07002820#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002821pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002822 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002823 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2824 const_token: (_i.const_token)
2825 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2826 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002827 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002828 }
2829}
David Tolnay8c81f622018-07-31 23:34:35 -07002830#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002831pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002832 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002833 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002834 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002835 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002836 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002837 }
2838}
David Tolnay8c81f622018-07-31 23:34:35 -07002839#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002840pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002841 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002842 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002843 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002844 }
2845}
David Tolnay8c81f622018-07-31 23:34:35 -07002846#[cfg(any(feature = "full", feature = "derive"))]
2847pub fn fold_type_trait_object<V: Fold + ?Sized>(
2848 _visitor: &mut V,
2849 _i: TypeTraitObject,
2850) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002851 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002852 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002853 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002854 }
2855}
David Tolnay8c81f622018-07-31 23:34:35 -07002856#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002857pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002858 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002859 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002860 elems: FoldHelper::lift(_i.elems, |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"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002864pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002865 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002866}
David Tolnay8c81f622018-07-31 23:34:35 -07002867#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002868pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002869 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002870 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002871 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002872 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002873 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2874 UnOp::Neg(_binding_0) => {
2875 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2876 }
Nika Layzell27726662017-10-24 23:16:35 -04002877 }
2878}
David Tolnay8c81f622018-07-31 23:34:35 -07002879#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002880pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002881 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002882 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002883 }
2884}
David Tolnay8c81f622018-07-31 23:34:35 -07002885#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002886pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2887 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002888 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002889 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002890 }
2891}
David Tolnay8c81f622018-07-31 23:34:35 -07002892#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002893pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2894 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002895 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002896 }
2897}
David Tolnay8c81f622018-07-31 23:34:35 -07002898#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002899pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002900 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002901 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002902 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002903 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002904 }
2905}
David Tolnay8c81f622018-07-31 23:34:35 -07002906#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002907pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2908 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002909 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002910 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002911 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002912 }
2913}
David Tolnay8c81f622018-07-31 23:34:35 -07002914#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002915pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002916 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002917 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2918 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2919 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2920 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2921 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002922 }
2923}
David Tolnay8c81f622018-07-31 23:34:35 -07002924#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002925pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002926 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002927 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2928 ident: _visitor.fold_ident(_i.ident),
2929 fields: _visitor.fold_fields(_i.fields),
2930 discriminant: (_i.discriminant).map(|it| {
2931 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002932 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002933 _visitor.fold_expr((it).1),
2934 )
2935 }),
Nika Layzell27726662017-10-24 23:16:35 -04002936 }
2937}
David Tolnay8c81f622018-07-31 23:34:35 -07002938#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002939pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002940 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002941 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002942 }
2943}
David Tolnay8c81f622018-07-31 23:34:35 -07002944#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002945pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002946 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04002947 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002948 }
2949}
David Tolnay8c81f622018-07-31 23:34:35 -07002950#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002951pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002952 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04002953 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
2954 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
2955 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002956 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002957 }
2958}
David Tolnay8c81f622018-07-31 23:34:35 -07002959#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002960pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002961 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002962 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2963 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2964 Visibility::Restricted(_binding_0) => {
2965 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002966 }
David Tolnay8c81f622018-07-31 23:34:35 -07002967 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04002968 }
2969}
David Tolnay8c81f622018-07-31 23:34:35 -07002970#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002971pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002972 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04002973 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002974 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002975 }
2976}
David Tolnay8c81f622018-07-31 23:34:35 -07002977#[cfg(any(feature = "full", feature = "derive"))]
2978pub fn fold_where_predicate<V: Fold + ?Sized>(
2979 _visitor: &mut V,
2980 _i: WherePredicate,
2981) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002982 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002983 WherePredicate::Type(_binding_0) => {
2984 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002985 }
David Tolnay8c81f622018-07-31 23:34:35 -07002986 WherePredicate::Lifetime(_binding_0) => {
2987 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002988 }
David Tolnay8c81f622018-07-31 23:34:35 -07002989 WherePredicate::Eq(_binding_0) => {
2990 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002991 }
2992 }
2993}