blob: 5a5e5bf43e09962ca8e0e94ad96ef36f34aeb973 [file] [log] [blame]
Nika Layzell27726662017-10-24 23:16:35 -04001// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
2
Nika Layzell27726662017-10-24 23:16:35 -04003#![allow(unreachable_code)]
David Tolnayf0d63bf2017-12-26 12:29:47 -05004#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
David Tolnay0a0d78c2018-01-05 15:24:01 -08005#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05006use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07007use proc_macro2::Span;
8#[cfg(any(feature = "full", feature = "derive"))]
9use token::{Brace, Bracket, Group, Paren};
10use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040011#[cfg(feature = "full")]
12macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070013 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070014 $e
15 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040016}
David Tolnay0a0d78c2018-01-05 15:24:01 -080017#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040018macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070019 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070020 unreachable!()
21 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040022}
David Tolnay6af48992018-08-01 11:16:28 -070023#[doc = r" Syntax tree traversal to transform the nodes of an owned syntax tree."]
24#[doc = r""]
25#[doc = r" See the [module documentation] for details."]
26#[doc = r""]
27#[doc = r" [module documentation]: index.html"]
28#[doc = r""]
29#[doc = r#" *This trait is available if Syn is built with the `"fold"` feature.*"#]
David Tolnay4b4c4b62018-01-06 13:48:05 -080030pub trait Fold {
David Tolnay8c81f622018-07-31 23:34:35 -070031 #[cfg(any(feature = "full", feature = "derive"))]
32 fn fold_abi(&mut self, i: Abi) -> Abi {
33 fold_abi(self, i)
34 }
35 #[cfg(any(feature = "full", feature = "derive"))]
36 fn fold_angle_bracketed_generic_arguments(
37 &mut self,
38 i: AngleBracketedGenericArguments,
39 ) -> AngleBracketedGenericArguments {
40 fold_angle_bracketed_generic_arguments(self, i)
41 }
42 #[cfg(feature = "full")]
43 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
44 fold_arg_captured(self, i)
45 }
46 #[cfg(feature = "full")]
47 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
48 fold_arg_self(self, i)
49 }
50 #[cfg(feature = "full")]
51 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
52 fold_arg_self_ref(self, i)
53 }
54 #[cfg(any(feature = "full", feature = "derive"))]
55 #[cfg(feature = "full")]
56 fn fold_arm(&mut self, i: Arm) -> Arm {
57 fold_arm(self, i)
58 }
59 #[cfg(any(feature = "full", feature = "derive"))]
60 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
61 fold_attr_style(self, i)
62 }
63 #[cfg(any(feature = "full", feature = "derive"))]
64 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
65 fold_attribute(self, i)
66 }
67 #[cfg(any(feature = "full", feature = "derive"))]
68 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
69 fold_bare_fn_arg(self, i)
70 }
71 #[cfg(any(feature = "full", feature = "derive"))]
72 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
73 fold_bare_fn_arg_name(self, i)
74 }
75 #[cfg(any(feature = "full", feature = "derive"))]
76 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
77 fold_bin_op(self, i)
78 }
79 #[cfg(any(feature = "full", feature = "derive"))]
80 fn fold_binding(&mut self, i: Binding) -> Binding {
81 fold_binding(self, i)
82 }
83 #[cfg(any(feature = "full", feature = "derive"))]
84 #[cfg(feature = "full")]
85 fn fold_block(&mut self, i: Block) -> Block {
86 fold_block(self, i)
87 }
88 #[cfg(any(feature = "full", feature = "derive"))]
89 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
90 fold_bound_lifetimes(self, i)
91 }
92 #[cfg(any(feature = "full", feature = "derive"))]
93 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
94 fold_const_param(self, i)
95 }
96 #[cfg(feature = "derive")]
97 fn fold_data(&mut self, i: Data) -> Data {
98 fold_data(self, i)
99 }
100 #[cfg(feature = "derive")]
101 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
102 fold_data_enum(self, i)
103 }
104 #[cfg(feature = "derive")]
105 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
106 fold_data_struct(self, i)
107 }
108 #[cfg(feature = "derive")]
109 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
110 fold_data_union(self, i)
111 }
112 #[cfg(feature = "derive")]
113 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
114 fold_derive_input(self, i)
115 }
116 #[cfg(any(feature = "full", feature = "derive"))]
117 fn fold_expr(&mut self, i: Expr) -> Expr {
118 fold_expr(self, i)
119 }
120 #[cfg(feature = "full")]
121 #[cfg(any(feature = "full", feature = "derive"))]
122 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
123 fold_expr_array(self, i)
124 }
125 #[cfg(feature = "full")]
126 #[cfg(any(feature = "full", feature = "derive"))]
127 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
128 fold_expr_assign(self, i)
129 }
130 #[cfg(feature = "full")]
131 #[cfg(any(feature = "full", feature = "derive"))]
132 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
133 fold_expr_assign_op(self, i)
134 }
David Tolnay02a9c6f2018-08-24 18:58:45 -0400135 #[cfg(feature = "full")]
136 #[cfg(any(feature = "full", feature = "derive"))]
137 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
138 fold_expr_async(self, i)
139 }
David Tolnay8c81f622018-07-31 23:34:35 -0700140 #[cfg(any(feature = "full", feature = "derive"))]
141 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
142 fold_expr_binary(self, i)
143 }
144 #[cfg(feature = "full")]
145 #[cfg(any(feature = "full", feature = "derive"))]
146 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
147 fold_expr_block(self, i)
148 }
149 #[cfg(feature = "full")]
150 #[cfg(any(feature = "full", feature = "derive"))]
151 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
152 fold_expr_box(self, i)
153 }
154 #[cfg(feature = "full")]
155 #[cfg(any(feature = "full", feature = "derive"))]
156 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
157 fold_expr_break(self, i)
158 }
159 #[cfg(any(feature = "full", feature = "derive"))]
160 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
161 fold_expr_call(self, i)
162 }
163 #[cfg(any(feature = "full", feature = "derive"))]
164 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
165 fold_expr_cast(self, i)
166 }
167 #[cfg(feature = "full")]
168 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700169 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
170 fold_expr_closure(self, i)
171 }
172 #[cfg(feature = "full")]
173 #[cfg(any(feature = "full", feature = "derive"))]
174 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
175 fold_expr_continue(self, i)
176 }
177 #[cfg(any(feature = "full", feature = "derive"))]
178 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
179 fold_expr_field(self, i)
180 }
181 #[cfg(feature = "full")]
182 #[cfg(any(feature = "full", feature = "derive"))]
183 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
184 fold_expr_for_loop(self, i)
185 }
186 #[cfg(feature = "full")]
187 #[cfg(any(feature = "full", feature = "derive"))]
188 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
189 fold_expr_group(self, i)
190 }
191 #[cfg(feature = "full")]
192 #[cfg(any(feature = "full", feature = "derive"))]
193 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
194 fold_expr_if(self, i)
195 }
196 #[cfg(feature = "full")]
197 #[cfg(any(feature = "full", feature = "derive"))]
198 fn fold_expr_if_let(&mut self, i: ExprIfLet) -> ExprIfLet {
199 fold_expr_if_let(self, i)
200 }
201 #[cfg(feature = "full")]
202 #[cfg(any(feature = "full", feature = "derive"))]
203 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
204 fold_expr_in_place(self, i)
205 }
206 #[cfg(any(feature = "full", feature = "derive"))]
207 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
208 fold_expr_index(self, i)
209 }
210 #[cfg(any(feature = "full", feature = "derive"))]
211 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
212 fold_expr_lit(self, i)
213 }
214 #[cfg(feature = "full")]
215 #[cfg(any(feature = "full", feature = "derive"))]
216 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
217 fold_expr_loop(self, i)
218 }
219 #[cfg(feature = "full")]
220 #[cfg(any(feature = "full", feature = "derive"))]
221 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
222 fold_expr_macro(self, i)
223 }
224 #[cfg(feature = "full")]
225 #[cfg(any(feature = "full", feature = "derive"))]
226 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
227 fold_expr_match(self, i)
228 }
229 #[cfg(feature = "full")]
230 #[cfg(any(feature = "full", feature = "derive"))]
231 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
232 fold_expr_method_call(self, i)
233 }
234 #[cfg(any(feature = "full", feature = "derive"))]
235 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
236 fold_expr_paren(self, i)
237 }
238 #[cfg(any(feature = "full", feature = "derive"))]
239 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
240 fold_expr_path(self, i)
241 }
242 #[cfg(feature = "full")]
243 #[cfg(any(feature = "full", feature = "derive"))]
244 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
245 fold_expr_range(self, i)
246 }
247 #[cfg(feature = "full")]
248 #[cfg(any(feature = "full", feature = "derive"))]
249 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
250 fold_expr_reference(self, i)
251 }
252 #[cfg(feature = "full")]
253 #[cfg(any(feature = "full", feature = "derive"))]
254 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
255 fold_expr_repeat(self, i)
256 }
257 #[cfg(feature = "full")]
258 #[cfg(any(feature = "full", feature = "derive"))]
259 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
260 fold_expr_return(self, i)
261 }
262 #[cfg(feature = "full")]
263 #[cfg(any(feature = "full", feature = "derive"))]
264 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
265 fold_expr_struct(self, i)
266 }
267 #[cfg(feature = "full")]
268 #[cfg(any(feature = "full", feature = "derive"))]
269 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
270 fold_expr_try(self, i)
271 }
272 #[cfg(feature = "full")]
273 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -0400274 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
275 fold_expr_try_block(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700279 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
280 fold_expr_tuple(self, i)
281 }
282 #[cfg(feature = "full")]
283 #[cfg(any(feature = "full", feature = "derive"))]
284 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
285 fold_expr_type(self, i)
286 }
287 #[cfg(any(feature = "full", feature = "derive"))]
288 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
289 fold_expr_unary(self, i)
290 }
291 #[cfg(feature = "full")]
292 #[cfg(any(feature = "full", feature = "derive"))]
293 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
294 fold_expr_unsafe(self, i)
295 }
296 #[cfg(any(feature = "full", feature = "derive"))]
297 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
298 fold_expr_verbatim(self, i)
299 }
300 #[cfg(feature = "full")]
301 #[cfg(any(feature = "full", feature = "derive"))]
302 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
303 fold_expr_while(self, i)
304 }
305 #[cfg(feature = "full")]
306 #[cfg(any(feature = "full", feature = "derive"))]
307 fn fold_expr_while_let(&mut self, i: ExprWhileLet) -> ExprWhileLet {
308 fold_expr_while_let(self, i)
309 }
310 #[cfg(feature = "full")]
311 #[cfg(any(feature = "full", feature = "derive"))]
312 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
313 fold_expr_yield(self, i)
314 }
315 #[cfg(any(feature = "full", feature = "derive"))]
316 fn fold_field(&mut self, i: Field) -> Field {
317 fold_field(self, i)
318 }
319 #[cfg(any(feature = "full", feature = "derive"))]
320 #[cfg(feature = "full")]
321 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
322 fold_field_pat(self, i)
323 }
324 #[cfg(any(feature = "full", feature = "derive"))]
325 #[cfg(feature = "full")]
326 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
327 fold_field_value(self, i)
328 }
329 #[cfg(any(feature = "full", feature = "derive"))]
330 fn fold_fields(&mut self, i: Fields) -> Fields {
331 fold_fields(self, i)
332 }
333 #[cfg(any(feature = "full", feature = "derive"))]
334 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
335 fold_fields_named(self, i)
336 }
337 #[cfg(any(feature = "full", feature = "derive"))]
338 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
339 fold_fields_unnamed(self, i)
340 }
341 #[cfg(feature = "full")]
342 fn fold_file(&mut self, i: File) -> File {
343 fold_file(self, i)
344 }
345 #[cfg(feature = "full")]
346 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
347 fold_fn_arg(self, i)
348 }
349 #[cfg(feature = "full")]
350 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
351 fold_fn_decl(self, i)
352 }
353 #[cfg(feature = "full")]
354 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
355 fold_foreign_item(self, i)
356 }
357 #[cfg(feature = "full")]
358 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
359 fold_foreign_item_fn(self, i)
360 }
361 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400362 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
363 fold_foreign_item_macro(self, i)
364 }
365 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700366 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
367 fold_foreign_item_static(self, i)
368 }
369 #[cfg(feature = "full")]
370 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
371 fold_foreign_item_type(self, i)
372 }
373 #[cfg(feature = "full")]
374 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
375 fold_foreign_item_verbatim(self, i)
376 }
377 #[cfg(any(feature = "full", feature = "derive"))]
378 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
379 fold_generic_argument(self, i)
380 }
381 #[cfg(any(feature = "full", feature = "derive"))]
382 #[cfg(feature = "full")]
383 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
384 fold_generic_method_argument(self, i)
385 }
386 #[cfg(any(feature = "full", feature = "derive"))]
387 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
388 fold_generic_param(self, i)
389 }
390 #[cfg(any(feature = "full", feature = "derive"))]
391 fn fold_generics(&mut self, i: Generics) -> Generics {
392 fold_generics(self, i)
393 }
David Tolnay8c81f622018-07-31 23:34:35 -0700394 fn fold_ident(&mut self, i: Ident) -> Ident {
395 fold_ident(self, i)
396 }
397 #[cfg(feature = "full")]
398 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
399 fold_impl_item(self, i)
400 }
401 #[cfg(feature = "full")]
402 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
403 fold_impl_item_const(self, i)
404 }
405 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400406 fn fold_impl_item_existential(&mut self, i: ImplItemExistential) -> ImplItemExistential {
407 fold_impl_item_existential(self, i)
408 }
409 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700410 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
411 fold_impl_item_macro(self, i)
412 }
413 #[cfg(feature = "full")]
414 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
415 fold_impl_item_method(self, i)
416 }
417 #[cfg(feature = "full")]
418 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
419 fold_impl_item_type(self, i)
420 }
421 #[cfg(feature = "full")]
422 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
423 fold_impl_item_verbatim(self, i)
424 }
425 #[cfg(any(feature = "full", feature = "derive"))]
426 fn fold_index(&mut self, i: Index) -> Index {
427 fold_index(self, i)
428 }
429 #[cfg(feature = "full")]
430 fn fold_item(&mut self, i: Item) -> Item {
431 fold_item(self, i)
432 }
433 #[cfg(feature = "full")]
434 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
435 fold_item_const(self, i)
436 }
437 #[cfg(feature = "full")]
438 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
439 fold_item_enum(self, i)
440 }
441 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400442 fn fold_item_existential(&mut self, i: ItemExistential) -> ItemExistential {
443 fold_item_existential(self, i)
444 }
445 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700446 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
447 fold_item_extern_crate(self, i)
448 }
449 #[cfg(feature = "full")]
450 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
451 fold_item_fn(self, i)
452 }
453 #[cfg(feature = "full")]
454 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
455 fold_item_foreign_mod(self, i)
456 }
457 #[cfg(feature = "full")]
458 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
459 fold_item_impl(self, i)
460 }
461 #[cfg(feature = "full")]
462 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
463 fold_item_macro(self, i)
464 }
465 #[cfg(feature = "full")]
466 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
467 fold_item_macro2(self, i)
468 }
469 #[cfg(feature = "full")]
470 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
471 fold_item_mod(self, i)
472 }
473 #[cfg(feature = "full")]
474 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
475 fold_item_static(self, i)
476 }
477 #[cfg(feature = "full")]
478 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
479 fold_item_struct(self, i)
480 }
481 #[cfg(feature = "full")]
482 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
483 fold_item_trait(self, i)
484 }
485 #[cfg(feature = "full")]
486 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
487 fold_item_type(self, i)
488 }
489 #[cfg(feature = "full")]
490 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
491 fold_item_union(self, i)
492 }
493 #[cfg(feature = "full")]
494 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
495 fold_item_use(self, i)
496 }
497 #[cfg(feature = "full")]
498 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
499 fold_item_verbatim(self, i)
500 }
501 #[cfg(any(feature = "full", feature = "derive"))]
502 #[cfg(feature = "full")]
503 fn fold_label(&mut self, i: Label) -> Label {
504 fold_label(self, i)
505 }
506 #[cfg(any(feature = "full", feature = "derive"))]
507 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
508 fold_lifetime(self, i)
509 }
510 #[cfg(any(feature = "full", feature = "derive"))]
511 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
512 fold_lifetime_def(self, i)
513 }
514 #[cfg(any(feature = "full", feature = "derive"))]
515 fn fold_lit(&mut self, i: Lit) -> Lit {
516 fold_lit(self, i)
517 }
518 #[cfg(any(feature = "full", feature = "derive"))]
519 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
520 fold_lit_bool(self, i)
521 }
522 #[cfg(any(feature = "full", feature = "derive"))]
523 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
524 fold_lit_byte(self, i)
525 }
526 #[cfg(any(feature = "full", feature = "derive"))]
527 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
528 fold_lit_byte_str(self, i)
529 }
530 #[cfg(any(feature = "full", feature = "derive"))]
531 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
532 fold_lit_char(self, i)
533 }
534 #[cfg(any(feature = "full", feature = "derive"))]
535 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
536 fold_lit_float(self, i)
537 }
538 #[cfg(any(feature = "full", feature = "derive"))]
539 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
540 fold_lit_int(self, i)
541 }
542 #[cfg(any(feature = "full", feature = "derive"))]
543 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
544 fold_lit_str(self, i)
545 }
546 #[cfg(any(feature = "full", feature = "derive"))]
547 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
548 fold_lit_verbatim(self, i)
549 }
550 #[cfg(any(feature = "full", feature = "derive"))]
551 #[cfg(feature = "full")]
552 fn fold_local(&mut self, i: Local) -> Local {
553 fold_local(self, i)
554 }
555 #[cfg(any(feature = "full", feature = "derive"))]
556 fn fold_macro(&mut self, i: Macro) -> Macro {
557 fold_macro(self, i)
558 }
559 #[cfg(any(feature = "full", feature = "derive"))]
560 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
561 fold_macro_delimiter(self, i)
562 }
563 #[cfg(any(feature = "full", feature = "derive"))]
564 fn fold_member(&mut self, i: Member) -> Member {
565 fold_member(self, i)
566 }
567 #[cfg(any(feature = "full", feature = "derive"))]
568 fn fold_meta(&mut self, i: Meta) -> Meta {
569 fold_meta(self, i)
570 }
571 #[cfg(any(feature = "full", feature = "derive"))]
572 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
573 fold_meta_list(self, i)
574 }
575 #[cfg(any(feature = "full", feature = "derive"))]
576 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
577 fold_meta_name_value(self, i)
578 }
579 #[cfg(feature = "full")]
580 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
581 fold_method_sig(self, i)
582 }
583 #[cfg(any(feature = "full", feature = "derive"))]
584 #[cfg(feature = "full")]
585 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
586 fold_method_turbofish(self, i)
587 }
588 #[cfg(any(feature = "full", feature = "derive"))]
589 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
590 fold_nested_meta(self, i)
591 }
592 #[cfg(any(feature = "full", feature = "derive"))]
593 fn fold_parenthesized_generic_arguments(
594 &mut self,
595 i: ParenthesizedGenericArguments,
596 ) -> ParenthesizedGenericArguments {
597 fold_parenthesized_generic_arguments(self, i)
598 }
599 #[cfg(any(feature = "full", feature = "derive"))]
600 #[cfg(feature = "full")]
601 fn fold_pat(&mut self, i: Pat) -> Pat {
602 fold_pat(self, i)
603 }
604 #[cfg(any(feature = "full", feature = "derive"))]
605 #[cfg(feature = "full")]
606 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
607 fold_pat_box(self, i)
608 }
609 #[cfg(any(feature = "full", feature = "derive"))]
610 #[cfg(feature = "full")]
611 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
612 fold_pat_ident(self, i)
613 }
614 #[cfg(any(feature = "full", feature = "derive"))]
615 #[cfg(feature = "full")]
616 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
617 fold_pat_lit(self, i)
618 }
619 #[cfg(any(feature = "full", feature = "derive"))]
620 #[cfg(feature = "full")]
621 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
622 fold_pat_macro(self, i)
623 }
624 #[cfg(any(feature = "full", feature = "derive"))]
625 #[cfg(feature = "full")]
626 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
627 fold_pat_path(self, i)
628 }
629 #[cfg(any(feature = "full", feature = "derive"))]
630 #[cfg(feature = "full")]
631 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
632 fold_pat_range(self, i)
633 }
634 #[cfg(any(feature = "full", feature = "derive"))]
635 #[cfg(feature = "full")]
636 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
637 fold_pat_ref(self, i)
638 }
639 #[cfg(any(feature = "full", feature = "derive"))]
640 #[cfg(feature = "full")]
641 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
642 fold_pat_slice(self, i)
643 }
644 #[cfg(any(feature = "full", feature = "derive"))]
645 #[cfg(feature = "full")]
646 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
647 fold_pat_struct(self, i)
648 }
649 #[cfg(any(feature = "full", feature = "derive"))]
650 #[cfg(feature = "full")]
651 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
652 fold_pat_tuple(self, i)
653 }
654 #[cfg(any(feature = "full", feature = "derive"))]
655 #[cfg(feature = "full")]
656 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
657 fold_pat_tuple_struct(self, i)
658 }
659 #[cfg(any(feature = "full", feature = "derive"))]
660 #[cfg(feature = "full")]
661 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
662 fold_pat_verbatim(self, i)
663 }
664 #[cfg(any(feature = "full", feature = "derive"))]
665 #[cfg(feature = "full")]
666 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
667 fold_pat_wild(self, i)
668 }
669 #[cfg(any(feature = "full", feature = "derive"))]
670 fn fold_path(&mut self, i: Path) -> Path {
671 fold_path(self, i)
672 }
673 #[cfg(any(feature = "full", feature = "derive"))]
674 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
675 fold_path_arguments(self, i)
676 }
677 #[cfg(any(feature = "full", feature = "derive"))]
678 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
679 fold_path_segment(self, i)
680 }
681 #[cfg(any(feature = "full", feature = "derive"))]
682 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
683 fold_predicate_eq(self, i)
684 }
685 #[cfg(any(feature = "full", feature = "derive"))]
686 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
687 fold_predicate_lifetime(self, i)
688 }
689 #[cfg(any(feature = "full", feature = "derive"))]
690 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
691 fold_predicate_type(self, i)
692 }
693 #[cfg(any(feature = "full", feature = "derive"))]
694 fn fold_qself(&mut self, i: QSelf) -> QSelf {
695 fold_qself(self, i)
696 }
697 #[cfg(any(feature = "full", feature = "derive"))]
698 #[cfg(feature = "full")]
699 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
700 fold_range_limits(self, i)
701 }
702 #[cfg(any(feature = "full", feature = "derive"))]
703 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
704 fold_return_type(self, i)
705 }
David Tolnay8c81f622018-07-31 23:34:35 -0700706 fn fold_span(&mut self, i: Span) -> Span {
707 fold_span(self, i)
708 }
709 #[cfg(any(feature = "full", feature = "derive"))]
710 #[cfg(feature = "full")]
711 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
712 fold_stmt(self, i)
713 }
714 #[cfg(any(feature = "full", feature = "derive"))]
715 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
716 fold_trait_bound(self, i)
717 }
718 #[cfg(any(feature = "full", feature = "derive"))]
719 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
720 fold_trait_bound_modifier(self, i)
721 }
722 #[cfg(feature = "full")]
723 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
724 fold_trait_item(self, i)
725 }
726 #[cfg(feature = "full")]
727 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
728 fold_trait_item_const(self, i)
729 }
730 #[cfg(feature = "full")]
731 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
732 fold_trait_item_macro(self, i)
733 }
734 #[cfg(feature = "full")]
735 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
736 fold_trait_item_method(self, i)
737 }
738 #[cfg(feature = "full")]
739 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
740 fold_trait_item_type(self, i)
741 }
742 #[cfg(feature = "full")]
743 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
744 fold_trait_item_verbatim(self, i)
745 }
746 #[cfg(any(feature = "full", feature = "derive"))]
747 fn fold_type(&mut self, i: Type) -> Type {
748 fold_type(self, i)
749 }
750 #[cfg(any(feature = "full", feature = "derive"))]
751 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
752 fold_type_array(self, i)
753 }
754 #[cfg(any(feature = "full", feature = "derive"))]
755 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
756 fold_type_bare_fn(self, i)
757 }
758 #[cfg(any(feature = "full", feature = "derive"))]
759 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
760 fold_type_group(self, i)
761 }
762 #[cfg(any(feature = "full", feature = "derive"))]
763 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
764 fold_type_impl_trait(self, i)
765 }
766 #[cfg(any(feature = "full", feature = "derive"))]
767 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
768 fold_type_infer(self, i)
769 }
770 #[cfg(any(feature = "full", feature = "derive"))]
771 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
772 fold_type_macro(self, i)
773 }
774 #[cfg(any(feature = "full", feature = "derive"))]
775 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
776 fold_type_never(self, i)
777 }
778 #[cfg(any(feature = "full", feature = "derive"))]
779 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
780 fold_type_param(self, i)
781 }
782 #[cfg(any(feature = "full", feature = "derive"))]
783 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
784 fold_type_param_bound(self, i)
785 }
786 #[cfg(any(feature = "full", feature = "derive"))]
787 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
788 fold_type_paren(self, i)
789 }
790 #[cfg(any(feature = "full", feature = "derive"))]
791 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
792 fold_type_path(self, i)
793 }
794 #[cfg(any(feature = "full", feature = "derive"))]
795 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
796 fold_type_ptr(self, i)
797 }
798 #[cfg(any(feature = "full", feature = "derive"))]
799 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
800 fold_type_reference(self, i)
801 }
802 #[cfg(any(feature = "full", feature = "derive"))]
803 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
804 fold_type_slice(self, i)
805 }
806 #[cfg(any(feature = "full", feature = "derive"))]
807 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
808 fold_type_trait_object(self, i)
809 }
810 #[cfg(any(feature = "full", feature = "derive"))]
811 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
812 fold_type_tuple(self, i)
813 }
814 #[cfg(any(feature = "full", feature = "derive"))]
815 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
816 fold_type_verbatim(self, i)
817 }
818 #[cfg(any(feature = "full", feature = "derive"))]
819 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
820 fold_un_op(self, i)
821 }
822 #[cfg(feature = "full")]
823 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
824 fold_use_glob(self, i)
825 }
826 #[cfg(feature = "full")]
827 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
828 fold_use_group(self, i)
829 }
830 #[cfg(feature = "full")]
831 fn fold_use_name(&mut self, i: UseName) -> UseName {
832 fold_use_name(self, i)
833 }
834 #[cfg(feature = "full")]
835 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
836 fold_use_path(self, i)
837 }
838 #[cfg(feature = "full")]
839 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
840 fold_use_rename(self, i)
841 }
842 #[cfg(feature = "full")]
843 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
844 fold_use_tree(self, i)
845 }
846 #[cfg(any(feature = "full", feature = "derive"))]
847 fn fold_variant(&mut self, i: Variant) -> Variant {
848 fold_variant(self, i)
849 }
850 #[cfg(any(feature = "full", feature = "derive"))]
851 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
852 fold_vis_crate(self, i)
853 }
854 #[cfg(any(feature = "full", feature = "derive"))]
855 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
856 fold_vis_public(self, i)
857 }
858 #[cfg(any(feature = "full", feature = "derive"))]
859 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
860 fold_vis_restricted(self, i)
861 }
862 #[cfg(any(feature = "full", feature = "derive"))]
863 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
864 fold_visibility(self, i)
865 }
866 #[cfg(any(feature = "full", feature = "derive"))]
867 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
868 fold_where_clause(self, i)
869 }
870 #[cfg(any(feature = "full", feature = "derive"))]
871 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
872 fold_where_predicate(self, i)
873 }
Nika Layzell27726662017-10-24 23:16:35 -0400874}
David Tolnayd3f32142018-05-20 20:21:12 -0700875#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800876macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700877 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800878 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700879 let span = _visitor.fold_span(_i.span());
880 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800881 _i
882 }
David Tolnay8c81f622018-07-31 23:34:35 -0700883 };
David Tolnayd0adf522017-12-29 01:30:07 -0500884}
David Tolnay360efd22018-01-04 23:35:26 -0800885#[cfg(any(feature = "full", feature = "derive"))]
886fold_span_only!(fold_lit_byte: LitByte);
887#[cfg(any(feature = "full", feature = "derive"))]
888fold_span_only!(fold_lit_byte_str: LitByteStr);
889#[cfg(any(feature = "full", feature = "derive"))]
890fold_span_only!(fold_lit_char: LitChar);
891#[cfg(any(feature = "full", feature = "derive"))]
892fold_span_only!(fold_lit_float: LitFloat);
893#[cfg(any(feature = "full", feature = "derive"))]
894fold_span_only!(fold_lit_int: LitInt);
895#[cfg(any(feature = "full", feature = "derive"))]
896fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700897#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800898pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400899 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400900 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700901 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400902 }
903}
David Tolnay8c81f622018-07-31 23:34:35 -0700904#[cfg(any(feature = "full", feature = "derive"))]
905pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
906 _visitor: &mut V,
907 _i: AngleBracketedGenericArguments,
908) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500909 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400910 colon2_token: (_i.colon2_token)
911 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
912 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700913 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400914 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400915 }
916}
David Tolnay8c81f622018-07-31 23:34:35 -0700917#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800918pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400919 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700920 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400921 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700922 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400923 }
924}
David Tolnay8c81f622018-07-31 23:34:35 -0700925#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800926pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400927 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400928 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
929 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400930 }
931}
David Tolnay8c81f622018-07-31 23:34:35 -0700932#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800933pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400934 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400935 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700936 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400937 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
938 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400939 }
940}
David Tolnay8c81f622018-07-31 23:34:35 -0700941#[cfg(any(feature = "full", feature = "derive"))]
942#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800943pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400944 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700945 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400946 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700947 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
948 guard: (_i.guard).map(|it| {
949 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400950 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700951 Box::new(_visitor.fold_expr(*(it).1)),
952 )
953 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400954 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700955 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400956 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400957 }
958}
David Tolnay8c81f622018-07-31 23:34:35 -0700959#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800960pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400961 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700962 AttrStyle::Outer => AttrStyle::Outer,
963 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400964 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400965 }
966 }
967}
David Tolnay8c81f622018-07-31 23:34:35 -0700968#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800969pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400970 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400971 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700972 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400973 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700974 path: _visitor.fold_path(_i.path),
975 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400976 }
977}
David Tolnay8c81f622018-07-31 23:34:35 -0700978#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800979pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400980 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700981 name: (_i.name).map(|it| {
982 (
983 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400984 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700985 )
986 }),
987 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400988 }
989}
David Tolnay8c81f622018-07-31 23:34:35 -0700990#[cfg(any(feature = "full", feature = "derive"))]
991pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
992 _visitor: &mut V,
993 _i: BareFnArgName,
994) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400995 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700996 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
997 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400998 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400999 }
1000 }
1001}
David Tolnay8c81f622018-07-31 23:34:35 -07001002#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001003pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -04001004 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001005 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001006 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001007 }
David Tolnay8c81f622018-07-31 23:34:35 -07001008 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001009 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001010 }
David Tolnay8c81f622018-07-31 23:34:35 -07001011 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001012 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001013 }
David Tolnay8c81f622018-07-31 23:34:35 -07001014 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001015 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001016 }
David Tolnay8c81f622018-07-31 23:34:35 -07001017 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001018 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001019 }
David Tolnay8c81f622018-07-31 23:34:35 -07001020 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001021 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001022 }
David Tolnay8c81f622018-07-31 23:34:35 -07001023 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001024 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001025 }
David Tolnay8c81f622018-07-31 23:34:35 -07001026 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001027 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001028 }
David Tolnay8c81f622018-07-31 23:34:35 -07001029 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001030 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001031 }
David Tolnay8c81f622018-07-31 23:34:35 -07001032 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001033 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001034 }
David Tolnay8c81f622018-07-31 23:34:35 -07001035 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001036 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001037 }
David Tolnay8c81f622018-07-31 23:34:35 -07001038 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001039 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001040 }
David Tolnay8c81f622018-07-31 23:34:35 -07001041 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001042 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001043 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001044 BinOp::Lt(_binding_0) => {
1045 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1046 }
David Tolnay8c81f622018-07-31 23:34:35 -07001047 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001048 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001049 }
David Tolnay8c81f622018-07-31 23:34:35 -07001050 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001051 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001052 }
David Tolnay8c81f622018-07-31 23:34:35 -07001053 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001054 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001055 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001056 BinOp::Gt(_binding_0) => {
1057 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1058 }
David Tolnay8c81f622018-07-31 23:34:35 -07001059 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001060 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001061 }
David Tolnay8c81f622018-07-31 23:34:35 -07001062 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001063 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001064 }
David Tolnay8c81f622018-07-31 23:34:35 -07001065 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001066 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001067 }
David Tolnay8c81f622018-07-31 23:34:35 -07001068 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001069 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001070 }
David Tolnay8c81f622018-07-31 23:34:35 -07001071 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001072 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001073 }
David Tolnay8c81f622018-07-31 23:34:35 -07001074 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001075 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001076 }
David Tolnay8c81f622018-07-31 23:34:35 -07001077 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001078 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001079 }
David Tolnay8c81f622018-07-31 23:34:35 -07001080 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001081 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001082 }
David Tolnay8c81f622018-07-31 23:34:35 -07001083 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001084 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001085 }
David Tolnay8c81f622018-07-31 23:34:35 -07001086 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001087 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001088 }
1089 }
1090}
David Tolnay8c81f622018-07-31 23:34:35 -07001091#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001092pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001093 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001094 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001095 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001096 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001097 }
1098}
David Tolnay8c81f622018-07-31 23:34:35 -07001099#[cfg(any(feature = "full", feature = "derive"))]
1100#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001101pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001102 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001103 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001104 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001105 }
1106}
David Tolnay8c81f622018-07-31 23:34:35 -07001107#[cfg(any(feature = "full", feature = "derive"))]
1108pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1109 _visitor: &mut V,
1110 _i: BoundLifetimes,
1111) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001112 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001113 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1114 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001115 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001116 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001117 }
1118}
David Tolnay8c81f622018-07-31 23:34:35 -07001119#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001120pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001121 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001122 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001123 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001124 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001125 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001126 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001127 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001128 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001129 }
1130}
David Tolnay8c81f622018-07-31 23:34:35 -07001131#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001132pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001133 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001134 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1135 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1136 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001137 }
1138}
David Tolnay8c81f622018-07-31 23:34:35 -07001139#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001140pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001141 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001142 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1143 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001144 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001145 }
1146}
David Tolnay8c81f622018-07-31 23:34:35 -07001147#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001148pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001149 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001150 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001151 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001152 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001153 }
1154}
David Tolnay8c81f622018-07-31 23:34:35 -07001155#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001156pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001157 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001158 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001159 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001160 }
1161}
David Tolnay8c81f622018-07-31 23:34:35 -07001162#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001163pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001164 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001165 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1166 vis: _visitor.fold_visibility(_i.vis),
1167 ident: _visitor.fold_ident(_i.ident),
1168 generics: _visitor.fold_generics(_i.generics),
1169 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001170 }
1171}
David Tolnay8c81f622018-07-31 23:34:35 -07001172#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001173pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001174 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001175 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1176 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1177 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1178 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1179 Expr::MethodCall(_binding_0) => {
1180 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001181 }
David Tolnay8c81f622018-07-31 23:34:35 -07001182 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1183 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1184 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1185 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1186 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1187 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
1188 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
1189 Expr::IfLet(_binding_0) => Expr::IfLet(full!(_visitor.fold_expr_if_let(_binding_0))),
1190 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
1191 Expr::WhileLet(_binding_0) => {
1192 Expr::WhileLet(full!(_visitor.fold_expr_while_let(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001193 }
David Tolnay8c81f622018-07-31 23:34:35 -07001194 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1195 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1196 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1197 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1198 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1199 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1200 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1201 Expr::AssignOp(_binding_0) => {
1202 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001203 }
David Tolnay8c81f622018-07-31 23:34:35 -07001204 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1205 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1206 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1207 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1208 Expr::Reference(_binding_0) => {
1209 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001210 }
David Tolnay8c81f622018-07-31 23:34:35 -07001211 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1212 Expr::Continue(_binding_0) => {
1213 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001214 }
David Tolnay8c81f622018-07-31 23:34:35 -07001215 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1216 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1217 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1218 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1219 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1220 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1221 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001222 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001223 Expr::TryBlock(_binding_0) => {
1224 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1225 }
David Tolnay8c81f622018-07-31 23:34:35 -07001226 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1227 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001228 }
1229}
David Tolnay8c81f622018-07-31 23:34:35 -07001230#[cfg(feature = "full")]
1231#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001232pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001233 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001234 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001235 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001236 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001237 }
1238}
David Tolnay8c81f622018-07-31 23:34:35 -07001239#[cfg(feature = "full")]
1240#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001241pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001242 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001243 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1244 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001245 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001246 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001247 }
1248}
David Tolnay8c81f622018-07-31 23:34:35 -07001249#[cfg(feature = "full")]
1250#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001251pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001252 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001253 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1254 left: Box::new(_visitor.fold_expr(*_i.left)),
1255 op: _visitor.fold_bin_op(_i.op),
1256 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001257 }
1258}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001259#[cfg(feature = "full")]
1260#[cfg(any(feature = "full", feature = "derive"))]
1261pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1262 ExprAsync {
1263 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1264 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
1265 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1266 block: _visitor.fold_block(_i.block),
1267 }
1268}
David Tolnay8c81f622018-07-31 23:34:35 -07001269#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001270pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001271 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001272 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1273 left: Box::new(_visitor.fold_expr(*_i.left)),
1274 op: _visitor.fold_bin_op(_i.op),
1275 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001276 }
1277}
David Tolnay8c81f622018-07-31 23:34:35 -07001278#[cfg(feature = "full")]
1279#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001280pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001281 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001282 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001283 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001284 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001285 }
1286}
David Tolnay8c81f622018-07-31 23:34:35 -07001287#[cfg(feature = "full")]
1288#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001289pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001290 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001291 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001292 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001293 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001294 }
1295}
David Tolnay8c81f622018-07-31 23:34:35 -07001296#[cfg(feature = "full")]
1297#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001298pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001299 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001300 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001301 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001302 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1303 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001304 }
1305}
David Tolnay8c81f622018-07-31 23:34:35 -07001306#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001307pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001308 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001309 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1310 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001311 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001312 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001313 }
1314}
David Tolnay8c81f622018-07-31 23:34:35 -07001315#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001316pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001317 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001318 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1319 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001320 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001321 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001322 }
1323}
David Tolnay8c81f622018-07-31 23:34:35 -07001324#[cfg(feature = "full")]
1325#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001326pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001327 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001328 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001329 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001330 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1331 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1332 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001333 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001334 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001335 output: _visitor.fold_return_type(_i.output),
1336 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001337 }
1338}
David Tolnay8c81f622018-07-31 23:34:35 -07001339#[cfg(feature = "full")]
1340#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001341pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001342 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001343 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001344 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001345 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001346 }
1347}
David Tolnay8c81f622018-07-31 23:34:35 -07001348#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001349pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001350 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001351 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1352 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001353 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001354 member: _visitor.fold_member(_i.member),
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_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001360 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001361 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1362 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001363 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001364 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001365 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001366 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1367 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001368 }
1369}
David Tolnay8c81f622018-07-31 23:34:35 -07001370#[cfg(feature = "full")]
1371#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001372pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001373 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001374 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001375 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001376 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001377 }
1378}
David Tolnay8c81f622018-07-31 23:34:35 -07001379#[cfg(feature = "full")]
1380#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001381pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001382 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001383 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001384 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001385 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1386 then_branch: _visitor.fold_block(_i.then_branch),
1387 else_branch: (_i.else_branch).map(|it| {
1388 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001389 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001390 Box::new(_visitor.fold_expr(*(it).1)),
1391 )
1392 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001393 }
1394}
David Tolnay8c81f622018-07-31 23:34:35 -07001395#[cfg(feature = "full")]
1396#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001397pub fn fold_expr_if_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIfLet) -> ExprIfLet {
David Tolnay8c91b882017-12-28 23:04:32 -05001398 ExprIfLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001399 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001400 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
1401 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001402 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001403 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001404 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1405 then_branch: _visitor.fold_block(_i.then_branch),
1406 else_branch: (_i.else_branch).map(|it| {
1407 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001408 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001409 Box::new(_visitor.fold_expr(*(it).1)),
1410 )
1411 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001412 }
1413}
David Tolnay8c81f622018-07-31 23:34:35 -07001414#[cfg(feature = "full")]
1415#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001416pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001417 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001418 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1419 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001420 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001421 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001422 }
1423}
David Tolnay8c81f622018-07-31 23:34:35 -07001424#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001425pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001426 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001427 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1428 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001429 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001430 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001431 }
1432}
David Tolnay8c81f622018-07-31 23:34:35 -07001433#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001434pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001435 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001436 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1437 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001438 }
1439}
David Tolnay8c81f622018-07-31 23:34:35 -07001440#[cfg(feature = "full")]
1441#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001442pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001443 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001444 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1445 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001446 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001447 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001448 }
1449}
David Tolnay8c81f622018-07-31 23:34:35 -07001450#[cfg(feature = "full")]
1451#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001452pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001453 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001454 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1455 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001456 }
1457}
David Tolnay8c81f622018-07-31 23:34:35 -07001458#[cfg(feature = "full")]
1459#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001460pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001461 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001462 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001463 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001464 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001465 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001466 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001467 }
1468}
David Tolnay8c81f622018-07-31 23:34:35 -07001469#[cfg(feature = "full")]
1470#[cfg(any(feature = "full", feature = "derive"))]
1471pub fn fold_expr_method_call<V: Fold + ?Sized>(
1472 _visitor: &mut V,
1473 _i: ExprMethodCall,
1474) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001475 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001476 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1477 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001478 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001479 method: _visitor.fold_ident(_i.method),
1480 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001481 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001482 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001483 }
1484}
David Tolnay8c81f622018-07-31 23:34:35 -07001485#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001486pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001487 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001488 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001489 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001490 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001491 }
1492}
David Tolnay8c81f622018-07-31 23:34:35 -07001493#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001494pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001495 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001496 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1497 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1498 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001499 }
1500}
David Tolnay8c81f622018-07-31 23:34:35 -07001501#[cfg(feature = "full")]
1502#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001503pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001504 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001505 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1506 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1507 limits: _visitor.fold_range_limits(_i.limits),
1508 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001509 }
1510}
David Tolnay8c81f622018-07-31 23:34:35 -07001511#[cfg(feature = "full")]
1512#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001513pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1514 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001515 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001516 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1517 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001518 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001519 }
1520}
David Tolnay8c81f622018-07-31 23:34:35 -07001521#[cfg(feature = "full")]
1522#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001523pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001524 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001525 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001526 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001527 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001528 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001529 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001530 }
1531}
David Tolnay8c81f622018-07-31 23:34:35 -07001532#[cfg(feature = "full")]
1533#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001534pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001535 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001536 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001537 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001538 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001539 }
1540}
David Tolnay8c81f622018-07-31 23:34:35 -07001541#[cfg(feature = "full")]
1542#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001543pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001544 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001545 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1546 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001547 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001548 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001549 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001550 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001551 }
1552}
David Tolnay8c81f622018-07-31 23:34:35 -07001553#[cfg(feature = "full")]
1554#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001555pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001556 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001557 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1558 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001559 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001560 }
1561}
David Tolnay8c81f622018-07-31 23:34:35 -07001562#[cfg(feature = "full")]
1563#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001564pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1565 ExprTryBlock {
1566 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1567 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1568 block: _visitor.fold_block(_i.block),
1569 }
1570}
1571#[cfg(feature = "full")]
1572#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001573pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001574 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001575 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001576 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001577 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001578 }
1579}
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_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001583 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001584 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1585 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001586 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001587 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001588 }
1589}
David Tolnay8c81f622018-07-31 23:34:35 -07001590#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001591pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001592 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001593 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1594 op: _visitor.fold_un_op(_i.op),
1595 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001596 }
1597}
David Tolnay8c81f622018-07-31 23:34:35 -07001598#[cfg(feature = "full")]
1599#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001600pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001601 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001602 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001603 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001604 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001605 }
1606}
David Tolnay8c81f622018-07-31 23:34:35 -07001607#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001608pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001609 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001610}
David Tolnay8c81f622018-07-31 23:34:35 -07001611#[cfg(feature = "full")]
1612#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001613pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001614 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001615 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1616 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001617 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001618 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1619 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001620 }
1621}
David Tolnay8c81f622018-07-31 23:34:35 -07001622#[cfg(feature = "full")]
1623#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001624pub fn fold_expr_while_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhileLet) -> ExprWhileLet {
Nika Layzell27726662017-10-24 23:16:35 -04001625 ExprWhileLet {
David Tolnay8c81f622018-07-31 23:34:35 -07001626 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1627 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001628 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
1629 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001630 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001631 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001632 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1633 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001634 }
1635}
David Tolnay8c81f622018-07-31 23:34:35 -07001636#[cfg(feature = "full")]
1637#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001638pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001639 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001640 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001641 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001642 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001643 }
1644}
David Tolnay8c81f622018-07-31 23:34:35 -07001645#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001646pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001647 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001648 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1649 vis: _visitor.fold_visibility(_i.vis),
1650 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001651 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001652 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001653 }
1654}
David Tolnay8c81f622018-07-31 23:34:35 -07001655#[cfg(any(feature = "full", feature = "derive"))]
1656#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001657pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001658 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001659 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1660 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001661 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001662 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001663 }
1664}
David Tolnay8c81f622018-07-31 23:34:35 -07001665#[cfg(any(feature = "full", feature = "derive"))]
1666#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001667pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001668 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001669 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1670 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001671 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001672 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001673 }
1674}
David Tolnay8c81f622018-07-31 23:34:35 -07001675#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001676pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001677 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001678 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1679 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1680 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001681 }
1682}
David Tolnay8c81f622018-07-31 23:34:35 -07001683#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001684pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001685 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001686 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001687 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001688 }
1689}
David Tolnay8c81f622018-07-31 23:34:35 -07001690#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001691pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001692 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001693 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001694 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001695 }
1696}
David Tolnay8c81f622018-07-31 23:34:35 -07001697#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001698pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001699 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001700 shebang: _i.shebang,
1701 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1702 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001703 }
1704}
David Tolnay8c81f622018-07-31 23:34:35 -07001705#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001706pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001707 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001708 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1709 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1710 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1711 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1712 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001713 }
1714}
David Tolnay8c81f622018-07-31 23:34:35 -07001715#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001716pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001717 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001718 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001719 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001720 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001721 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001722 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001723 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001724 }
1725}
David Tolnay8c81f622018-07-31 23:34:35 -07001726#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001727pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001728 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001729 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1730 ForeignItem::Static(_binding_0) => {
1731 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001732 }
David Tolnay8c81f622018-07-31 23:34:35 -07001733 ForeignItem::Type(_binding_0) => {
1734 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001735 }
David Tolnay435c1782018-08-24 16:15:44 -04001736 ForeignItem::Macro(_binding_0) => {
1737 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1738 }
David Tolnay8c81f622018-07-31 23:34:35 -07001739 ForeignItem::Verbatim(_binding_0) => {
1740 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001741 }
Nika Layzell27726662017-10-24 23:16:35 -04001742 }
1743}
David Tolnay8c81f622018-07-31 23:34:35 -07001744#[cfg(feature = "full")]
1745pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1746 _visitor: &mut V,
1747 _i: ForeignItemFn,
1748) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001749 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001750 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1751 vis: _visitor.fold_visibility(_i.vis),
1752 ident: _visitor.fold_ident(_i.ident),
1753 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001754 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001755 }
1756}
David Tolnay8c81f622018-07-31 23:34:35 -07001757#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001758pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1759 _visitor: &mut V,
1760 _i: ForeignItemMacro,
1761) -> ForeignItemMacro {
1762 ForeignItemMacro {
1763 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1764 mac: _visitor.fold_macro(_i.mac),
1765 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1766 }
1767}
1768#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001769pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1770 _visitor: &mut V,
1771 _i: ForeignItemStatic,
1772) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001773 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001774 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1775 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001776 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1777 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001778 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001779 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001780 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001781 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001782 }
1783}
David Tolnay8c81f622018-07-31 23:34:35 -07001784#[cfg(feature = "full")]
1785pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1786 _visitor: &mut V,
1787 _i: ForeignItemType,
1788) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001789 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001790 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1791 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001792 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001793 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001794 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001795 }
1796}
David Tolnay8c81f622018-07-31 23:34:35 -07001797#[cfg(feature = "full")]
1798pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1799 _visitor: &mut V,
1800 _i: ForeignItemVerbatim,
1801) -> ForeignItemVerbatim {
1802 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001803}
David Tolnay8c81f622018-07-31 23:34:35 -07001804#[cfg(any(feature = "full", feature = "derive"))]
1805pub fn fold_generic_argument<V: Fold + ?Sized>(
1806 _visitor: &mut V,
1807 _i: GenericArgument,
1808) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001809 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001810 GenericArgument::Lifetime(_binding_0) => {
1811 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001812 }
David Tolnay8c81f622018-07-31 23:34:35 -07001813 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1814 GenericArgument::Binding(_binding_0) => {
1815 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001816 }
David Tolnay8c81f622018-07-31 23:34:35 -07001817 GenericArgument::Const(_binding_0) => {
1818 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001819 }
Nika Layzell357885a2017-12-04 15:47:07 -05001820 }
1821}
David Tolnay8c81f622018-07-31 23:34:35 -07001822#[cfg(any(feature = "full", feature = "derive"))]
1823#[cfg(feature = "full")]
1824pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1825 _visitor: &mut V,
1826 _i: GenericMethodArgument,
1827) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001828 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001829 GenericMethodArgument::Type(_binding_0) => {
1830 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001831 }
David Tolnay8c81f622018-07-31 23:34:35 -07001832 GenericMethodArgument::Const(_binding_0) => {
1833 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001834 }
1835 }
1836}
David Tolnay8c81f622018-07-31 23:34:35 -07001837#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001838pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001839 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001840 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1841 GenericParam::Lifetime(_binding_0) => {
1842 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001843 }
David Tolnay8c81f622018-07-31 23:34:35 -07001844 GenericParam::Const(_binding_0) => {
1845 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001846 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001847 }
1848}
David Tolnay8c81f622018-07-31 23:34:35 -07001849#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001850pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001851 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001852 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001853 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001854 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001855 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001856 }
1857}
Alex Crichtond261d092018-05-18 13:47:35 -07001858pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001859 let mut _i = _i;
1860 let span = _visitor.fold_span(_i.span());
1861 _i.set_span(span);
1862 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001863}
David Tolnay8c81f622018-07-31 23:34:35 -07001864#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001865pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001866 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001867 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1868 ImplItem::Method(_binding_0) => {
1869 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001870 }
David Tolnay8c81f622018-07-31 23:34:35 -07001871 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001872 ImplItem::Existential(_binding_0) => {
1873 ImplItem::Existential(_visitor.fold_impl_item_existential(_binding_0))
1874 }
David Tolnay8c81f622018-07-31 23:34:35 -07001875 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1876 ImplItem::Verbatim(_binding_0) => {
1877 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001878 }
Nika Layzell27726662017-10-24 23:16:35 -04001879 }
1880}
David Tolnay8c81f622018-07-31 23:34:35 -07001881#[cfg(feature = "full")]
1882pub fn fold_impl_item_const<V: Fold + ?Sized>(
1883 _visitor: &mut V,
1884 _i: ImplItemConst,
1885) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001886 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001887 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1888 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001889 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1890 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001891 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001892 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001893 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001894 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001895 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001896 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001897 }
1898}
David Tolnay8c81f622018-07-31 23:34:35 -07001899#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001900pub fn fold_impl_item_existential<V: Fold + ?Sized>(
1901 _visitor: &mut V,
1902 _i: ImplItemExistential,
1903) -> ImplItemExistential {
1904 ImplItemExistential {
1905 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1906 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
1907 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
1908 ident: _visitor.fold_ident(_i.ident),
1909 generics: _visitor.fold_generics(_i.generics),
1910 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1911 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1912 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1913 }
1914}
1915#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001916pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1917 _visitor: &mut V,
1918 _i: ImplItemMacro,
1919) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001920 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001921 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1922 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001923 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001924 }
1925}
David Tolnay8c81f622018-07-31 23:34:35 -07001926#[cfg(feature = "full")]
1927pub fn fold_impl_item_method<V: Fold + ?Sized>(
1928 _visitor: &mut V,
1929 _i: ImplItemMethod,
1930) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001931 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001932 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1933 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001934 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001935 sig: _visitor.fold_method_sig(_i.sig),
1936 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001937 }
1938}
David Tolnay8c81f622018-07-31 23:34:35 -07001939#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001940pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001941 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001942 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1943 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001944 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1945 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001946 ident: _visitor.fold_ident(_i.ident),
1947 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001948 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001949 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001950 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001951 }
1952}
David Tolnay8c81f622018-07-31 23:34:35 -07001953#[cfg(feature = "full")]
1954pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1955 _visitor: &mut V,
1956 _i: ImplItemVerbatim,
1957) -> ImplItemVerbatim {
1958 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001959}
David Tolnay8c81f622018-07-31 23:34:35 -07001960#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001961pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001962 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001963 index: _i.index,
1964 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001965 }
1966}
David Tolnay8c81f622018-07-31 23:34:35 -07001967#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001968pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001969 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001970 Item::ExternCrate(_binding_0) => {
1971 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001972 }
David Tolnay8c81f622018-07-31 23:34:35 -07001973 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1974 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1975 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1976 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1977 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1978 Item::ForeignMod(_binding_0) => {
1979 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001980 }
David Tolnay8c81f622018-07-31 23:34:35 -07001981 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001982 Item::Existential(_binding_0) => {
1983 Item::Existential(_visitor.fold_item_existential(_binding_0))
1984 }
David Tolnay8c81f622018-07-31 23:34:35 -07001985 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1986 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1987 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1988 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
1989 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1990 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1991 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1992 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001993 }
1994}
David Tolnay8c81f622018-07-31 23:34:35 -07001995#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001996pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001997 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001998 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1999 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002000 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002001 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002002 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002003 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002004 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002005 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002006 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002007 }
2008}
David Tolnay8c81f622018-07-31 23:34:35 -07002009#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002010pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002011 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07002012 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2013 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002014 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002015 ident: _visitor.fold_ident(_i.ident),
2016 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002017 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002018 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002019 }
2020}
David Tolnay8c81f622018-07-31 23:34:35 -07002021#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04002022pub fn fold_item_existential<V: Fold + ?Sized>(
2023 _visitor: &mut V,
2024 _i: ItemExistential,
2025) -> ItemExistential {
2026 ItemExistential {
2027 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2028 vis: _visitor.fold_visibility(_i.vis),
2029 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
2030 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
2031 ident: _visitor.fold_ident(_i.ident),
2032 generics: _visitor.fold_generics(_i.generics),
2033 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
2034 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2035 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2036 }
2037}
2038#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07002039pub fn fold_item_extern_crate<V: Fold + ?Sized>(
2040 _visitor: &mut V,
2041 _i: ItemExternCrate,
2042) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002043 ItemExternCrate {
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 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
2047 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002048 ident: _visitor.fold_ident(_i.ident),
2049 rename: (_i.rename).map(|it| {
2050 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002051 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002052 _visitor.fold_ident((it).1),
2053 )
2054 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002055 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002056 }
2057}
David Tolnay8c81f622018-07-31 23:34:35 -07002058#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002059pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002060 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07002061 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2062 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002063 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2064 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002065 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002066 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2067 ident: _visitor.fold_ident(_i.ident),
2068 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2069 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002070 }
2071}
David Tolnay8c81f622018-07-31 23:34:35 -07002072#[cfg(feature = "full")]
2073pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2074 _visitor: &mut V,
2075 _i: ItemForeignMod,
2076) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002077 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002078 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2079 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002080 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002081 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002082 }
2083}
David Tolnay8c81f622018-07-31 23:34:35 -07002084#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002085pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002086 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002087 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002088 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2089 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2090 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002091 generics: _visitor.fold_generics(_i.generics),
2092 trait_: (_i.trait_).map(|it| {
2093 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002094 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002095 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002096 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002097 )
2098 }),
2099 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002100 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002101 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002102 }
2103}
David Tolnay8c81f622018-07-31 23:34:35 -07002104#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002105pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002106 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002107 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2108 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2109 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002110 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002111 }
2112}
David Tolnay8c81f622018-07-31 23:34:35 -07002113#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002114pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002115 ItemMacro2 {
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 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002119 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002120 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002121 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002122 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002123 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002124 }
2125}
David Tolnay8c81f622018-07-31 23:34:35 -07002126#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002127pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002128 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002129 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2130 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002131 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002132 ident: _visitor.fold_ident(_i.ident),
2133 content: (_i.content).map(|it| {
2134 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002135 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002136 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2137 )
2138 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002139 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002140 }
2141}
David Tolnay8c81f622018-07-31 23:34:35 -07002142#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002143pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002144 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002145 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2146 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002147 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2148 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002149 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002150 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002151 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002152 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002153 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002154 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002155 }
2156}
David Tolnay8c81f622018-07-31 23:34:35 -07002157#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002158pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002159 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002160 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2161 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002162 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002163 ident: _visitor.fold_ident(_i.ident),
2164 generics: _visitor.fold_generics(_i.generics),
2165 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002166 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002167 }
2168}
David Tolnay8c81f622018-07-31 23:34:35 -07002169#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002170pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002171 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002172 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2173 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002174 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2175 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2176 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002177 ident: _visitor.fold_ident(_i.ident),
2178 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002179 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002180 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002181 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002182 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002183 }
2184}
David Tolnay8c81f622018-07-31 23:34:35 -07002185#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002186pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002187 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002188 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2189 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002190 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002191 ident: _visitor.fold_ident(_i.ident),
2192 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002193 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002194 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002195 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002196 }
2197}
David Tolnay8c81f622018-07-31 23:34:35 -07002198#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002199pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002200 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002201 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2202 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002203 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002204 ident: _visitor.fold_ident(_i.ident),
2205 generics: _visitor.fold_generics(_i.generics),
2206 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002207 }
2208}
David Tolnay8c81f622018-07-31 23:34:35 -07002209#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002210pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002211 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002212 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2213 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002214 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002215 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002216 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002217 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002218 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002219 }
2220}
David Tolnay8c81f622018-07-31 23:34:35 -07002221#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002222pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002223 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002224}
David Tolnay8c81f622018-07-31 23:34:35 -07002225#[cfg(any(feature = "full", feature = "derive"))]
2226#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002227pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002228 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002229 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002230 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002231 }
2232}
David Tolnay8c81f622018-07-31 23:34:35 -07002233#[cfg(any(feature = "full", feature = "derive"))]
Alex Crichton131308c2018-05-18 14:00:24 -07002234pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2235 Lifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002236 apostrophe: _i.apostrophe,
2237 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002238 }
2239}
David Tolnay8c81f622018-07-31 23:34:35 -07002240#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002241pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002242 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002243 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2244 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002245 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002246 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002247 }
2248}
David Tolnay8c81f622018-07-31 23:34:35 -07002249#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002250pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002251 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002252 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2253 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2254 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2255 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2256 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2257 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2258 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2259 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002260 }
2261}
David Tolnay8c81f622018-07-31 23:34:35 -07002262#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002263pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002264 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002265 value: _i.value,
2266 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002267 }
2268}
David Tolnay8c81f622018-07-31 23:34:35 -07002269#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002270pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002271 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002272}
David Tolnay8c81f622018-07-31 23:34:35 -07002273#[cfg(any(feature = "full", feature = "derive"))]
2274#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002275pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002276 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002277 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002278 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002279 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2280 ty: (_i.ty).map(|it| {
2281 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002282 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002283 Box::new(_visitor.fold_type(*(it).1)),
2284 )
2285 }),
2286 init: (_i.init).map(|it| {
2287 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002288 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002289 Box::new(_visitor.fold_expr(*(it).1)),
2290 )
2291 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002292 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002293 }
2294}
David Tolnay8c81f622018-07-31 23:34:35 -07002295#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002296pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002297 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002298 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002299 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002300 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2301 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002302 }
2303}
David Tolnay8c81f622018-07-31 23:34:35 -07002304#[cfg(any(feature = "full", feature = "derive"))]
2305pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2306 _visitor: &mut V,
2307 _i: MacroDelimiter,
2308) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002309 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002310 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002311 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002312 }
David Tolnay8c81f622018-07-31 23:34:35 -07002313 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002314 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002315 }
David Tolnay8c81f622018-07-31 23:34:35 -07002316 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002317 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002318 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002319 }
2320}
David Tolnay8c81f622018-07-31 23:34:35 -07002321#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002322pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002323 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002324 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2325 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002326 }
2327}
David Tolnay8c81f622018-07-31 23:34:35 -07002328#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002329pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002330 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002331 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2332 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2333 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002334 }
2335}
David Tolnay8c81f622018-07-31 23:34:35 -07002336#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002337pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2338 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002339 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002340 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002341 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002342 }
2343}
David Tolnay8c81f622018-07-31 23:34:35 -07002344#[cfg(any(feature = "full", feature = "derive"))]
2345pub fn fold_meta_name_value<V: Fold + ?Sized>(
2346 _visitor: &mut V,
2347 _i: MetaNameValue,
2348) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002349 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002350 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002351 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002352 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002353 }
2354}
David Tolnay8c81f622018-07-31 23:34:35 -07002355#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002356pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002357 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002358 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2359 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002360 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002361 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2362 ident: _visitor.fold_ident(_i.ident),
2363 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002364 }
2365}
David Tolnay8c81f622018-07-31 23:34:35 -07002366#[cfg(any(feature = "full", feature = "derive"))]
2367#[cfg(feature = "full")]
2368pub fn fold_method_turbofish<V: Fold + ?Sized>(
2369 _visitor: &mut V,
2370 _i: MethodTurbofish,
2371) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002372 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002373 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2374 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002375 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002376 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002377 }
2378}
David Tolnay8c81f622018-07-31 23:34:35 -07002379#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002380pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002381 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002382 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2383 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002384 }
2385}
David Tolnay8c81f622018-07-31 23:34:35 -07002386#[cfg(any(feature = "full", feature = "derive"))]
2387pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2388 _visitor: &mut V,
2389 _i: ParenthesizedGenericArguments,
2390) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002391 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002392 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002393 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2394 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002395 }
2396}
David Tolnay8c81f622018-07-31 23:34:35 -07002397#[cfg(any(feature = "full", feature = "derive"))]
2398#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002399pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002400 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002401 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2402 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2403 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2404 Pat::TupleStruct(_binding_0) => {
2405 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002406 }
David Tolnay8c81f622018-07-31 23:34:35 -07002407 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2408 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2409 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2410 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2411 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2412 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2413 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2414 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2415 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002416 }
2417}
David Tolnay8c81f622018-07-31 23:34:35 -07002418#[cfg(any(feature = "full", feature = "derive"))]
2419#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002420pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002421 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002422 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002423 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002424 }
2425}
David Tolnay8c81f622018-07-31 23:34:35 -07002426#[cfg(any(feature = "full", feature = "derive"))]
2427#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002428pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002429 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002430 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2431 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002432 ident: _visitor.fold_ident(_i.ident),
2433 subpat: (_i.subpat).map(|it| {
2434 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002435 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002436 Box::new(_visitor.fold_pat(*(it).1)),
2437 )
2438 }),
Nika Layzell27726662017-10-24 23:16:35 -04002439 }
2440}
David Tolnay8c81f622018-07-31 23:34:35 -07002441#[cfg(any(feature = "full", feature = "derive"))]
2442#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002443pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002444 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002445 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002446 }
2447}
David Tolnay8c81f622018-07-31 23:34:35 -07002448#[cfg(any(feature = "full", feature = "derive"))]
2449#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002450pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002451 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002452 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002453 }
2454}
David Tolnay8c81f622018-07-31 23:34:35 -07002455#[cfg(any(feature = "full", feature = "derive"))]
2456#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002457pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002458 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002459 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2460 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002461 }
2462}
David Tolnay8c81f622018-07-31 23:34:35 -07002463#[cfg(any(feature = "full", feature = "derive"))]
2464#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002465pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002466 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002467 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2468 limits: _visitor.fold_range_limits(_i.limits),
2469 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002470 }
2471}
David Tolnay8c81f622018-07-31 23:34:35 -07002472#[cfg(any(feature = "full", feature = "derive"))]
2473#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002474pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002475 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002476 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2477 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002478 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002479 }
2480}
David Tolnay8c81f622018-07-31 23:34:35 -07002481#[cfg(any(feature = "full", feature = "derive"))]
2482#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002483pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002484 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002485 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002486 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2487 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002488 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2489 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002490 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002491 }
2492}
David Tolnay8c81f622018-07-31 23:34:35 -07002493#[cfg(any(feature = "full", feature = "derive"))]
2494#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002495pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002496 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002497 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002498 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002499 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002500 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002501 }
2502}
David Tolnay8c81f622018-07-31 23:34:35 -07002503#[cfg(any(feature = "full", feature = "derive"))]
2504#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002505pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002506 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002507 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002508 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002509 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2510 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002511 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002512 }
2513}
David Tolnay8c81f622018-07-31 23:34:35 -07002514#[cfg(any(feature = "full", feature = "derive"))]
2515#[cfg(feature = "full")]
2516pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2517 _visitor: &mut V,
2518 _i: PatTupleStruct,
2519) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002520 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002521 path: _visitor.fold_path(_i.path),
2522 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002523 }
2524}
David Tolnay8c81f622018-07-31 23:34:35 -07002525#[cfg(any(feature = "full", feature = "derive"))]
2526#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002527pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002528 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002529}
David Tolnay8c81f622018-07-31 23:34:35 -07002530#[cfg(any(feature = "full", feature = "derive"))]
2531#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002532pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002533 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002534 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002535 }
2536}
David Tolnay8c81f622018-07-31 23:34:35 -07002537#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002538pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002539 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002540 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002541 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002542 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002543 }
2544}
David Tolnay8c81f622018-07-31 23:34:35 -07002545#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002546pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002547 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002548 PathArguments::None => PathArguments::None,
2549 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2550 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2551 ),
2552 PathArguments::Parenthesized(_binding_0) => {
2553 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002554 }
2555 }
2556}
David Tolnay8c81f622018-07-31 23:34:35 -07002557#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002558pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002559 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002560 ident: _visitor.fold_ident(_i.ident),
2561 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002562 }
2563}
David Tolnay8c81f622018-07-31 23:34:35 -07002564#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002565pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002566 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002567 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002568 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002569 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002570 }
2571}
David Tolnay8c81f622018-07-31 23:34:35 -07002572#[cfg(any(feature = "full", feature = "derive"))]
2573pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2574 _visitor: &mut V,
2575 _i: PredicateLifetime,
2576) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002577 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002578 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay1b8e2852018-08-26 08:25:18 -04002579 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002580 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002581 }
2582}
David Tolnay8c81f622018-07-31 23:34:35 -07002583#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002584pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002585 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002586 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2587 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002588 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002589 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002590 }
2591}
David Tolnay8c81f622018-07-31 23:34:35 -07002592#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002593pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002594 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002595 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002596 ty: Box::new(_visitor.fold_type(*_i.ty)),
2597 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002598 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2599 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002600 }
2601}
David Tolnay8c81f622018-07-31 23:34:35 -07002602#[cfg(any(feature = "full", feature = "derive"))]
2603#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002604pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002605 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002606 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002607 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002608 }
David Tolnay8c81f622018-07-31 23:34:35 -07002609 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002610 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002611 }
2612 }
2613}
David Tolnay8c81f622018-07-31 23:34:35 -07002614#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002615pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002616 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002617 ReturnType::Default => ReturnType::Default,
2618 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002619 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002620 Box::new(_visitor.fold_type(*_binding_1)),
2621 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002622 }
2623}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002624pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002625 _i
2626}
David Tolnay8c81f622018-07-31 23:34:35 -07002627#[cfg(any(feature = "full", feature = "derive"))]
2628#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002629pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002630 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002631 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2632 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2633 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2634 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2635 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002636 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002637 ),
Nika Layzell27726662017-10-24 23:16:35 -04002638 }
2639}
David Tolnay8c81f622018-07-31 23:34:35 -07002640#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002641pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002642 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002643 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002644 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2645 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2646 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002647 }
2648}
David Tolnay8c81f622018-07-31 23:34:35 -07002649#[cfg(any(feature = "full", feature = "derive"))]
2650pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2651 _visitor: &mut V,
2652 _i: TraitBoundModifier,
2653) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002654 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002655 TraitBoundModifier::None => TraitBoundModifier::None,
2656 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002657 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002658 }
2659 }
2660}
David Tolnay8c81f622018-07-31 23:34:35 -07002661#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002662pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002663 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002664 TraitItem::Const(_binding_0) => {
2665 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002666 }
David Tolnay8c81f622018-07-31 23:34:35 -07002667 TraitItem::Method(_binding_0) => {
2668 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002669 }
David Tolnay8c81f622018-07-31 23:34:35 -07002670 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2671 TraitItem::Macro(_binding_0) => {
2672 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002673 }
David Tolnay8c81f622018-07-31 23:34:35 -07002674 TraitItem::Verbatim(_binding_0) => {
2675 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002676 }
Nika Layzell27726662017-10-24 23:16:35 -04002677 }
2678}
David Tolnay8c81f622018-07-31 23:34:35 -07002679#[cfg(feature = "full")]
2680pub fn fold_trait_item_const<V: Fold + ?Sized>(
2681 _visitor: &mut V,
2682 _i: TraitItemConst,
2683) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002684 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002685 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002686 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002687 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002688 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002689 ty: _visitor.fold_type(_i.ty),
2690 default: (_i.default).map(|it| {
2691 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002692 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002693 _visitor.fold_expr((it).1),
2694 )
2695 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002696 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002697 }
2698}
David Tolnay8c81f622018-07-31 23:34:35 -07002699#[cfg(feature = "full")]
2700pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2701 _visitor: &mut V,
2702 _i: TraitItemMacro,
2703) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002704 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002705 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2706 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002707 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002708 }
2709}
David Tolnay8c81f622018-07-31 23:34:35 -07002710#[cfg(feature = "full")]
2711pub fn fold_trait_item_method<V: Fold + ?Sized>(
2712 _visitor: &mut V,
2713 _i: TraitItemMethod,
2714) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002715 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002716 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2717 sig: _visitor.fold_method_sig(_i.sig),
2718 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002719 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002720 }
2721}
David Tolnay8c81f622018-07-31 23:34:35 -07002722#[cfg(feature = "full")]
2723pub fn fold_trait_item_type<V: Fold + ?Sized>(
2724 _visitor: &mut V,
2725 _i: TraitItemType,
2726) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002727 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002728 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002729 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002730 ident: _visitor.fold_ident(_i.ident),
2731 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002732 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002733 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2734 default: (_i.default).map(|it| {
2735 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002736 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002737 _visitor.fold_type((it).1),
2738 )
2739 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002740 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002741 }
2742}
David Tolnay8c81f622018-07-31 23:34:35 -07002743#[cfg(feature = "full")]
2744pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2745 _visitor: &mut V,
2746 _i: TraitItemVerbatim,
2747) -> TraitItemVerbatim {
2748 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002749}
David Tolnay8c81f622018-07-31 23:34:35 -07002750#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002751pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002752 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002753 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2754 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2755 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2756 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2757 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2758 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2759 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2760 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2761 Type::TraitObject(_binding_0) => {
2762 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002763 }
David Tolnay8c81f622018-07-31 23:34:35 -07002764 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2765 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2766 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2767 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2768 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2769 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002770 }
2771}
David Tolnay8c81f622018-07-31 23:34:35 -07002772#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002773pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002774 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002775 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002776 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002777 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002778 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002779 }
2780}
David Tolnay8c81f622018-07-31 23:34:35 -07002781#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002782pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002783 TypeBareFn {
David Tolnay3779bb72018-08-26 18:46:07 -07002784 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002785 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002786 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002787 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002788 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002789 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002790 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002791 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002792 }
2793}
David Tolnay8c81f622018-07-31 23:34:35 -07002794#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002795pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002796 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002797 group_token: Group(tokens_helper(_visitor, &_i.group_token.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"))]
2802pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2803 _visitor: &mut V,
2804 _i: TypeImplTrait,
2805) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002806 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002807 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002808 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002809 }
2810}
David Tolnay8c81f622018-07-31 23:34:35 -07002811#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002812pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002813 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002814 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002815 }
2816}
David Tolnay8c81f622018-07-31 23:34:35 -07002817#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002818pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002819 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002820 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002821 }
2822}
David Tolnay8c81f622018-07-31 23:34:35 -07002823#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002824pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002825 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002826 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002827 }
2828}
David Tolnay8c81f622018-07-31 23:34:35 -07002829#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002830pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002831 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002832 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2833 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002834 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002835 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002836 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002837 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002838 }
2839}
David Tolnay8c81f622018-07-31 23:34:35 -07002840#[cfg(any(feature = "full", feature = "derive"))]
2841pub fn fold_type_param_bound<V: Fold + ?Sized>(
2842 _visitor: &mut V,
2843 _i: TypeParamBound,
2844) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002845 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002846 TypeParamBound::Trait(_binding_0) => {
2847 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002848 }
David Tolnay8c81f622018-07-31 23:34:35 -07002849 TypeParamBound::Lifetime(_binding_0) => {
2850 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002851 }
2852 }
2853}
David Tolnay8c81f622018-07-31 23:34:35 -07002854#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002855pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002856 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002857 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002858 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002859 }
2860}
David Tolnay8c81f622018-07-31 23:34:35 -07002861#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002862pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002863 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002864 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2865 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002866 }
2867}
David Tolnay8c81f622018-07-31 23:34:35 -07002868#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002869pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002870 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002871 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2872 const_token: (_i.const_token)
2873 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2874 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002875 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002876 }
2877}
David Tolnay8c81f622018-07-31 23:34:35 -07002878#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002879pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002880 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002881 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002882 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002883 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002884 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002885 }
2886}
David Tolnay8c81f622018-07-31 23:34:35 -07002887#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002888pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002889 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002890 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002891 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002892 }
2893}
David Tolnay8c81f622018-07-31 23:34:35 -07002894#[cfg(any(feature = "full", feature = "derive"))]
2895pub fn fold_type_trait_object<V: Fold + ?Sized>(
2896 _visitor: &mut V,
2897 _i: TypeTraitObject,
2898) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002899 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002900 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002901 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002902 }
2903}
David Tolnay8c81f622018-07-31 23:34:35 -07002904#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002905pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002906 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002907 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002908 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002909 }
2910}
David Tolnay8c81f622018-07-31 23:34:35 -07002911#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002912pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002913 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002914}
David Tolnay8c81f622018-07-31 23:34:35 -07002915#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002916pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002917 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002918 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002919 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002920 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002921 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2922 UnOp::Neg(_binding_0) => {
2923 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2924 }
Nika Layzell27726662017-10-24 23:16:35 -04002925 }
2926}
David Tolnay8c81f622018-07-31 23:34:35 -07002927#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002928pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002929 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002930 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002931 }
2932}
David Tolnay8c81f622018-07-31 23:34:35 -07002933#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002934pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2935 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002936 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002937 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002938 }
2939}
David Tolnay8c81f622018-07-31 23:34:35 -07002940#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002941pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2942 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002943 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002944 }
2945}
David Tolnay8c81f622018-07-31 23:34:35 -07002946#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002947pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002948 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002949 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002950 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002951 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002952 }
2953}
David Tolnay8c81f622018-07-31 23:34:35 -07002954#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002955pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2956 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002957 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002958 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002959 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002960 }
2961}
David Tolnay8c81f622018-07-31 23:34:35 -07002962#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002963pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002964 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002965 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2966 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2967 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2968 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2969 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002970 }
2971}
David Tolnay8c81f622018-07-31 23:34:35 -07002972#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002973pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002974 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002975 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2976 ident: _visitor.fold_ident(_i.ident),
2977 fields: _visitor.fold_fields(_i.fields),
2978 discriminant: (_i.discriminant).map(|it| {
2979 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002980 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002981 _visitor.fold_expr((it).1),
2982 )
2983 }),
Nika Layzell27726662017-10-24 23:16:35 -04002984 }
2985}
David Tolnay8c81f622018-07-31 23:34:35 -07002986#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002987pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002988 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002989 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002990 }
2991}
David Tolnay8c81f622018-07-31 23:34:35 -07002992#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002993pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002994 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04002995 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002996 }
2997}
David Tolnay8c81f622018-07-31 23:34:35 -07002998#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002999pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04003000 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04003001 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
3002 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
3003 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07003004 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04003005 }
3006}
David Tolnay8c81f622018-07-31 23:34:35 -07003007#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003008pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04003009 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003010 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
3011 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
3012 Visibility::Restricted(_binding_0) => {
3013 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003014 }
David Tolnay8c81f622018-07-31 23:34:35 -07003015 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04003016 }
3017}
David Tolnay8c81f622018-07-31 23:34:35 -07003018#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003019pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04003020 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04003021 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07003022 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04003023 }
3024}
David Tolnay8c81f622018-07-31 23:34:35 -07003025#[cfg(any(feature = "full", feature = "derive"))]
3026pub fn fold_where_predicate<V: Fold + ?Sized>(
3027 _visitor: &mut V,
3028 _i: WherePredicate,
3029) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04003030 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003031 WherePredicate::Type(_binding_0) => {
3032 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003033 }
David Tolnay8c81f622018-07-31 23:34:35 -07003034 WherePredicate::Lifetime(_binding_0) => {
3035 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003036 }
David Tolnay8c81f622018-07-31 23:34:35 -07003037 WherePredicate::Eq(_binding_0) => {
3038 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003039 }
3040 }
3041}