blob: 53f93417676576af223129a1ed7ba414cf8c9930 [file] [log] [blame]
Nika Layzell27726662017-10-24 23:16:35 -04001// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
2
Nika Layzell27726662017-10-24 23:16:35 -04003#![allow(unreachable_code)]
David Tolnayf0d63bf2017-12-26 12:29:47 -05004#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
David Tolnay0a0d78c2018-01-05 15:24:01 -08005#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05006use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07007use proc_macro2::Span;
8#[cfg(any(feature = "full", feature = "derive"))]
9use token::{Brace, Bracket, Group, Paren};
10use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040011#[cfg(feature = "full")]
12macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070013 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070014 $e
15 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040016}
David Tolnay0a0d78c2018-01-05 15:24:01 -080017#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040018macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070019 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070020 unreachable!()
21 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040022}
David Tolnay6af48992018-08-01 11:16:28 -070023#[doc = r" Syntax tree traversal to transform the nodes of an owned syntax tree."]
24#[doc = r""]
25#[doc = r" See the [module documentation] for details."]
26#[doc = r""]
27#[doc = r" [module documentation]: index.html"]
28#[doc = r""]
29#[doc = r#" *This trait is available if Syn is built with the `"fold"` feature.*"#]
David Tolnay4b4c4b62018-01-06 13:48:05 -080030pub trait Fold {
David Tolnay8c81f622018-07-31 23:34:35 -070031 #[cfg(any(feature = "full", feature = "derive"))]
32 fn fold_abi(&mut self, i: Abi) -> Abi {
33 fold_abi(self, i)
34 }
35 #[cfg(any(feature = "full", feature = "derive"))]
36 fn fold_angle_bracketed_generic_arguments(
37 &mut self,
38 i: AngleBracketedGenericArguments,
39 ) -> AngleBracketedGenericArguments {
40 fold_angle_bracketed_generic_arguments(self, i)
41 }
42 #[cfg(feature = "full")]
43 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
44 fold_arg_captured(self, i)
45 }
46 #[cfg(feature = "full")]
47 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
48 fold_arg_self(self, i)
49 }
50 #[cfg(feature = "full")]
51 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
52 fold_arg_self_ref(self, i)
53 }
54 #[cfg(any(feature = "full", feature = "derive"))]
55 #[cfg(feature = "full")]
56 fn fold_arm(&mut self, i: Arm) -> Arm {
57 fold_arm(self, i)
58 }
59 #[cfg(any(feature = "full", feature = "derive"))]
60 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
61 fold_attr_style(self, i)
62 }
63 #[cfg(any(feature = "full", feature = "derive"))]
64 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
65 fold_attribute(self, i)
66 }
67 #[cfg(any(feature = "full", feature = "derive"))]
68 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
69 fold_bare_fn_arg(self, i)
70 }
71 #[cfg(any(feature = "full", feature = "derive"))]
72 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
73 fold_bare_fn_arg_name(self, i)
74 }
75 #[cfg(any(feature = "full", feature = "derive"))]
76 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
77 fold_bin_op(self, i)
78 }
79 #[cfg(any(feature = "full", feature = "derive"))]
80 fn fold_binding(&mut self, i: Binding) -> Binding {
81 fold_binding(self, i)
82 }
83 #[cfg(any(feature = "full", feature = "derive"))]
84 #[cfg(feature = "full")]
85 fn fold_block(&mut self, i: Block) -> Block {
86 fold_block(self, i)
87 }
88 #[cfg(any(feature = "full", feature = "derive"))]
89 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
90 fold_bound_lifetimes(self, i)
91 }
92 #[cfg(any(feature = "full", feature = "derive"))]
93 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
94 fold_const_param(self, i)
95 }
96 #[cfg(feature = "derive")]
97 fn fold_data(&mut self, i: Data) -> Data {
98 fold_data(self, i)
99 }
100 #[cfg(feature = "derive")]
101 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
102 fold_data_enum(self, i)
103 }
104 #[cfg(feature = "derive")]
105 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
106 fold_data_struct(self, i)
107 }
108 #[cfg(feature = "derive")]
109 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
110 fold_data_union(self, i)
111 }
112 #[cfg(feature = "derive")]
113 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
114 fold_derive_input(self, i)
115 }
116 #[cfg(any(feature = "full", feature = "derive"))]
117 fn fold_expr(&mut self, i: Expr) -> Expr {
118 fold_expr(self, i)
119 }
120 #[cfg(feature = "full")]
121 #[cfg(any(feature = "full", feature = "derive"))]
122 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
123 fold_expr_array(self, i)
124 }
125 #[cfg(feature = "full")]
126 #[cfg(any(feature = "full", feature = "derive"))]
127 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
128 fold_expr_assign(self, i)
129 }
130 #[cfg(feature = "full")]
131 #[cfg(any(feature = "full", feature = "derive"))]
132 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
133 fold_expr_assign_op(self, i)
134 }
135 #[cfg(any(feature = "full", feature = "derive"))]
136 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
137 fold_expr_binary(self, i)
138 }
139 #[cfg(feature = "full")]
140 #[cfg(any(feature = "full", feature = "derive"))]
141 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
142 fold_expr_block(self, i)
143 }
144 #[cfg(feature = "full")]
145 #[cfg(any(feature = "full", feature = "derive"))]
146 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
147 fold_expr_box(self, i)
148 }
149 #[cfg(feature = "full")]
150 #[cfg(any(feature = "full", feature = "derive"))]
151 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
152 fold_expr_break(self, i)
153 }
154 #[cfg(any(feature = "full", feature = "derive"))]
155 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
156 fold_expr_call(self, i)
157 }
158 #[cfg(any(feature = "full", feature = "derive"))]
159 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
160 fold_expr_cast(self, i)
161 }
162 #[cfg(feature = "full")]
163 #[cfg(any(feature = "full", feature = "derive"))]
164 fn fold_expr_catch(&mut self, i: ExprCatch) -> ExprCatch {
165 fold_expr_catch(self, i)
166 }
167 #[cfg(feature = "full")]
168 #[cfg(any(feature = "full", feature = "derive"))]
169 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
170 fold_expr_closure(self, i)
171 }
172 #[cfg(feature = "full")]
173 #[cfg(any(feature = "full", feature = "derive"))]
174 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
175 fold_expr_continue(self, i)
176 }
177 #[cfg(any(feature = "full", feature = "derive"))]
178 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
179 fold_expr_field(self, i)
180 }
181 #[cfg(feature = "full")]
182 #[cfg(any(feature = "full", feature = "derive"))]
183 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
184 fold_expr_for_loop(self, i)
185 }
186 #[cfg(feature = "full")]
187 #[cfg(any(feature = "full", feature = "derive"))]
188 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
189 fold_expr_group(self, i)
190 }
191 #[cfg(feature = "full")]
192 #[cfg(any(feature = "full", feature = "derive"))]
193 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
194 fold_expr_if(self, i)
195 }
196 #[cfg(feature = "full")]
197 #[cfg(any(feature = "full", feature = "derive"))]
198 fn fold_expr_if_let(&mut self, i: ExprIfLet) -> ExprIfLet {
199 fold_expr_if_let(self, i)
200 }
201 #[cfg(feature = "full")]
202 #[cfg(any(feature = "full", feature = "derive"))]
203 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
204 fold_expr_in_place(self, i)
205 }
206 #[cfg(any(feature = "full", feature = "derive"))]
207 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
208 fold_expr_index(self, i)
209 }
210 #[cfg(any(feature = "full", feature = "derive"))]
211 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
212 fold_expr_lit(self, i)
213 }
214 #[cfg(feature = "full")]
215 #[cfg(any(feature = "full", feature = "derive"))]
216 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
217 fold_expr_loop(self, i)
218 }
219 #[cfg(feature = "full")]
220 #[cfg(any(feature = "full", feature = "derive"))]
221 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
222 fold_expr_macro(self, i)
223 }
224 #[cfg(feature = "full")]
225 #[cfg(any(feature = "full", feature = "derive"))]
226 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
227 fold_expr_match(self, i)
228 }
229 #[cfg(feature = "full")]
230 #[cfg(any(feature = "full", feature = "derive"))]
231 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
232 fold_expr_method_call(self, i)
233 }
234 #[cfg(any(feature = "full", feature = "derive"))]
235 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
236 fold_expr_paren(self, i)
237 }
238 #[cfg(any(feature = "full", feature = "derive"))]
239 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
240 fold_expr_path(self, i)
241 }
242 #[cfg(feature = "full")]
243 #[cfg(any(feature = "full", feature = "derive"))]
244 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
245 fold_expr_range(self, i)
246 }
247 #[cfg(feature = "full")]
248 #[cfg(any(feature = "full", feature = "derive"))]
249 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
250 fold_expr_reference(self, i)
251 }
252 #[cfg(feature = "full")]
253 #[cfg(any(feature = "full", feature = "derive"))]
254 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
255 fold_expr_repeat(self, i)
256 }
257 #[cfg(feature = "full")]
258 #[cfg(any(feature = "full", feature = "derive"))]
259 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
260 fold_expr_return(self, i)
261 }
262 #[cfg(feature = "full")]
263 #[cfg(any(feature = "full", feature = "derive"))]
264 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
265 fold_expr_struct(self, i)
266 }
267 #[cfg(feature = "full")]
268 #[cfg(any(feature = "full", feature = "derive"))]
269 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
270 fold_expr_try(self, i)
271 }
272 #[cfg(feature = "full")]
273 #[cfg(any(feature = "full", feature = "derive"))]
274 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
275 fold_expr_tuple(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg(any(feature = "full", feature = "derive"))]
279 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
280 fold_expr_type(self, i)
281 }
282 #[cfg(any(feature = "full", feature = "derive"))]
283 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
284 fold_expr_unary(self, i)
285 }
286 #[cfg(feature = "full")]
287 #[cfg(any(feature = "full", feature = "derive"))]
288 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
289 fold_expr_unsafe(self, i)
290 }
291 #[cfg(any(feature = "full", feature = "derive"))]
292 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
293 fold_expr_verbatim(self, i)
294 }
295 #[cfg(feature = "full")]
296 #[cfg(any(feature = "full", feature = "derive"))]
297 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
298 fold_expr_while(self, i)
299 }
300 #[cfg(feature = "full")]
301 #[cfg(any(feature = "full", feature = "derive"))]
302 fn fold_expr_while_let(&mut self, i: ExprWhileLet) -> ExprWhileLet {
303 fold_expr_while_let(self, i)
304 }
305 #[cfg(feature = "full")]
306 #[cfg(any(feature = "full", feature = "derive"))]
307 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
308 fold_expr_yield(self, i)
309 }
310 #[cfg(any(feature = "full", feature = "derive"))]
311 fn fold_field(&mut self, i: Field) -> Field {
312 fold_field(self, i)
313 }
314 #[cfg(any(feature = "full", feature = "derive"))]
315 #[cfg(feature = "full")]
316 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
317 fold_field_pat(self, i)
318 }
319 #[cfg(any(feature = "full", feature = "derive"))]
320 #[cfg(feature = "full")]
321 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
322 fold_field_value(self, i)
323 }
324 #[cfg(any(feature = "full", feature = "derive"))]
325 fn fold_fields(&mut self, i: Fields) -> Fields {
326 fold_fields(self, i)
327 }
328 #[cfg(any(feature = "full", feature = "derive"))]
329 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
330 fold_fields_named(self, i)
331 }
332 #[cfg(any(feature = "full", feature = "derive"))]
333 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
334 fold_fields_unnamed(self, i)
335 }
336 #[cfg(feature = "full")]
337 fn fold_file(&mut self, i: File) -> File {
338 fold_file(self, i)
339 }
340 #[cfg(feature = "full")]
341 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
342 fold_fn_arg(self, i)
343 }
344 #[cfg(feature = "full")]
345 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
346 fold_fn_decl(self, i)
347 }
348 #[cfg(feature = "full")]
349 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
350 fold_foreign_item(self, i)
351 }
352 #[cfg(feature = "full")]
353 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
354 fold_foreign_item_fn(self, i)
355 }
356 #[cfg(feature = "full")]
357 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
358 fold_foreign_item_static(self, i)
359 }
360 #[cfg(feature = "full")]
361 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
362 fold_foreign_item_type(self, i)
363 }
364 #[cfg(feature = "full")]
365 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
366 fold_foreign_item_verbatim(self, i)
367 }
368 #[cfg(any(feature = "full", feature = "derive"))]
369 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
370 fold_generic_argument(self, i)
371 }
372 #[cfg(any(feature = "full", feature = "derive"))]
373 #[cfg(feature = "full")]
374 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
375 fold_generic_method_argument(self, i)
376 }
377 #[cfg(any(feature = "full", feature = "derive"))]
378 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
379 fold_generic_param(self, i)
380 }
381 #[cfg(any(feature = "full", feature = "derive"))]
382 fn fold_generics(&mut self, i: Generics) -> Generics {
383 fold_generics(self, i)
384 }
David Tolnay8c81f622018-07-31 23:34:35 -0700385 fn fold_ident(&mut self, i: Ident) -> Ident {
386 fold_ident(self, i)
387 }
388 #[cfg(feature = "full")]
389 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
390 fold_impl_item(self, i)
391 }
392 #[cfg(feature = "full")]
393 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
394 fold_impl_item_const(self, i)
395 }
396 #[cfg(feature = "full")]
397 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
398 fold_impl_item_macro(self, i)
399 }
400 #[cfg(feature = "full")]
401 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
402 fold_impl_item_method(self, i)
403 }
404 #[cfg(feature = "full")]
405 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
406 fold_impl_item_type(self, i)
407 }
408 #[cfg(feature = "full")]
409 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
410 fold_impl_item_verbatim(self, i)
411 }
412 #[cfg(any(feature = "full", feature = "derive"))]
413 fn fold_index(&mut self, i: Index) -> Index {
414 fold_index(self, i)
415 }
416 #[cfg(feature = "full")]
417 fn fold_item(&mut self, i: Item) -> Item {
418 fold_item(self, i)
419 }
420 #[cfg(feature = "full")]
421 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
422 fold_item_const(self, i)
423 }
424 #[cfg(feature = "full")]
425 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
426 fold_item_enum(self, i)
427 }
428 #[cfg(feature = "full")]
429 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
430 fold_item_extern_crate(self, i)
431 }
432 #[cfg(feature = "full")]
433 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
434 fold_item_fn(self, i)
435 }
436 #[cfg(feature = "full")]
437 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
438 fold_item_foreign_mod(self, i)
439 }
440 #[cfg(feature = "full")]
441 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
442 fold_item_impl(self, i)
443 }
444 #[cfg(feature = "full")]
445 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
446 fold_item_macro(self, i)
447 }
448 #[cfg(feature = "full")]
449 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
450 fold_item_macro2(self, i)
451 }
452 #[cfg(feature = "full")]
453 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
454 fold_item_mod(self, i)
455 }
456 #[cfg(feature = "full")]
457 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
458 fold_item_static(self, i)
459 }
460 #[cfg(feature = "full")]
461 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
462 fold_item_struct(self, i)
463 }
464 #[cfg(feature = "full")]
465 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
466 fold_item_trait(self, i)
467 }
468 #[cfg(feature = "full")]
469 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
470 fold_item_type(self, i)
471 }
472 #[cfg(feature = "full")]
473 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
474 fold_item_union(self, i)
475 }
476 #[cfg(feature = "full")]
477 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
478 fold_item_use(self, i)
479 }
480 #[cfg(feature = "full")]
481 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
482 fold_item_verbatim(self, i)
483 }
484 #[cfg(any(feature = "full", feature = "derive"))]
485 #[cfg(feature = "full")]
486 fn fold_label(&mut self, i: Label) -> Label {
487 fold_label(self, i)
488 }
489 #[cfg(any(feature = "full", feature = "derive"))]
490 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
491 fold_lifetime(self, i)
492 }
493 #[cfg(any(feature = "full", feature = "derive"))]
494 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
495 fold_lifetime_def(self, i)
496 }
497 #[cfg(any(feature = "full", feature = "derive"))]
498 fn fold_lit(&mut self, i: Lit) -> Lit {
499 fold_lit(self, i)
500 }
501 #[cfg(any(feature = "full", feature = "derive"))]
502 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
503 fold_lit_bool(self, i)
504 }
505 #[cfg(any(feature = "full", feature = "derive"))]
506 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
507 fold_lit_byte(self, i)
508 }
509 #[cfg(any(feature = "full", feature = "derive"))]
510 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
511 fold_lit_byte_str(self, i)
512 }
513 #[cfg(any(feature = "full", feature = "derive"))]
514 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
515 fold_lit_char(self, i)
516 }
517 #[cfg(any(feature = "full", feature = "derive"))]
518 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
519 fold_lit_float(self, i)
520 }
521 #[cfg(any(feature = "full", feature = "derive"))]
522 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
523 fold_lit_int(self, i)
524 }
525 #[cfg(any(feature = "full", feature = "derive"))]
526 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
527 fold_lit_str(self, i)
528 }
529 #[cfg(any(feature = "full", feature = "derive"))]
530 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
531 fold_lit_verbatim(self, i)
532 }
533 #[cfg(any(feature = "full", feature = "derive"))]
534 #[cfg(feature = "full")]
535 fn fold_local(&mut self, i: Local) -> Local {
536 fold_local(self, i)
537 }
538 #[cfg(any(feature = "full", feature = "derive"))]
539 fn fold_macro(&mut self, i: Macro) -> Macro {
540 fold_macro(self, i)
541 }
542 #[cfg(any(feature = "full", feature = "derive"))]
543 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
544 fold_macro_delimiter(self, i)
545 }
546 #[cfg(any(feature = "full", feature = "derive"))]
547 fn fold_member(&mut self, i: Member) -> Member {
548 fold_member(self, i)
549 }
550 #[cfg(any(feature = "full", feature = "derive"))]
551 fn fold_meta(&mut self, i: Meta) -> Meta {
552 fold_meta(self, i)
553 }
554 #[cfg(any(feature = "full", feature = "derive"))]
555 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
556 fold_meta_list(self, i)
557 }
558 #[cfg(any(feature = "full", feature = "derive"))]
559 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
560 fold_meta_name_value(self, i)
561 }
562 #[cfg(feature = "full")]
563 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
564 fold_method_sig(self, i)
565 }
566 #[cfg(any(feature = "full", feature = "derive"))]
567 #[cfg(feature = "full")]
568 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
569 fold_method_turbofish(self, i)
570 }
571 #[cfg(any(feature = "full", feature = "derive"))]
572 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
573 fold_nested_meta(self, i)
574 }
575 #[cfg(any(feature = "full", feature = "derive"))]
576 fn fold_parenthesized_generic_arguments(
577 &mut self,
578 i: ParenthesizedGenericArguments,
579 ) -> ParenthesizedGenericArguments {
580 fold_parenthesized_generic_arguments(self, i)
581 }
582 #[cfg(any(feature = "full", feature = "derive"))]
583 #[cfg(feature = "full")]
584 fn fold_pat(&mut self, i: Pat) -> Pat {
585 fold_pat(self, i)
586 }
587 #[cfg(any(feature = "full", feature = "derive"))]
588 #[cfg(feature = "full")]
589 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
590 fold_pat_box(self, i)
591 }
592 #[cfg(any(feature = "full", feature = "derive"))]
593 #[cfg(feature = "full")]
594 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
595 fold_pat_ident(self, i)
596 }
597 #[cfg(any(feature = "full", feature = "derive"))]
598 #[cfg(feature = "full")]
599 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
600 fold_pat_lit(self, i)
601 }
602 #[cfg(any(feature = "full", feature = "derive"))]
603 #[cfg(feature = "full")]
604 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
605 fold_pat_macro(self, i)
606 }
607 #[cfg(any(feature = "full", feature = "derive"))]
608 #[cfg(feature = "full")]
609 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
610 fold_pat_path(self, i)
611 }
612 #[cfg(any(feature = "full", feature = "derive"))]
613 #[cfg(feature = "full")]
614 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
615 fold_pat_range(self, i)
616 }
617 #[cfg(any(feature = "full", feature = "derive"))]
618 #[cfg(feature = "full")]
619 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
620 fold_pat_ref(self, i)
621 }
622 #[cfg(any(feature = "full", feature = "derive"))]
623 #[cfg(feature = "full")]
624 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
625 fold_pat_slice(self, i)
626 }
627 #[cfg(any(feature = "full", feature = "derive"))]
628 #[cfg(feature = "full")]
629 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
630 fold_pat_struct(self, i)
631 }
632 #[cfg(any(feature = "full", feature = "derive"))]
633 #[cfg(feature = "full")]
634 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
635 fold_pat_tuple(self, i)
636 }
637 #[cfg(any(feature = "full", feature = "derive"))]
638 #[cfg(feature = "full")]
639 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
640 fold_pat_tuple_struct(self, i)
641 }
642 #[cfg(any(feature = "full", feature = "derive"))]
643 #[cfg(feature = "full")]
644 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
645 fold_pat_verbatim(self, i)
646 }
647 #[cfg(any(feature = "full", feature = "derive"))]
648 #[cfg(feature = "full")]
649 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
650 fold_pat_wild(self, i)
651 }
652 #[cfg(any(feature = "full", feature = "derive"))]
653 fn fold_path(&mut self, i: Path) -> Path {
654 fold_path(self, i)
655 }
656 #[cfg(any(feature = "full", feature = "derive"))]
657 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
658 fold_path_arguments(self, i)
659 }
660 #[cfg(any(feature = "full", feature = "derive"))]
661 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
662 fold_path_segment(self, i)
663 }
664 #[cfg(any(feature = "full", feature = "derive"))]
665 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
666 fold_predicate_eq(self, i)
667 }
668 #[cfg(any(feature = "full", feature = "derive"))]
669 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
670 fold_predicate_lifetime(self, i)
671 }
672 #[cfg(any(feature = "full", feature = "derive"))]
673 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
674 fold_predicate_type(self, i)
675 }
676 #[cfg(any(feature = "full", feature = "derive"))]
677 fn fold_qself(&mut self, i: QSelf) -> QSelf {
678 fold_qself(self, i)
679 }
680 #[cfg(any(feature = "full", feature = "derive"))]
681 #[cfg(feature = "full")]
682 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
683 fold_range_limits(self, i)
684 }
685 #[cfg(any(feature = "full", feature = "derive"))]
686 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
687 fold_return_type(self, i)
688 }
David Tolnay8c81f622018-07-31 23:34:35 -0700689 fn fold_span(&mut self, i: Span) -> Span {
690 fold_span(self, i)
691 }
692 #[cfg(any(feature = "full", feature = "derive"))]
693 #[cfg(feature = "full")]
694 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
695 fold_stmt(self, i)
696 }
697 #[cfg(any(feature = "full", feature = "derive"))]
698 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
699 fold_trait_bound(self, i)
700 }
701 #[cfg(any(feature = "full", feature = "derive"))]
702 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
703 fold_trait_bound_modifier(self, i)
704 }
705 #[cfg(feature = "full")]
706 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
707 fold_trait_item(self, i)
708 }
709 #[cfg(feature = "full")]
710 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
711 fold_trait_item_const(self, i)
712 }
713 #[cfg(feature = "full")]
714 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
715 fold_trait_item_macro(self, i)
716 }
717 #[cfg(feature = "full")]
718 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
719 fold_trait_item_method(self, i)
720 }
721 #[cfg(feature = "full")]
722 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
723 fold_trait_item_type(self, i)
724 }
725 #[cfg(feature = "full")]
726 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
727 fold_trait_item_verbatim(self, i)
728 }
729 #[cfg(any(feature = "full", feature = "derive"))]
730 fn fold_type(&mut self, i: Type) -> Type {
731 fold_type(self, i)
732 }
733 #[cfg(any(feature = "full", feature = "derive"))]
734 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
735 fold_type_array(self, i)
736 }
737 #[cfg(any(feature = "full", feature = "derive"))]
738 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
739 fold_type_bare_fn(self, i)
740 }
741 #[cfg(any(feature = "full", feature = "derive"))]
742 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
743 fold_type_group(self, i)
744 }
745 #[cfg(any(feature = "full", feature = "derive"))]
746 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
747 fold_type_impl_trait(self, i)
748 }
749 #[cfg(any(feature = "full", feature = "derive"))]
750 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
751 fold_type_infer(self, i)
752 }
753 #[cfg(any(feature = "full", feature = "derive"))]
754 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
755 fold_type_macro(self, i)
756 }
757 #[cfg(any(feature = "full", feature = "derive"))]
758 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
759 fold_type_never(self, i)
760 }
761 #[cfg(any(feature = "full", feature = "derive"))]
762 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
763 fold_type_param(self, i)
764 }
765 #[cfg(any(feature = "full", feature = "derive"))]
766 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
767 fold_type_param_bound(self, i)
768 }
769 #[cfg(any(feature = "full", feature = "derive"))]
770 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
771 fold_type_paren(self, i)
772 }
773 #[cfg(any(feature = "full", feature = "derive"))]
774 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
775 fold_type_path(self, i)
776 }
777 #[cfg(any(feature = "full", feature = "derive"))]
778 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
779 fold_type_ptr(self, i)
780 }
781 #[cfg(any(feature = "full", feature = "derive"))]
782 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
783 fold_type_reference(self, i)
784 }
785 #[cfg(any(feature = "full", feature = "derive"))]
786 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
787 fold_type_slice(self, i)
788 }
789 #[cfg(any(feature = "full", feature = "derive"))]
790 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
791 fold_type_trait_object(self, i)
792 }
793 #[cfg(any(feature = "full", feature = "derive"))]
794 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
795 fold_type_tuple(self, i)
796 }
797 #[cfg(any(feature = "full", feature = "derive"))]
798 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
799 fold_type_verbatim(self, i)
800 }
801 #[cfg(any(feature = "full", feature = "derive"))]
802 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
803 fold_un_op(self, i)
804 }
805 #[cfg(feature = "full")]
806 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
807 fold_use_glob(self, i)
808 }
809 #[cfg(feature = "full")]
810 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
811 fold_use_group(self, i)
812 }
813 #[cfg(feature = "full")]
814 fn fold_use_name(&mut self, i: UseName) -> UseName {
815 fold_use_name(self, i)
816 }
817 #[cfg(feature = "full")]
818 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
819 fold_use_path(self, i)
820 }
821 #[cfg(feature = "full")]
822 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
823 fold_use_rename(self, i)
824 }
825 #[cfg(feature = "full")]
826 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
827 fold_use_tree(self, i)
828 }
829 #[cfg(any(feature = "full", feature = "derive"))]
830 fn fold_variant(&mut self, i: Variant) -> Variant {
831 fold_variant(self, i)
832 }
833 #[cfg(any(feature = "full", feature = "derive"))]
834 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
835 fold_vis_crate(self, i)
836 }
837 #[cfg(any(feature = "full", feature = "derive"))]
838 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
839 fold_vis_public(self, i)
840 }
841 #[cfg(any(feature = "full", feature = "derive"))]
842 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
843 fold_vis_restricted(self, i)
844 }
845 #[cfg(any(feature = "full", feature = "derive"))]
846 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
847 fold_visibility(self, i)
848 }
849 #[cfg(any(feature = "full", feature = "derive"))]
850 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
851 fold_where_clause(self, i)
852 }
853 #[cfg(any(feature = "full", feature = "derive"))]
854 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
855 fold_where_predicate(self, i)
856 }
Nika Layzell27726662017-10-24 23:16:35 -0400857}
David Tolnayd3f32142018-05-20 20:21:12 -0700858#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800859macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700860 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800861 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700862 let span = _visitor.fold_span(_i.span());
863 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800864 _i
865 }
David Tolnay8c81f622018-07-31 23:34:35 -0700866 };
David Tolnayd0adf522017-12-29 01:30:07 -0500867}
David Tolnay360efd22018-01-04 23:35:26 -0800868#[cfg(any(feature = "full", feature = "derive"))]
869fold_span_only!(fold_lit_byte: LitByte);
870#[cfg(any(feature = "full", feature = "derive"))]
871fold_span_only!(fold_lit_byte_str: LitByteStr);
872#[cfg(any(feature = "full", feature = "derive"))]
873fold_span_only!(fold_lit_char: LitChar);
874#[cfg(any(feature = "full", feature = "derive"))]
875fold_span_only!(fold_lit_float: LitFloat);
876#[cfg(any(feature = "full", feature = "derive"))]
877fold_span_only!(fold_lit_int: LitInt);
878#[cfg(any(feature = "full", feature = "derive"))]
879fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700880#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800881pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400882 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400883 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700884 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400885 }
886}
David Tolnay8c81f622018-07-31 23:34:35 -0700887#[cfg(any(feature = "full", feature = "derive"))]
888pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
889 _visitor: &mut V,
890 _i: AngleBracketedGenericArguments,
891) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500892 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400893 colon2_token: (_i.colon2_token)
894 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
895 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700896 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400897 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400898 }
899}
David Tolnay8c81f622018-07-31 23:34:35 -0700900#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800901pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400902 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700903 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400904 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700905 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400906 }
907}
David Tolnay8c81f622018-07-31 23:34:35 -0700908#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800909pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400910 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400911 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
912 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400913 }
914}
David Tolnay8c81f622018-07-31 23:34:35 -0700915#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800916pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400917 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400918 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700919 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
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(any(feature = "full", feature = "derive"))]
925#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800926pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400927 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700928 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400929 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700930 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
931 guard: (_i.guard).map(|it| {
932 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400933 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700934 Box::new(_visitor.fold_expr(*(it).1)),
935 )
936 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400937 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700938 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400939 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400940 }
941}
David Tolnay8c81f622018-07-31 23:34:35 -0700942#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800943pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400944 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700945 AttrStyle::Outer => AttrStyle::Outer,
946 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400947 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400948 }
949 }
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_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400953 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400954 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700955 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400956 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700957 path: _visitor.fold_path(_i.path),
958 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400959 }
960}
David Tolnay8c81f622018-07-31 23:34:35 -0700961#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800962pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400963 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700964 name: (_i.name).map(|it| {
965 (
966 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400967 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700968 )
969 }),
970 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400971 }
972}
David Tolnay8c81f622018-07-31 23:34:35 -0700973#[cfg(any(feature = "full", feature = "derive"))]
974pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
975 _visitor: &mut V,
976 _i: BareFnArgName,
977) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400978 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700979 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
980 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400981 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400982 }
983 }
984}
David Tolnay8c81f622018-07-31 23:34:35 -0700985#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800986pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -0400987 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700988 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400989 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400990 }
David Tolnay8c81f622018-07-31 23:34:35 -0700991 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400992 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400993 }
David Tolnay8c81f622018-07-31 23:34:35 -0700994 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400995 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400996 }
David Tolnay8c81f622018-07-31 23:34:35 -0700997 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400998 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400999 }
David Tolnay8c81f622018-07-31 23:34:35 -07001000 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001001 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001002 }
David Tolnay8c81f622018-07-31 23:34:35 -07001003 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001004 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001005 }
David Tolnay8c81f622018-07-31 23:34:35 -07001006 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001007 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001008 }
David Tolnay8c81f622018-07-31 23:34:35 -07001009 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001010 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001011 }
David Tolnay8c81f622018-07-31 23:34:35 -07001012 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001013 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001014 }
David Tolnay8c81f622018-07-31 23:34:35 -07001015 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001016 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001017 }
David Tolnay8c81f622018-07-31 23:34:35 -07001018 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001019 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001020 }
David Tolnay8c81f622018-07-31 23:34:35 -07001021 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001022 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001023 }
David Tolnay8c81f622018-07-31 23:34:35 -07001024 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001025 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001026 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001027 BinOp::Lt(_binding_0) => {
1028 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1029 }
David Tolnay8c81f622018-07-31 23:34:35 -07001030 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001031 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001032 }
David Tolnay8c81f622018-07-31 23:34:35 -07001033 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001034 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001035 }
David Tolnay8c81f622018-07-31 23:34:35 -07001036 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001037 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001038 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001039 BinOp::Gt(_binding_0) => {
1040 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1041 }
David Tolnay8c81f622018-07-31 23:34:35 -07001042 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001043 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001044 }
David Tolnay8c81f622018-07-31 23:34:35 -07001045 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001046 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001047 }
David Tolnay8c81f622018-07-31 23:34:35 -07001048 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001049 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001050 }
David Tolnay8c81f622018-07-31 23:34:35 -07001051 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001052 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001053 }
David Tolnay8c81f622018-07-31 23:34:35 -07001054 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001055 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001056 }
David Tolnay8c81f622018-07-31 23:34:35 -07001057 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001058 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001059 }
David Tolnay8c81f622018-07-31 23:34:35 -07001060 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001061 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001062 }
David Tolnay8c81f622018-07-31 23:34:35 -07001063 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001064 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001065 }
David Tolnay8c81f622018-07-31 23:34:35 -07001066 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001067 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001068 }
David Tolnay8c81f622018-07-31 23:34:35 -07001069 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001070 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001071 }
1072 }
1073}
David Tolnay8c81f622018-07-31 23:34:35 -07001074#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001075pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001076 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001077 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001078 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001079 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001080 }
1081}
David Tolnay8c81f622018-07-31 23:34:35 -07001082#[cfg(any(feature = "full", feature = "derive"))]
1083#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001084pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001085 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001086 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001087 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001088 }
1089}
David Tolnay8c81f622018-07-31 23:34:35 -07001090#[cfg(any(feature = "full", feature = "derive"))]
1091pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1092 _visitor: &mut V,
1093 _i: BoundLifetimes,
1094) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001095 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001096 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1097 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001098 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001099 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001100 }
1101}
David Tolnay8c81f622018-07-31 23:34:35 -07001102#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001103pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001104 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001105 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001106 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001107 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001108 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001109 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001110 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001111 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001112 }
1113}
David Tolnay8c81f622018-07-31 23:34:35 -07001114#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001115pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001116 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001117 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1118 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1119 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001120 }
1121}
David Tolnay8c81f622018-07-31 23:34:35 -07001122#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001123pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001124 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001125 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1126 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001127 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001128 }
1129}
David Tolnay8c81f622018-07-31 23:34:35 -07001130#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001131pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001132 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001133 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001134 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001135 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001136 }
1137}
David Tolnay8c81f622018-07-31 23:34:35 -07001138#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001139pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001140 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001141 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001142 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001143 }
1144}
David Tolnay8c81f622018-07-31 23:34:35 -07001145#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001146pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001147 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001148 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1149 vis: _visitor.fold_visibility(_i.vis),
1150 ident: _visitor.fold_ident(_i.ident),
1151 generics: _visitor.fold_generics(_i.generics),
1152 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001153 }
1154}
David Tolnay8c81f622018-07-31 23:34:35 -07001155#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001156pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001157 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001158 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1159 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1160 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1161 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1162 Expr::MethodCall(_binding_0) => {
1163 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001164 }
David Tolnay8c81f622018-07-31 23:34:35 -07001165 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1166 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1167 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1168 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1169 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1170 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
1171 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
1172 Expr::IfLet(_binding_0) => Expr::IfLet(full!(_visitor.fold_expr_if_let(_binding_0))),
1173 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
1174 Expr::WhileLet(_binding_0) => {
1175 Expr::WhileLet(full!(_visitor.fold_expr_while_let(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001176 }
David Tolnay8c81f622018-07-31 23:34:35 -07001177 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1178 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1179 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1180 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1181 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1182 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1183 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1184 Expr::AssignOp(_binding_0) => {
1185 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001186 }
David Tolnay8c81f622018-07-31 23:34:35 -07001187 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1188 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1189 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1190 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1191 Expr::Reference(_binding_0) => {
1192 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001193 }
David Tolnay8c81f622018-07-31 23:34:35 -07001194 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1195 Expr::Continue(_binding_0) => {
1196 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001197 }
David Tolnay8c81f622018-07-31 23:34:35 -07001198 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1199 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1200 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1201 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1202 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1203 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1204 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
1205 Expr::Catch(_binding_0) => Expr::Catch(full!(_visitor.fold_expr_catch(_binding_0))),
1206 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1207 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001208 }
1209}
David Tolnay8c81f622018-07-31 23:34:35 -07001210#[cfg(feature = "full")]
1211#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001212pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001213 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001214 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001215 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001216 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001217 }
1218}
David Tolnay8c81f622018-07-31 23:34:35 -07001219#[cfg(feature = "full")]
1220#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001221pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001222 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001223 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1224 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001225 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001226 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001227 }
1228}
David Tolnay8c81f622018-07-31 23:34:35 -07001229#[cfg(feature = "full")]
1230#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001231pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001232 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001233 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1234 left: Box::new(_visitor.fold_expr(*_i.left)),
1235 op: _visitor.fold_bin_op(_i.op),
1236 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001237 }
1238}
David Tolnay8c81f622018-07-31 23:34:35 -07001239#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001240pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001241 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001242 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1243 left: Box::new(_visitor.fold_expr(*_i.left)),
1244 op: _visitor.fold_bin_op(_i.op),
1245 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001246 }
1247}
David Tolnay8c81f622018-07-31 23:34:35 -07001248#[cfg(feature = "full")]
1249#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001250pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001251 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001252 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1253 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001254 }
1255}
David Tolnay8c81f622018-07-31 23:34:35 -07001256#[cfg(feature = "full")]
1257#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001258pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001259 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001260 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001261 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001262 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001263 }
1264}
David Tolnay8c81f622018-07-31 23:34:35 -07001265#[cfg(feature = "full")]
1266#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001267pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001268 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001269 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001270 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001271 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1272 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001273 }
1274}
David Tolnay8c81f622018-07-31 23:34:35 -07001275#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001276pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001277 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001278 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1279 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001280 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001281 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001282 }
1283}
David Tolnay8c81f622018-07-31 23:34:35 -07001284#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001285pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001286 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001287 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1288 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001289 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001290 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001291 }
1292}
David Tolnay8c81f622018-07-31 23:34:35 -07001293#[cfg(feature = "full")]
1294#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001295pub fn fold_expr_catch<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCatch) -> ExprCatch {
David Tolnay8c91b882017-12-28 23:04:32 -05001296 ExprCatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001297 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001298 do_token: Token ! [ do ](tokens_helper(_visitor, &_i.do_token.span)),
1299 catch_token: Token![catch](tokens_helper(_visitor, &_i.catch_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001300 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001301 }
1302}
David Tolnay8c81f622018-07-31 23:34:35 -07001303#[cfg(feature = "full")]
1304#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001305pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001306 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001307 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001308 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1309 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1310 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001311 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001312 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001313 output: _visitor.fold_return_type(_i.output),
1314 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001315 }
1316}
David Tolnay8c81f622018-07-31 23:34:35 -07001317#[cfg(feature = "full")]
1318#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001319pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001320 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001321 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001322 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001323 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001324 }
1325}
David Tolnay8c81f622018-07-31 23:34:35 -07001326#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001327pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001328 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001329 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1330 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001331 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001332 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001333 }
1334}
David Tolnay8c81f622018-07-31 23:34:35 -07001335#[cfg(feature = "full")]
1336#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001337pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001338 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001339 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1340 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001341 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001342 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001343 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001344 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1345 body: _visitor.fold_block(_i.body),
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_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001351 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001352 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001353 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001354 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001355 }
1356}
David Tolnay8c81f622018-07-31 23:34:35 -07001357#[cfg(feature = "full")]
1358#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001359pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001360 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001361 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001362 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001363 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1364 then_branch: _visitor.fold_block(_i.then_branch),
1365 else_branch: (_i.else_branch).map(|it| {
1366 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001367 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001368 Box::new(_visitor.fold_expr(*(it).1)),
1369 )
1370 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001371 }
1372}
David Tolnay8c81f622018-07-31 23:34:35 -07001373#[cfg(feature = "full")]
1374#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001375pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001376 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001377 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001378 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
1379 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001380 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001381 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001382 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1383 then_branch: _visitor.fold_block(_i.then_branch),
1384 else_branch: (_i.else_branch).map(|it| {
1385 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001386 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001387 Box::new(_visitor.fold_expr(*(it).1)),
1388 )
1389 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001390 }
1391}
David Tolnay8c81f622018-07-31 23:34:35 -07001392#[cfg(feature = "full")]
1393#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001394pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001395 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001396 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1397 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001398 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001399 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001400 }
1401}
David Tolnay8c81f622018-07-31 23:34:35 -07001402#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001403pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001404 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001405 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1406 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001407 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001408 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001409 }
1410}
David Tolnay8c81f622018-07-31 23:34:35 -07001411#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001412pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001413 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001414 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1415 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001416 }
1417}
David Tolnay8c81f622018-07-31 23:34:35 -07001418#[cfg(feature = "full")]
1419#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001420pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001421 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001422 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1423 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001424 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001425 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001426 }
1427}
David Tolnay8c81f622018-07-31 23:34:35 -07001428#[cfg(feature = "full")]
1429#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001430pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001431 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001432 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1433 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001434 }
1435}
David Tolnay8c81f622018-07-31 23:34:35 -07001436#[cfg(feature = "full")]
1437#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001438pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001439 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001440 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001441 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001442 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001443 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001444 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001445 }
1446}
David Tolnay8c81f622018-07-31 23:34:35 -07001447#[cfg(feature = "full")]
1448#[cfg(any(feature = "full", feature = "derive"))]
1449pub fn fold_expr_method_call<V: Fold + ?Sized>(
1450 _visitor: &mut V,
1451 _i: ExprMethodCall,
1452) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001453 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001454 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1455 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001456 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001457 method: _visitor.fold_ident(_i.method),
1458 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001459 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001460 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001461 }
1462}
David Tolnay8c81f622018-07-31 23:34:35 -07001463#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001464pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001465 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001466 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001467 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001468 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001469 }
1470}
David Tolnay8c81f622018-07-31 23:34:35 -07001471#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001472pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001473 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001474 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1475 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1476 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001477 }
1478}
David Tolnay8c81f622018-07-31 23:34:35 -07001479#[cfg(feature = "full")]
1480#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001481pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001482 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001483 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1484 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1485 limits: _visitor.fold_range_limits(_i.limits),
1486 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001487 }
1488}
David Tolnay8c81f622018-07-31 23:34:35 -07001489#[cfg(feature = "full")]
1490#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001491pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1492 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001493 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001494 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1495 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001496 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001497 }
1498}
David Tolnay8c81f622018-07-31 23:34:35 -07001499#[cfg(feature = "full")]
1500#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001501pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001502 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001503 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001504 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001505 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001506 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001507 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001508 }
1509}
David Tolnay8c81f622018-07-31 23:34:35 -07001510#[cfg(feature = "full")]
1511#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001512pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001513 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001514 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001515 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001516 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001517 }
1518}
David Tolnay8c81f622018-07-31 23:34:35 -07001519#[cfg(feature = "full")]
1520#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001521pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001522 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001523 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1524 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001525 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001526 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001527 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001528 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001529 }
1530}
David Tolnay8c81f622018-07-31 23:34:35 -07001531#[cfg(feature = "full")]
1532#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001533pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001534 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001535 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1536 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001537 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001538 }
1539}
David Tolnay8c81f622018-07-31 23:34:35 -07001540#[cfg(feature = "full")]
1541#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001542pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001543 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001544 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001545 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001546 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001547 }
1548}
David Tolnay8c81f622018-07-31 23:34:35 -07001549#[cfg(feature = "full")]
1550#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001551pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001552 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001553 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1554 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001555 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001556 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001557 }
1558}
David Tolnay8c81f622018-07-31 23:34:35 -07001559#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001560pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001561 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001562 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1563 op: _visitor.fold_un_op(_i.op),
1564 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001565 }
1566}
David Tolnay8c81f622018-07-31 23:34:35 -07001567#[cfg(feature = "full")]
1568#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001569pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001570 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001571 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001572 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001573 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001574 }
1575}
David Tolnay8c81f622018-07-31 23:34:35 -07001576#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001577pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001578 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001579}
David Tolnay8c81f622018-07-31 23:34:35 -07001580#[cfg(feature = "full")]
1581#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001582pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001583 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001584 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1585 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001586 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001587 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1588 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001589 }
1590}
David Tolnay8c81f622018-07-31 23:34:35 -07001591#[cfg(feature = "full")]
1592#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001593pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001594 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001595 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1596 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001597 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
1598 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001599 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001600 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001601 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1602 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001603 }
1604}
David Tolnay8c81f622018-07-31 23:34:35 -07001605#[cfg(feature = "full")]
1606#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001607pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001608 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001609 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001610 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001611 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001612 }
1613}
David Tolnay8c81f622018-07-31 23:34:35 -07001614#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001615pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001616 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001617 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1618 vis: _visitor.fold_visibility(_i.vis),
1619 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001620 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001621 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001622 }
1623}
David Tolnay8c81f622018-07-31 23:34:35 -07001624#[cfg(any(feature = "full", feature = "derive"))]
1625#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001626pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001627 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001628 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1629 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001630 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001631 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001632 }
1633}
David Tolnay8c81f622018-07-31 23:34:35 -07001634#[cfg(any(feature = "full", feature = "derive"))]
1635#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001636pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001637 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001638 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1639 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001640 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001641 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001642 }
1643}
David Tolnay8c81f622018-07-31 23:34:35 -07001644#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001645pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001646 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001647 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1648 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1649 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001650 }
1651}
David Tolnay8c81f622018-07-31 23:34:35 -07001652#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001653pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001654 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001655 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001656 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001657 }
1658}
David Tolnay8c81f622018-07-31 23:34:35 -07001659#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001660pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001661 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001662 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001663 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001664 }
1665}
David Tolnay8c81f622018-07-31 23:34:35 -07001666#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001667pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001668 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001669 shebang: _i.shebang,
1670 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1671 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001672 }
1673}
David Tolnay8c81f622018-07-31 23:34:35 -07001674#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001675pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001676 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001677 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1678 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1679 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1680 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1681 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001682 }
1683}
David Tolnay8c81f622018-07-31 23:34:35 -07001684#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001685pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001686 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001687 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001688 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001689 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001690 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001691 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001692 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001693 }
1694}
David Tolnay8c81f622018-07-31 23:34:35 -07001695#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001696pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001697 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001698 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1699 ForeignItem::Static(_binding_0) => {
1700 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001701 }
David Tolnay8c81f622018-07-31 23:34:35 -07001702 ForeignItem::Type(_binding_0) => {
1703 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001704 }
David Tolnay8c81f622018-07-31 23:34:35 -07001705 ForeignItem::Verbatim(_binding_0) => {
1706 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001707 }
Nika Layzell27726662017-10-24 23:16:35 -04001708 }
1709}
David Tolnay8c81f622018-07-31 23:34:35 -07001710#[cfg(feature = "full")]
1711pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1712 _visitor: &mut V,
1713 _i: ForeignItemFn,
1714) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001715 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001716 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1717 vis: _visitor.fold_visibility(_i.vis),
1718 ident: _visitor.fold_ident(_i.ident),
1719 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001720 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001721 }
1722}
David Tolnay8c81f622018-07-31 23:34:35 -07001723#[cfg(feature = "full")]
1724pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1725 _visitor: &mut V,
1726 _i: ForeignItemStatic,
1727) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001728 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001729 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1730 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001731 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1732 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001733 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001734 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001735 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001736 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001737 }
1738}
David Tolnay8c81f622018-07-31 23:34:35 -07001739#[cfg(feature = "full")]
1740pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1741 _visitor: &mut V,
1742 _i: ForeignItemType,
1743) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001744 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001745 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1746 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001747 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001748 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001749 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001750 }
1751}
David Tolnay8c81f622018-07-31 23:34:35 -07001752#[cfg(feature = "full")]
1753pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1754 _visitor: &mut V,
1755 _i: ForeignItemVerbatim,
1756) -> ForeignItemVerbatim {
1757 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001758}
David Tolnay8c81f622018-07-31 23:34:35 -07001759#[cfg(any(feature = "full", feature = "derive"))]
1760pub fn fold_generic_argument<V: Fold + ?Sized>(
1761 _visitor: &mut V,
1762 _i: GenericArgument,
1763) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001764 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001765 GenericArgument::Lifetime(_binding_0) => {
1766 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001767 }
David Tolnay8c81f622018-07-31 23:34:35 -07001768 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1769 GenericArgument::Binding(_binding_0) => {
1770 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001771 }
David Tolnay8c81f622018-07-31 23:34:35 -07001772 GenericArgument::Const(_binding_0) => {
1773 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001774 }
Nika Layzell357885a2017-12-04 15:47:07 -05001775 }
1776}
David Tolnay8c81f622018-07-31 23:34:35 -07001777#[cfg(any(feature = "full", feature = "derive"))]
1778#[cfg(feature = "full")]
1779pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1780 _visitor: &mut V,
1781 _i: GenericMethodArgument,
1782) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001783 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001784 GenericMethodArgument::Type(_binding_0) => {
1785 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001786 }
David Tolnay8c81f622018-07-31 23:34:35 -07001787 GenericMethodArgument::Const(_binding_0) => {
1788 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001789 }
1790 }
1791}
David Tolnay8c81f622018-07-31 23:34:35 -07001792#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001793pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001794 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001795 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1796 GenericParam::Lifetime(_binding_0) => {
1797 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001798 }
David Tolnay8c81f622018-07-31 23:34:35 -07001799 GenericParam::Const(_binding_0) => {
1800 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001801 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001802 }
1803}
David Tolnay8c81f622018-07-31 23:34:35 -07001804#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001805pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001806 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001807 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001808 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001809 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001810 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001811 }
1812}
Alex Crichtond261d092018-05-18 13:47:35 -07001813pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001814 let mut _i = _i;
1815 let span = _visitor.fold_span(_i.span());
1816 _i.set_span(span);
1817 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001818}
David Tolnay8c81f622018-07-31 23:34:35 -07001819#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001820pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001821 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001822 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1823 ImplItem::Method(_binding_0) => {
1824 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001825 }
David Tolnay8c81f622018-07-31 23:34:35 -07001826 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
1827 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1828 ImplItem::Verbatim(_binding_0) => {
1829 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001830 }
Nika Layzell27726662017-10-24 23:16:35 -04001831 }
1832}
David Tolnay8c81f622018-07-31 23:34:35 -07001833#[cfg(feature = "full")]
1834pub fn fold_impl_item_const<V: Fold + ?Sized>(
1835 _visitor: &mut V,
1836 _i: ImplItemConst,
1837) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001838 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001839 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1840 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001841 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1842 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001843 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001844 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001845 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001846 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001847 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001848 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001849 }
1850}
David Tolnay8c81f622018-07-31 23:34:35 -07001851#[cfg(feature = "full")]
1852pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1853 _visitor: &mut V,
1854 _i: ImplItemMacro,
1855) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001856 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001857 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1858 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001859 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001860 }
1861}
David Tolnay8c81f622018-07-31 23:34:35 -07001862#[cfg(feature = "full")]
1863pub fn fold_impl_item_method<V: Fold + ?Sized>(
1864 _visitor: &mut V,
1865 _i: ImplItemMethod,
1866) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001867 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001868 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1869 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001870 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001871 sig: _visitor.fold_method_sig(_i.sig),
1872 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001873 }
1874}
David Tolnay8c81f622018-07-31 23:34:35 -07001875#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001876pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001877 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001878 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1879 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001880 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1881 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001882 ident: _visitor.fold_ident(_i.ident),
1883 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001884 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001885 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001886 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001887 }
1888}
David Tolnay8c81f622018-07-31 23:34:35 -07001889#[cfg(feature = "full")]
1890pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1891 _visitor: &mut V,
1892 _i: ImplItemVerbatim,
1893) -> ImplItemVerbatim {
1894 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001895}
David Tolnay8c81f622018-07-31 23:34:35 -07001896#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001897pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001898 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001899 index: _i.index,
1900 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001901 }
1902}
David Tolnay8c81f622018-07-31 23:34:35 -07001903#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001904pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001905 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001906 Item::ExternCrate(_binding_0) => {
1907 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001908 }
David Tolnay8c81f622018-07-31 23:34:35 -07001909 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1910 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1911 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1912 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1913 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1914 Item::ForeignMod(_binding_0) => {
1915 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001916 }
David Tolnay8c81f622018-07-31 23:34:35 -07001917 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
1918 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1919 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1920 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1921 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
1922 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1923 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1924 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1925 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001926 }
1927}
David Tolnay8c81f622018-07-31 23:34:35 -07001928#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001929pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001930 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001931 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1932 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001933 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001934 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001935 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001936 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001937 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001938 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001939 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001940 }
1941}
David Tolnay8c81f622018-07-31 23:34:35 -07001942#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001943pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001944 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001945 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1946 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001947 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001948 ident: _visitor.fold_ident(_i.ident),
1949 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001950 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001951 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001952 }
1953}
David Tolnay8c81f622018-07-31 23:34:35 -07001954#[cfg(feature = "full")]
1955pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1956 _visitor: &mut V,
1957 _i: ItemExternCrate,
1958) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001959 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001960 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1961 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001962 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
1963 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001964 ident: _visitor.fold_ident(_i.ident),
1965 rename: (_i.rename).map(|it| {
1966 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001967 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001968 _visitor.fold_ident((it).1),
1969 )
1970 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04001971 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001972 }
1973}
David Tolnay8c81f622018-07-31 23:34:35 -07001974#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001975pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001976 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001977 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1978 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001979 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
1980 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001981 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
1982 ident: _visitor.fold_ident(_i.ident),
1983 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
1984 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001985 }
1986}
David Tolnay8c81f622018-07-31 23:34:35 -07001987#[cfg(feature = "full")]
1988pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
1989 _visitor: &mut V,
1990 _i: ItemForeignMod,
1991) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001992 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07001993 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1994 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04001995 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001996 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001997 }
1998}
David Tolnay8c81f622018-07-31 23:34:35 -07001999#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002000pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002001 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002002 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002003 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2004 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2005 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002006 generics: _visitor.fold_generics(_i.generics),
2007 trait_: (_i.trait_).map(|it| {
2008 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002009 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002010 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002011 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002012 )
2013 }),
2014 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002015 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002016 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002017 }
2018}
David Tolnay8c81f622018-07-31 23:34:35 -07002019#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002020pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002021 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002022 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2023 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2024 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002025 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002026 }
2027}
David Tolnay8c81f622018-07-31 23:34:35 -07002028#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002029pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002030 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002031 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2032 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002033 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002034 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002035 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002036 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002037 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002038 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002039 }
2040}
David Tolnay8c81f622018-07-31 23:34:35 -07002041#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002042pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002043 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002044 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2045 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002046 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002047 ident: _visitor.fold_ident(_i.ident),
2048 content: (_i.content).map(|it| {
2049 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002050 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002051 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2052 )
2053 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002054 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002055 }
2056}
David Tolnay8c81f622018-07-31 23:34:35 -07002057#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002058pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002059 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002060 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2061 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002062 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2063 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002064 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002065 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002066 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002067 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002068 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002069 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002070 }
2071}
David Tolnay8c81f622018-07-31 23:34:35 -07002072#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002073pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002074 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002075 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2076 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002077 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002078 ident: _visitor.fold_ident(_i.ident),
2079 generics: _visitor.fold_generics(_i.generics),
2080 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002081 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002082 }
2083}
David Tolnay8c81f622018-07-31 23:34:35 -07002084#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002085pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002086 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002087 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2088 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002089 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2090 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2091 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002092 ident: _visitor.fold_ident(_i.ident),
2093 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002094 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002095 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002096 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002097 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002098 }
2099}
David Tolnay8c81f622018-07-31 23:34:35 -07002100#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002101pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002102 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002103 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2104 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002105 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002106 ident: _visitor.fold_ident(_i.ident),
2107 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002108 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002109 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002110 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002111 }
2112}
David Tolnay8c81f622018-07-31 23:34:35 -07002113#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002114pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002115 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002116 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2117 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002118 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002119 ident: _visitor.fold_ident(_i.ident),
2120 generics: _visitor.fold_generics(_i.generics),
2121 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002122 }
2123}
David Tolnay8c81f622018-07-31 23:34:35 -07002124#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002125pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002126 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002127 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2128 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002129 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002130 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002131 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002132 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002133 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002134 }
2135}
David Tolnay8c81f622018-07-31 23:34:35 -07002136#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002137pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002138 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002139}
David Tolnay8c81f622018-07-31 23:34:35 -07002140#[cfg(any(feature = "full", feature = "derive"))]
2141#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002142pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002143 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002144 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002145 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002146 }
2147}
David Tolnay8c81f622018-07-31 23:34:35 -07002148#[cfg(any(feature = "full", feature = "derive"))]
Alex Crichton131308c2018-05-18 14:00:24 -07002149pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2150 Lifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002151 apostrophe: _i.apostrophe,
2152 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002153 }
2154}
David Tolnay8c81f622018-07-31 23:34:35 -07002155#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002156pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002157 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002158 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2159 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002160 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002161 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002162 }
2163}
David Tolnay8c81f622018-07-31 23:34:35 -07002164#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002165pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002166 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002167 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2168 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2169 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2170 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2171 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2172 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2173 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2174 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002175 }
2176}
David Tolnay8c81f622018-07-31 23:34:35 -07002177#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002178pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002179 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002180 value: _i.value,
2181 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002182 }
2183}
David Tolnay8c81f622018-07-31 23:34:35 -07002184#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002185pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002186 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002187}
David Tolnay8c81f622018-07-31 23:34:35 -07002188#[cfg(any(feature = "full", feature = "derive"))]
2189#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002190pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002191 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002192 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002193 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002194 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2195 ty: (_i.ty).map(|it| {
2196 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002197 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002198 Box::new(_visitor.fold_type(*(it).1)),
2199 )
2200 }),
2201 init: (_i.init).map(|it| {
2202 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002203 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002204 Box::new(_visitor.fold_expr(*(it).1)),
2205 )
2206 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002207 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002208 }
2209}
David Tolnay8c81f622018-07-31 23:34:35 -07002210#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002211pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002212 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002213 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002214 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002215 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2216 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002217 }
2218}
David Tolnay8c81f622018-07-31 23:34:35 -07002219#[cfg(any(feature = "full", feature = "derive"))]
2220pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2221 _visitor: &mut V,
2222 _i: MacroDelimiter,
2223) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002224 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002225 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002226 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002227 }
David Tolnay8c81f622018-07-31 23:34:35 -07002228 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002229 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002230 }
David Tolnay8c81f622018-07-31 23:34:35 -07002231 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002232 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002233 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002234 }
2235}
David Tolnay8c81f622018-07-31 23:34:35 -07002236#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002237pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002238 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002239 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2240 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002241 }
2242}
David Tolnay8c81f622018-07-31 23:34:35 -07002243#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002244pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002245 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002246 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2247 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2248 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002249 }
2250}
David Tolnay8c81f622018-07-31 23:34:35 -07002251#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002252pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2253 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002254 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002255 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002256 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002257 }
2258}
David Tolnay8c81f622018-07-31 23:34:35 -07002259#[cfg(any(feature = "full", feature = "derive"))]
2260pub fn fold_meta_name_value<V: Fold + ?Sized>(
2261 _visitor: &mut V,
2262 _i: MetaNameValue,
2263) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002264 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002265 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002266 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002267 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002268 }
2269}
David Tolnay8c81f622018-07-31 23:34:35 -07002270#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002271pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002272 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002273 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2274 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002275 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2276 ident: _visitor.fold_ident(_i.ident),
2277 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002278 }
2279}
David Tolnay8c81f622018-07-31 23:34:35 -07002280#[cfg(any(feature = "full", feature = "derive"))]
2281#[cfg(feature = "full")]
2282pub fn fold_method_turbofish<V: Fold + ?Sized>(
2283 _visitor: &mut V,
2284 _i: MethodTurbofish,
2285) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002286 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002287 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2288 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002289 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002290 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002291 }
2292}
David Tolnay8c81f622018-07-31 23:34:35 -07002293#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002294pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002295 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002296 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2297 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002298 }
2299}
David Tolnay8c81f622018-07-31 23:34:35 -07002300#[cfg(any(feature = "full", feature = "derive"))]
2301pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2302 _visitor: &mut V,
2303 _i: ParenthesizedGenericArguments,
2304) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002305 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002306 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002307 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2308 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002309 }
2310}
David Tolnay8c81f622018-07-31 23:34:35 -07002311#[cfg(any(feature = "full", feature = "derive"))]
2312#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002313pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002314 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002315 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2316 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2317 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2318 Pat::TupleStruct(_binding_0) => {
2319 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002320 }
David Tolnay8c81f622018-07-31 23:34:35 -07002321 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2322 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2323 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2324 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2325 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2326 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2327 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2328 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2329 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002330 }
2331}
David Tolnay8c81f622018-07-31 23:34:35 -07002332#[cfg(any(feature = "full", feature = "derive"))]
2333#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002334pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002335 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002336 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002337 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002338 }
2339}
David Tolnay8c81f622018-07-31 23:34:35 -07002340#[cfg(any(feature = "full", feature = "derive"))]
2341#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002342pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002343 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002344 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2345 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002346 ident: _visitor.fold_ident(_i.ident),
2347 subpat: (_i.subpat).map(|it| {
2348 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002349 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002350 Box::new(_visitor.fold_pat(*(it).1)),
2351 )
2352 }),
Nika Layzell27726662017-10-24 23:16:35 -04002353 }
2354}
David Tolnay8c81f622018-07-31 23:34:35 -07002355#[cfg(any(feature = "full", feature = "derive"))]
2356#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002357pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002358 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002359 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002360 }
2361}
David Tolnay8c81f622018-07-31 23:34:35 -07002362#[cfg(any(feature = "full", feature = "derive"))]
2363#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002364pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002365 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002366 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002367 }
2368}
David Tolnay8c81f622018-07-31 23:34:35 -07002369#[cfg(any(feature = "full", feature = "derive"))]
2370#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002371pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002372 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002373 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2374 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002375 }
2376}
David Tolnay8c81f622018-07-31 23:34:35 -07002377#[cfg(any(feature = "full", feature = "derive"))]
2378#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002379pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002380 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002381 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2382 limits: _visitor.fold_range_limits(_i.limits),
2383 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002384 }
2385}
David Tolnay8c81f622018-07-31 23:34:35 -07002386#[cfg(any(feature = "full", feature = "derive"))]
2387#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002388pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002389 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002390 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2391 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002392 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002393 }
2394}
David Tolnay8c81f622018-07-31 23:34:35 -07002395#[cfg(any(feature = "full", feature = "derive"))]
2396#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002397pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002398 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002399 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002400 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2401 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002402 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2403 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002404 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002405 }
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_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002410 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002411 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002412 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002413 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002414 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002415 }
2416}
David Tolnay8c81f622018-07-31 23:34:35 -07002417#[cfg(any(feature = "full", feature = "derive"))]
2418#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002419pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002420 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002421 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002422 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002423 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2424 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002425 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002426 }
2427}
David Tolnay8c81f622018-07-31 23:34:35 -07002428#[cfg(any(feature = "full", feature = "derive"))]
2429#[cfg(feature = "full")]
2430pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2431 _visitor: &mut V,
2432 _i: PatTupleStruct,
2433) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002434 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002435 path: _visitor.fold_path(_i.path),
2436 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002437 }
2438}
David Tolnay8c81f622018-07-31 23:34:35 -07002439#[cfg(any(feature = "full", feature = "derive"))]
2440#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002441pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002442 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002443}
David Tolnay8c81f622018-07-31 23:34:35 -07002444#[cfg(any(feature = "full", feature = "derive"))]
2445#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002446pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002447 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002448 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002449 }
2450}
David Tolnay8c81f622018-07-31 23:34:35 -07002451#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002452pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002453 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002454 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002455 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002456 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002457 }
2458}
David Tolnay8c81f622018-07-31 23:34:35 -07002459#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002460pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002461 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002462 PathArguments::None => PathArguments::None,
2463 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2464 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2465 ),
2466 PathArguments::Parenthesized(_binding_0) => {
2467 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002468 }
2469 }
2470}
David Tolnay8c81f622018-07-31 23:34:35 -07002471#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002472pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002473 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002474 ident: _visitor.fold_ident(_i.ident),
2475 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002476 }
2477}
David Tolnay8c81f622018-07-31 23:34:35 -07002478#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002479pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002480 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002481 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002482 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002483 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002484 }
2485}
David Tolnay8c81f622018-07-31 23:34:35 -07002486#[cfg(any(feature = "full", feature = "derive"))]
2487pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2488 _visitor: &mut V,
2489 _i: PredicateLifetime,
2490) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002491 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002492 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002493 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002494 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002495 }
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_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002499 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002500 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2501 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002502 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002503 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002504 }
2505}
David Tolnay8c81f622018-07-31 23:34:35 -07002506#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002507pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002508 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002509 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002510 ty: Box::new(_visitor.fold_type(*_i.ty)),
2511 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002512 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2513 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002514 }
2515}
David Tolnay8c81f622018-07-31 23:34:35 -07002516#[cfg(any(feature = "full", feature = "derive"))]
2517#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002518pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002519 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002520 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002521 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002522 }
David Tolnay8c81f622018-07-31 23:34:35 -07002523 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002524 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002525 }
2526 }
2527}
David Tolnay8c81f622018-07-31 23:34:35 -07002528#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002529pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002530 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002531 ReturnType::Default => ReturnType::Default,
2532 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002533 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002534 Box::new(_visitor.fold_type(*_binding_1)),
2535 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002536 }
2537}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002538pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002539 _i
2540}
David Tolnay8c81f622018-07-31 23:34:35 -07002541#[cfg(any(feature = "full", feature = "derive"))]
2542#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002543pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002544 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002545 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2546 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2547 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2548 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2549 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002550 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002551 ),
Nika Layzell27726662017-10-24 23:16:35 -04002552 }
2553}
David Tolnay8c81f622018-07-31 23:34:35 -07002554#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002555pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002556 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002557 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002558 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2559 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2560 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002561 }
2562}
David Tolnay8c81f622018-07-31 23:34:35 -07002563#[cfg(any(feature = "full", feature = "derive"))]
2564pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2565 _visitor: &mut V,
2566 _i: TraitBoundModifier,
2567) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002568 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002569 TraitBoundModifier::None => TraitBoundModifier::None,
2570 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002571 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002572 }
2573 }
2574}
David Tolnay8c81f622018-07-31 23:34:35 -07002575#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002576pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002577 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002578 TraitItem::Const(_binding_0) => {
2579 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002580 }
David Tolnay8c81f622018-07-31 23:34:35 -07002581 TraitItem::Method(_binding_0) => {
2582 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002583 }
David Tolnay8c81f622018-07-31 23:34:35 -07002584 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2585 TraitItem::Macro(_binding_0) => {
2586 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002587 }
David Tolnay8c81f622018-07-31 23:34:35 -07002588 TraitItem::Verbatim(_binding_0) => {
2589 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002590 }
Nika Layzell27726662017-10-24 23:16:35 -04002591 }
2592}
David Tolnay8c81f622018-07-31 23:34:35 -07002593#[cfg(feature = "full")]
2594pub fn fold_trait_item_const<V: Fold + ?Sized>(
2595 _visitor: &mut V,
2596 _i: TraitItemConst,
2597) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002598 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002599 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002600 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002601 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002602 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002603 ty: _visitor.fold_type(_i.ty),
2604 default: (_i.default).map(|it| {
2605 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002606 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002607 _visitor.fold_expr((it).1),
2608 )
2609 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002610 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002611 }
2612}
David Tolnay8c81f622018-07-31 23:34:35 -07002613#[cfg(feature = "full")]
2614pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2615 _visitor: &mut V,
2616 _i: TraitItemMacro,
2617) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002618 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002619 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2620 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002621 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002622 }
2623}
David Tolnay8c81f622018-07-31 23:34:35 -07002624#[cfg(feature = "full")]
2625pub fn fold_trait_item_method<V: Fold + ?Sized>(
2626 _visitor: &mut V,
2627 _i: TraitItemMethod,
2628) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002629 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002630 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2631 sig: _visitor.fold_method_sig(_i.sig),
2632 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002633 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002634 }
2635}
David Tolnay8c81f622018-07-31 23:34:35 -07002636#[cfg(feature = "full")]
2637pub fn fold_trait_item_type<V: Fold + ?Sized>(
2638 _visitor: &mut V,
2639 _i: TraitItemType,
2640) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002641 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002642 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002643 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002644 ident: _visitor.fold_ident(_i.ident),
2645 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002646 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002647 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2648 default: (_i.default).map(|it| {
2649 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002650 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002651 _visitor.fold_type((it).1),
2652 )
2653 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002654 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002655 }
2656}
David Tolnay8c81f622018-07-31 23:34:35 -07002657#[cfg(feature = "full")]
2658pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2659 _visitor: &mut V,
2660 _i: TraitItemVerbatim,
2661) -> TraitItemVerbatim {
2662 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002663}
David Tolnay8c81f622018-07-31 23:34:35 -07002664#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002665pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002666 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002667 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2668 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2669 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2670 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2671 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2672 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2673 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2674 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2675 Type::TraitObject(_binding_0) => {
2676 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002677 }
David Tolnay8c81f622018-07-31 23:34:35 -07002678 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2679 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2680 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2681 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2682 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2683 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002684 }
2685}
David Tolnay8c81f622018-07-31 23:34:35 -07002686#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002687pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002688 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002689 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002690 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002691 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002692 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002693 }
2694}
David Tolnay8c81f622018-07-31 23:34:35 -07002695#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002696pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002697 TypeBareFn {
David Tolnay7ac699c2018-08-24 14:00:58 -04002698 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002699 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002700 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002701 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002702 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002703 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002704 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002705 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002706 }
2707}
David Tolnay8c81f622018-07-31 23:34:35 -07002708#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002709pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002710 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002711 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002712 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002713 }
2714}
David Tolnay8c81f622018-07-31 23:34:35 -07002715#[cfg(any(feature = "full", feature = "derive"))]
2716pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2717 _visitor: &mut V,
2718 _i: TypeImplTrait,
2719) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002720 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002721 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002722 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002723 }
2724}
David Tolnay8c81f622018-07-31 23:34:35 -07002725#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002726pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002727 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002728 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002729 }
2730}
David Tolnay8c81f622018-07-31 23:34:35 -07002731#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002732pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002733 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002734 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002735 }
2736}
David Tolnay8c81f622018-07-31 23:34:35 -07002737#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002738pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002739 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002740 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002741 }
2742}
David Tolnay8c81f622018-07-31 23:34:35 -07002743#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002744pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002745 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002746 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2747 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002748 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002749 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002750 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002751 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002752 }
2753}
David Tolnay8c81f622018-07-31 23:34:35 -07002754#[cfg(any(feature = "full", feature = "derive"))]
2755pub fn fold_type_param_bound<V: Fold + ?Sized>(
2756 _visitor: &mut V,
2757 _i: TypeParamBound,
2758) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002759 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002760 TypeParamBound::Trait(_binding_0) => {
2761 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002762 }
David Tolnay8c81f622018-07-31 23:34:35 -07002763 TypeParamBound::Lifetime(_binding_0) => {
2764 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002765 }
2766 }
2767}
David Tolnay8c81f622018-07-31 23:34:35 -07002768#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002769pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002770 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002771 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002772 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002773 }
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_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002777 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002778 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2779 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002780 }
2781}
David Tolnay8c81f622018-07-31 23:34:35 -07002782#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002783pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002784 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002785 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2786 const_token: (_i.const_token)
2787 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2788 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002789 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002790 }
2791}
David Tolnay8c81f622018-07-31 23:34:35 -07002792#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002793pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002794 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002795 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002796 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002797 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002798 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002799 }
2800}
David Tolnay8c81f622018-07-31 23:34:35 -07002801#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002802pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002803 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002804 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002805 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002806 }
2807}
David Tolnay8c81f622018-07-31 23:34:35 -07002808#[cfg(any(feature = "full", feature = "derive"))]
2809pub fn fold_type_trait_object<V: Fold + ?Sized>(
2810 _visitor: &mut V,
2811 _i: TypeTraitObject,
2812) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002813 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002814 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002815 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002816 }
2817}
David Tolnay8c81f622018-07-31 23:34:35 -07002818#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002819pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002820 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002821 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002822 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002823 }
2824}
David Tolnay8c81f622018-07-31 23:34:35 -07002825#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002826pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002827 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002828}
David Tolnay8c81f622018-07-31 23:34:35 -07002829#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002830pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002831 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002832 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002833 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002834 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002835 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2836 UnOp::Neg(_binding_0) => {
2837 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2838 }
Nika Layzell27726662017-10-24 23:16:35 -04002839 }
2840}
David Tolnay8c81f622018-07-31 23:34:35 -07002841#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002842pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002843 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002844 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002845 }
2846}
David Tolnay8c81f622018-07-31 23:34:35 -07002847#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002848pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2849 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002850 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002851 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002852 }
2853}
David Tolnay8c81f622018-07-31 23:34:35 -07002854#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002855pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2856 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002857 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002858 }
2859}
David Tolnay8c81f622018-07-31 23:34:35 -07002860#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002861pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002862 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002863 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002864 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002865 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002866 }
2867}
David Tolnay8c81f622018-07-31 23:34:35 -07002868#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002869pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2870 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002871 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002872 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002873 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002874 }
2875}
David Tolnay8c81f622018-07-31 23:34:35 -07002876#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002877pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002878 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002879 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2880 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2881 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2882 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2883 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002884 }
2885}
David Tolnay8c81f622018-07-31 23:34:35 -07002886#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002887pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002888 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002889 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2890 ident: _visitor.fold_ident(_i.ident),
2891 fields: _visitor.fold_fields(_i.fields),
2892 discriminant: (_i.discriminant).map(|it| {
2893 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002894 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002895 _visitor.fold_expr((it).1),
2896 )
2897 }),
Nika Layzell27726662017-10-24 23:16:35 -04002898 }
2899}
David Tolnay8c81f622018-07-31 23:34:35 -07002900#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002901pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002902 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002903 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002904 }
2905}
David Tolnay8c81f622018-07-31 23:34:35 -07002906#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002907pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002908 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04002909 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002910 }
2911}
David Tolnay8c81f622018-07-31 23:34:35 -07002912#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002913pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002914 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04002915 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
2916 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
2917 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002918 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002919 }
2920}
David Tolnay8c81f622018-07-31 23:34:35 -07002921#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002922pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002923 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002924 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2925 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2926 Visibility::Restricted(_binding_0) => {
2927 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002928 }
David Tolnay8c81f622018-07-31 23:34:35 -07002929 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04002930 }
2931}
David Tolnay8c81f622018-07-31 23:34:35 -07002932#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002933pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002934 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04002935 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002936 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002937 }
2938}
David Tolnay8c81f622018-07-31 23:34:35 -07002939#[cfg(any(feature = "full", feature = "derive"))]
2940pub fn fold_where_predicate<V: Fold + ?Sized>(
2941 _visitor: &mut V,
2942 _i: WherePredicate,
2943) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002944 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002945 WherePredicate::Type(_binding_0) => {
2946 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002947 }
David Tolnay8c81f622018-07-31 23:34:35 -07002948 WherePredicate::Lifetime(_binding_0) => {
2949 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002950 }
David Tolnay8c81f622018-07-31 23:34:35 -07002951 WherePredicate::Eq(_binding_0) => {
2952 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002953 }
2954 }
2955}