blob: 2b65e2e55b2b9c57671066f00e7829ac4bffb635 [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 }
David Tolnay9d0882a2018-09-01 19:49:14 -070096 #[cfg(any(feature = "full", feature = "derive"))]
97 fn fold_constraint(&mut self, i: Constraint) -> Constraint {
98 fold_constraint(self, i)
99 }
David Tolnay8c81f622018-07-31 23:34:35 -0700100 #[cfg(feature = "derive")]
101 fn fold_data(&mut self, i: Data) -> Data {
102 fold_data(self, i)
103 }
104 #[cfg(feature = "derive")]
105 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
106 fold_data_enum(self, i)
107 }
108 #[cfg(feature = "derive")]
109 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
110 fold_data_struct(self, i)
111 }
112 #[cfg(feature = "derive")]
113 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
114 fold_data_union(self, i)
115 }
116 #[cfg(feature = "derive")]
117 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
118 fold_derive_input(self, i)
119 }
120 #[cfg(any(feature = "full", feature = "derive"))]
121 fn fold_expr(&mut self, i: Expr) -> Expr {
122 fold_expr(self, i)
123 }
124 #[cfg(feature = "full")]
125 #[cfg(any(feature = "full", feature = "derive"))]
126 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
127 fold_expr_array(self, i)
128 }
129 #[cfg(feature = "full")]
130 #[cfg(any(feature = "full", feature = "derive"))]
131 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
132 fold_expr_assign(self, i)
133 }
134 #[cfg(feature = "full")]
135 #[cfg(any(feature = "full", feature = "derive"))]
136 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
137 fold_expr_assign_op(self, i)
138 }
David Tolnay02a9c6f2018-08-24 18:58:45 -0400139 #[cfg(feature = "full")]
140 #[cfg(any(feature = "full", feature = "derive"))]
141 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
142 fold_expr_async(self, i)
143 }
David Tolnay8c81f622018-07-31 23:34:35 -0700144 #[cfg(any(feature = "full", feature = "derive"))]
145 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
146 fold_expr_binary(self, i)
147 }
148 #[cfg(feature = "full")]
149 #[cfg(any(feature = "full", feature = "derive"))]
150 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
151 fold_expr_block(self, i)
152 }
153 #[cfg(feature = "full")]
154 #[cfg(any(feature = "full", feature = "derive"))]
155 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
156 fold_expr_box(self, i)
157 }
158 #[cfg(feature = "full")]
159 #[cfg(any(feature = "full", feature = "derive"))]
160 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
161 fold_expr_break(self, i)
162 }
163 #[cfg(any(feature = "full", feature = "derive"))]
164 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
165 fold_expr_call(self, i)
166 }
167 #[cfg(any(feature = "full", feature = "derive"))]
168 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
169 fold_expr_cast(self, i)
170 }
171 #[cfg(feature = "full")]
172 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700173 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
174 fold_expr_closure(self, i)
175 }
176 #[cfg(feature = "full")]
177 #[cfg(any(feature = "full", feature = "derive"))]
178 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
179 fold_expr_continue(self, i)
180 }
181 #[cfg(any(feature = "full", feature = "derive"))]
182 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
183 fold_expr_field(self, i)
184 }
185 #[cfg(feature = "full")]
186 #[cfg(any(feature = "full", feature = "derive"))]
187 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
188 fold_expr_for_loop(self, i)
189 }
190 #[cfg(feature = "full")]
191 #[cfg(any(feature = "full", feature = "derive"))]
192 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
193 fold_expr_group(self, i)
194 }
195 #[cfg(feature = "full")]
196 #[cfg(any(feature = "full", feature = "derive"))]
197 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
198 fold_expr_if(self, i)
199 }
200 #[cfg(feature = "full")]
201 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700202 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
203 fold_expr_in_place(self, i)
204 }
205 #[cfg(any(feature = "full", feature = "derive"))]
206 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
207 fold_expr_index(self, i)
208 }
David Tolnay9c119122018-09-01 18:47:02 -0700209 #[cfg(feature = "full")]
210 #[cfg(any(feature = "full", feature = "derive"))]
211 fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet {
212 fold_expr_let(self, i)
213 }
David Tolnay8c81f622018-07-31 23:34:35 -0700214 #[cfg(any(feature = "full", feature = "derive"))]
215 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
216 fold_expr_lit(self, i)
217 }
218 #[cfg(feature = "full")]
219 #[cfg(any(feature = "full", feature = "derive"))]
220 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
221 fold_expr_loop(self, i)
222 }
223 #[cfg(feature = "full")]
224 #[cfg(any(feature = "full", feature = "derive"))]
225 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
226 fold_expr_macro(self, i)
227 }
228 #[cfg(feature = "full")]
229 #[cfg(any(feature = "full", feature = "derive"))]
230 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
231 fold_expr_match(self, i)
232 }
233 #[cfg(feature = "full")]
234 #[cfg(any(feature = "full", feature = "derive"))]
235 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
236 fold_expr_method_call(self, i)
237 }
238 #[cfg(any(feature = "full", feature = "derive"))]
239 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
240 fold_expr_paren(self, i)
241 }
242 #[cfg(any(feature = "full", feature = "derive"))]
243 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
244 fold_expr_path(self, i)
245 }
246 #[cfg(feature = "full")]
247 #[cfg(any(feature = "full", feature = "derive"))]
248 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
249 fold_expr_range(self, i)
250 }
251 #[cfg(feature = "full")]
252 #[cfg(any(feature = "full", feature = "derive"))]
253 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
254 fold_expr_reference(self, i)
255 }
256 #[cfg(feature = "full")]
257 #[cfg(any(feature = "full", feature = "derive"))]
258 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
259 fold_expr_repeat(self, i)
260 }
261 #[cfg(feature = "full")]
262 #[cfg(any(feature = "full", feature = "derive"))]
263 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
264 fold_expr_return(self, i)
265 }
266 #[cfg(feature = "full")]
267 #[cfg(any(feature = "full", feature = "derive"))]
268 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
269 fold_expr_struct(self, i)
270 }
271 #[cfg(feature = "full")]
272 #[cfg(any(feature = "full", feature = "derive"))]
273 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
274 fold_expr_try(self, i)
275 }
276 #[cfg(feature = "full")]
277 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -0400278 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
279 fold_expr_try_block(self, i)
280 }
281 #[cfg(feature = "full")]
282 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700283 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
284 fold_expr_tuple(self, i)
285 }
286 #[cfg(feature = "full")]
287 #[cfg(any(feature = "full", feature = "derive"))]
288 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
289 fold_expr_type(self, i)
290 }
291 #[cfg(any(feature = "full", feature = "derive"))]
292 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
293 fold_expr_unary(self, i)
294 }
295 #[cfg(feature = "full")]
296 #[cfg(any(feature = "full", feature = "derive"))]
297 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
298 fold_expr_unsafe(self, i)
299 }
300 #[cfg(any(feature = "full", feature = "derive"))]
301 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
302 fold_expr_verbatim(self, i)
303 }
304 #[cfg(feature = "full")]
305 #[cfg(any(feature = "full", feature = "derive"))]
306 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
307 fold_expr_while(self, i)
308 }
309 #[cfg(feature = "full")]
310 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700311 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
312 fold_expr_yield(self, i)
313 }
314 #[cfg(any(feature = "full", feature = "derive"))]
315 fn fold_field(&mut self, i: Field) -> Field {
316 fold_field(self, i)
317 }
318 #[cfg(any(feature = "full", feature = "derive"))]
319 #[cfg(feature = "full")]
320 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
321 fold_field_pat(self, i)
322 }
323 #[cfg(any(feature = "full", feature = "derive"))]
324 #[cfg(feature = "full")]
325 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
326 fold_field_value(self, i)
327 }
328 #[cfg(any(feature = "full", feature = "derive"))]
329 fn fold_fields(&mut self, i: Fields) -> Fields {
330 fold_fields(self, i)
331 }
332 #[cfg(any(feature = "full", feature = "derive"))]
333 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
334 fold_fields_named(self, i)
335 }
336 #[cfg(any(feature = "full", feature = "derive"))]
337 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
338 fold_fields_unnamed(self, i)
339 }
340 #[cfg(feature = "full")]
341 fn fold_file(&mut self, i: File) -> File {
342 fold_file(self, i)
343 }
344 #[cfg(feature = "full")]
345 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
346 fold_fn_arg(self, i)
347 }
348 #[cfg(feature = "full")]
349 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
350 fold_fn_decl(self, i)
351 }
352 #[cfg(feature = "full")]
353 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
354 fold_foreign_item(self, i)
355 }
356 #[cfg(feature = "full")]
357 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
358 fold_foreign_item_fn(self, i)
359 }
360 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400361 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
362 fold_foreign_item_macro(self, i)
363 }
364 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700365 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
366 fold_foreign_item_static(self, i)
367 }
368 #[cfg(feature = "full")]
369 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
370 fold_foreign_item_type(self, i)
371 }
372 #[cfg(feature = "full")]
373 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
374 fold_foreign_item_verbatim(self, i)
375 }
376 #[cfg(any(feature = "full", feature = "derive"))]
377 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
378 fold_generic_argument(self, i)
379 }
380 #[cfg(any(feature = "full", feature = "derive"))]
381 #[cfg(feature = "full")]
382 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
383 fold_generic_method_argument(self, i)
384 }
385 #[cfg(any(feature = "full", feature = "derive"))]
386 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
387 fold_generic_param(self, i)
388 }
389 #[cfg(any(feature = "full", feature = "derive"))]
390 fn fold_generics(&mut self, i: Generics) -> Generics {
391 fold_generics(self, i)
392 }
David Tolnay8c81f622018-07-31 23:34:35 -0700393 fn fold_ident(&mut self, i: Ident) -> Ident {
394 fold_ident(self, i)
395 }
396 #[cfg(feature = "full")]
397 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
398 fold_impl_item(self, i)
399 }
400 #[cfg(feature = "full")]
401 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
402 fold_impl_item_const(self, i)
403 }
404 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400405 fn fold_impl_item_existential(&mut self, i: ImplItemExistential) -> ImplItemExistential {
406 fold_impl_item_existential(self, i)
407 }
408 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700409 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
410 fold_impl_item_macro(self, i)
411 }
412 #[cfg(feature = "full")]
413 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
414 fold_impl_item_method(self, i)
415 }
416 #[cfg(feature = "full")]
417 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
418 fold_impl_item_type(self, i)
419 }
420 #[cfg(feature = "full")]
421 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
422 fold_impl_item_verbatim(self, i)
423 }
424 #[cfg(any(feature = "full", feature = "derive"))]
425 fn fold_index(&mut self, i: Index) -> Index {
426 fold_index(self, i)
427 }
428 #[cfg(feature = "full")]
429 fn fold_item(&mut self, i: Item) -> Item {
430 fold_item(self, i)
431 }
432 #[cfg(feature = "full")]
433 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
434 fold_item_const(self, i)
435 }
436 #[cfg(feature = "full")]
437 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
438 fold_item_enum(self, i)
439 }
440 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400441 fn fold_item_existential(&mut self, i: ItemExistential) -> ItemExistential {
442 fold_item_existential(self, i)
443 }
444 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700445 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
446 fold_item_extern_crate(self, i)
447 }
448 #[cfg(feature = "full")]
449 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
450 fold_item_fn(self, i)
451 }
452 #[cfg(feature = "full")]
453 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
454 fold_item_foreign_mod(self, i)
455 }
456 #[cfg(feature = "full")]
457 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
458 fold_item_impl(self, i)
459 }
460 #[cfg(feature = "full")]
461 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
462 fold_item_macro(self, i)
463 }
464 #[cfg(feature = "full")]
465 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
466 fold_item_macro2(self, i)
467 }
468 #[cfg(feature = "full")]
469 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
470 fold_item_mod(self, i)
471 }
472 #[cfg(feature = "full")]
473 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
474 fold_item_static(self, i)
475 }
476 #[cfg(feature = "full")]
477 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
478 fold_item_struct(self, i)
479 }
480 #[cfg(feature = "full")]
481 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
482 fold_item_trait(self, i)
483 }
484 #[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -0700485 fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias {
486 fold_item_trait_alias(self, i)
487 }
488 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700489 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
490 fold_item_type(self, i)
491 }
492 #[cfg(feature = "full")]
493 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
494 fold_item_union(self, i)
495 }
496 #[cfg(feature = "full")]
497 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
498 fold_item_use(self, i)
499 }
500 #[cfg(feature = "full")]
501 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
502 fold_item_verbatim(self, i)
503 }
504 #[cfg(any(feature = "full", feature = "derive"))]
505 #[cfg(feature = "full")]
506 fn fold_label(&mut self, i: Label) -> Label {
507 fold_label(self, i)
508 }
David Tolnay8c81f622018-07-31 23:34:35 -0700509 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
510 fold_lifetime(self, i)
511 }
512 #[cfg(any(feature = "full", feature = "derive"))]
513 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
514 fold_lifetime_def(self, i)
515 }
516 #[cfg(any(feature = "full", feature = "derive"))]
517 fn fold_lit(&mut self, i: Lit) -> Lit {
518 fold_lit(self, i)
519 }
520 #[cfg(any(feature = "full", feature = "derive"))]
521 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
522 fold_lit_bool(self, i)
523 }
524 #[cfg(any(feature = "full", feature = "derive"))]
525 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
526 fold_lit_byte(self, i)
527 }
528 #[cfg(any(feature = "full", feature = "derive"))]
529 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
530 fold_lit_byte_str(self, i)
531 }
532 #[cfg(any(feature = "full", feature = "derive"))]
533 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
534 fold_lit_char(self, i)
535 }
536 #[cfg(any(feature = "full", feature = "derive"))]
537 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
538 fold_lit_float(self, i)
539 }
540 #[cfg(any(feature = "full", feature = "derive"))]
541 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
542 fold_lit_int(self, i)
543 }
544 #[cfg(any(feature = "full", feature = "derive"))]
545 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
546 fold_lit_str(self, i)
547 }
548 #[cfg(any(feature = "full", feature = "derive"))]
549 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
550 fold_lit_verbatim(self, i)
551 }
552 #[cfg(any(feature = "full", feature = "derive"))]
553 #[cfg(feature = "full")]
554 fn fold_local(&mut self, i: Local) -> Local {
555 fold_local(self, i)
556 }
557 #[cfg(any(feature = "full", feature = "derive"))]
558 fn fold_macro(&mut self, i: Macro) -> Macro {
559 fold_macro(self, i)
560 }
561 #[cfg(any(feature = "full", feature = "derive"))]
562 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
563 fold_macro_delimiter(self, i)
564 }
565 #[cfg(any(feature = "full", feature = "derive"))]
566 fn fold_member(&mut self, i: Member) -> Member {
567 fold_member(self, i)
568 }
569 #[cfg(any(feature = "full", feature = "derive"))]
570 fn fold_meta(&mut self, i: Meta) -> Meta {
571 fold_meta(self, i)
572 }
573 #[cfg(any(feature = "full", feature = "derive"))]
574 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
575 fold_meta_list(self, i)
576 }
577 #[cfg(any(feature = "full", feature = "derive"))]
578 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
579 fold_meta_name_value(self, i)
580 }
581 #[cfg(feature = "full")]
582 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
583 fold_method_sig(self, i)
584 }
585 #[cfg(any(feature = "full", feature = "derive"))]
586 #[cfg(feature = "full")]
587 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
588 fold_method_turbofish(self, i)
589 }
590 #[cfg(any(feature = "full", feature = "derive"))]
591 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
592 fold_nested_meta(self, i)
593 }
594 #[cfg(any(feature = "full", feature = "derive"))]
595 fn fold_parenthesized_generic_arguments(
596 &mut self,
597 i: ParenthesizedGenericArguments,
598 ) -> ParenthesizedGenericArguments {
599 fold_parenthesized_generic_arguments(self, i)
600 }
601 #[cfg(any(feature = "full", feature = "derive"))]
602 #[cfg(feature = "full")]
603 fn fold_pat(&mut self, i: Pat) -> Pat {
604 fold_pat(self, i)
605 }
606 #[cfg(any(feature = "full", feature = "derive"))]
607 #[cfg(feature = "full")]
608 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
609 fold_pat_box(self, i)
610 }
611 #[cfg(any(feature = "full", feature = "derive"))]
612 #[cfg(feature = "full")]
613 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
614 fold_pat_ident(self, i)
615 }
616 #[cfg(any(feature = "full", feature = "derive"))]
617 #[cfg(feature = "full")]
618 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
619 fold_pat_lit(self, i)
620 }
621 #[cfg(any(feature = "full", feature = "derive"))]
622 #[cfg(feature = "full")]
623 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
624 fold_pat_macro(self, i)
625 }
626 #[cfg(any(feature = "full", feature = "derive"))]
627 #[cfg(feature = "full")]
628 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
629 fold_pat_path(self, i)
630 }
631 #[cfg(any(feature = "full", feature = "derive"))]
632 #[cfg(feature = "full")]
633 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
634 fold_pat_range(self, i)
635 }
636 #[cfg(any(feature = "full", feature = "derive"))]
637 #[cfg(feature = "full")]
638 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
639 fold_pat_ref(self, i)
640 }
641 #[cfg(any(feature = "full", feature = "derive"))]
642 #[cfg(feature = "full")]
643 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
644 fold_pat_slice(self, i)
645 }
646 #[cfg(any(feature = "full", feature = "derive"))]
647 #[cfg(feature = "full")]
648 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
649 fold_pat_struct(self, i)
650 }
651 #[cfg(any(feature = "full", feature = "derive"))]
652 #[cfg(feature = "full")]
653 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
654 fold_pat_tuple(self, i)
655 }
656 #[cfg(any(feature = "full", feature = "derive"))]
657 #[cfg(feature = "full")]
658 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
659 fold_pat_tuple_struct(self, i)
660 }
661 #[cfg(any(feature = "full", feature = "derive"))]
662 #[cfg(feature = "full")]
663 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
664 fold_pat_verbatim(self, i)
665 }
666 #[cfg(any(feature = "full", feature = "derive"))]
667 #[cfg(feature = "full")]
668 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
669 fold_pat_wild(self, i)
670 }
671 #[cfg(any(feature = "full", feature = "derive"))]
672 fn fold_path(&mut self, i: Path) -> Path {
673 fold_path(self, i)
674 }
675 #[cfg(any(feature = "full", feature = "derive"))]
676 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
677 fold_path_arguments(self, i)
678 }
679 #[cfg(any(feature = "full", feature = "derive"))]
680 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
681 fold_path_segment(self, i)
682 }
683 #[cfg(any(feature = "full", feature = "derive"))]
684 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
685 fold_predicate_eq(self, i)
686 }
687 #[cfg(any(feature = "full", feature = "derive"))]
688 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
689 fold_predicate_lifetime(self, i)
690 }
691 #[cfg(any(feature = "full", feature = "derive"))]
692 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
693 fold_predicate_type(self, i)
694 }
695 #[cfg(any(feature = "full", feature = "derive"))]
696 fn fold_qself(&mut self, i: QSelf) -> QSelf {
697 fold_qself(self, i)
698 }
699 #[cfg(any(feature = "full", feature = "derive"))]
700 #[cfg(feature = "full")]
701 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
702 fold_range_limits(self, i)
703 }
704 #[cfg(any(feature = "full", feature = "derive"))]
705 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
706 fold_return_type(self, i)
707 }
David Tolnay8c81f622018-07-31 23:34:35 -0700708 fn fold_span(&mut self, i: Span) -> Span {
709 fold_span(self, i)
710 }
711 #[cfg(any(feature = "full", feature = "derive"))]
712 #[cfg(feature = "full")]
713 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
714 fold_stmt(self, i)
715 }
716 #[cfg(any(feature = "full", feature = "derive"))]
717 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
718 fold_trait_bound(self, i)
719 }
720 #[cfg(any(feature = "full", feature = "derive"))]
721 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
722 fold_trait_bound_modifier(self, i)
723 }
724 #[cfg(feature = "full")]
725 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
726 fold_trait_item(self, i)
727 }
728 #[cfg(feature = "full")]
729 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
730 fold_trait_item_const(self, i)
731 }
732 #[cfg(feature = "full")]
733 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
734 fold_trait_item_macro(self, i)
735 }
736 #[cfg(feature = "full")]
737 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
738 fold_trait_item_method(self, i)
739 }
740 #[cfg(feature = "full")]
741 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
742 fold_trait_item_type(self, i)
743 }
744 #[cfg(feature = "full")]
745 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
746 fold_trait_item_verbatim(self, i)
747 }
748 #[cfg(any(feature = "full", feature = "derive"))]
749 fn fold_type(&mut self, i: Type) -> Type {
750 fold_type(self, i)
751 }
752 #[cfg(any(feature = "full", feature = "derive"))]
753 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
754 fold_type_array(self, i)
755 }
756 #[cfg(any(feature = "full", feature = "derive"))]
757 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
758 fold_type_bare_fn(self, i)
759 }
760 #[cfg(any(feature = "full", feature = "derive"))]
761 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
762 fold_type_group(self, i)
763 }
764 #[cfg(any(feature = "full", feature = "derive"))]
765 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
766 fold_type_impl_trait(self, i)
767 }
768 #[cfg(any(feature = "full", feature = "derive"))]
769 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
770 fold_type_infer(self, i)
771 }
772 #[cfg(any(feature = "full", feature = "derive"))]
773 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
774 fold_type_macro(self, i)
775 }
776 #[cfg(any(feature = "full", feature = "derive"))]
777 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
778 fold_type_never(self, i)
779 }
780 #[cfg(any(feature = "full", feature = "derive"))]
781 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
782 fold_type_param(self, i)
783 }
784 #[cfg(any(feature = "full", feature = "derive"))]
785 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
786 fold_type_param_bound(self, i)
787 }
788 #[cfg(any(feature = "full", feature = "derive"))]
789 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
790 fold_type_paren(self, i)
791 }
792 #[cfg(any(feature = "full", feature = "derive"))]
793 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
794 fold_type_path(self, i)
795 }
796 #[cfg(any(feature = "full", feature = "derive"))]
797 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
798 fold_type_ptr(self, i)
799 }
800 #[cfg(any(feature = "full", feature = "derive"))]
801 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
802 fold_type_reference(self, i)
803 }
804 #[cfg(any(feature = "full", feature = "derive"))]
805 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
806 fold_type_slice(self, i)
807 }
808 #[cfg(any(feature = "full", feature = "derive"))]
809 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
810 fold_type_trait_object(self, i)
811 }
812 #[cfg(any(feature = "full", feature = "derive"))]
813 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
814 fold_type_tuple(self, i)
815 }
816 #[cfg(any(feature = "full", feature = "derive"))]
817 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
818 fold_type_verbatim(self, i)
819 }
820 #[cfg(any(feature = "full", feature = "derive"))]
821 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
822 fold_un_op(self, i)
823 }
824 #[cfg(feature = "full")]
825 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
826 fold_use_glob(self, i)
827 }
828 #[cfg(feature = "full")]
829 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
830 fold_use_group(self, i)
831 }
832 #[cfg(feature = "full")]
833 fn fold_use_name(&mut self, i: UseName) -> UseName {
834 fold_use_name(self, i)
835 }
836 #[cfg(feature = "full")]
837 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
838 fold_use_path(self, i)
839 }
840 #[cfg(feature = "full")]
841 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
842 fold_use_rename(self, i)
843 }
844 #[cfg(feature = "full")]
845 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
846 fold_use_tree(self, i)
847 }
848 #[cfg(any(feature = "full", feature = "derive"))]
849 fn fold_variant(&mut self, i: Variant) -> Variant {
850 fold_variant(self, i)
851 }
852 #[cfg(any(feature = "full", feature = "derive"))]
853 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
854 fold_vis_crate(self, i)
855 }
856 #[cfg(any(feature = "full", feature = "derive"))]
857 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
858 fold_vis_public(self, i)
859 }
860 #[cfg(any(feature = "full", feature = "derive"))]
861 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
862 fold_vis_restricted(self, i)
863 }
864 #[cfg(any(feature = "full", feature = "derive"))]
865 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
866 fold_visibility(self, i)
867 }
868 #[cfg(any(feature = "full", feature = "derive"))]
869 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
870 fold_where_clause(self, i)
871 }
872 #[cfg(any(feature = "full", feature = "derive"))]
873 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
874 fold_where_predicate(self, i)
875 }
Nika Layzell27726662017-10-24 23:16:35 -0400876}
David Tolnayd3f32142018-05-20 20:21:12 -0700877#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800878macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700879 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800880 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700881 let span = _visitor.fold_span(_i.span());
882 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800883 _i
884 }
David Tolnay8c81f622018-07-31 23:34:35 -0700885 };
David Tolnayd0adf522017-12-29 01:30:07 -0500886}
David Tolnay360efd22018-01-04 23:35:26 -0800887#[cfg(any(feature = "full", feature = "derive"))]
888fold_span_only!(fold_lit_byte: LitByte);
889#[cfg(any(feature = "full", feature = "derive"))]
890fold_span_only!(fold_lit_byte_str: LitByteStr);
891#[cfg(any(feature = "full", feature = "derive"))]
892fold_span_only!(fold_lit_char: LitChar);
893#[cfg(any(feature = "full", feature = "derive"))]
894fold_span_only!(fold_lit_float: LitFloat);
895#[cfg(any(feature = "full", feature = "derive"))]
896fold_span_only!(fold_lit_int: LitInt);
897#[cfg(any(feature = "full", feature = "derive"))]
898fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700899#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800900pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400901 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400902 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700903 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400904 }
905}
David Tolnay8c81f622018-07-31 23:34:35 -0700906#[cfg(any(feature = "full", feature = "derive"))]
907pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
908 _visitor: &mut V,
909 _i: AngleBracketedGenericArguments,
910) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500911 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400912 colon2_token: (_i.colon2_token)
913 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
914 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700915 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400916 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400917 }
918}
David Tolnay8c81f622018-07-31 23:34:35 -0700919#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800920pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400921 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700922 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400923 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700924 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400925 }
926}
David Tolnay8c81f622018-07-31 23:34:35 -0700927#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800928pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400929 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400930 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
931 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400932 }
933}
David Tolnay8c81f622018-07-31 23:34:35 -0700934#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800935pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400936 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400937 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700938 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400939 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
940 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400941 }
942}
David Tolnay8c81f622018-07-31 23:34:35 -0700943#[cfg(any(feature = "full", feature = "derive"))]
944#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800945pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400946 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700947 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400948 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700949 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
950 guard: (_i.guard).map(|it| {
951 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400952 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700953 Box::new(_visitor.fold_expr(*(it).1)),
954 )
955 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400956 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700957 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400958 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400959 }
960}
David Tolnay8c81f622018-07-31 23:34:35 -0700961#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800962pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400963 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700964 AttrStyle::Outer => AttrStyle::Outer,
965 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400966 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400967 }
968 }
969}
David Tolnay8c81f622018-07-31 23:34:35 -0700970#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800971pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400972 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400973 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700974 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400975 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700976 path: _visitor.fold_path(_i.path),
977 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400978 }
979}
David Tolnay8c81f622018-07-31 23:34:35 -0700980#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800981pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400982 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700983 name: (_i.name).map(|it| {
984 (
985 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400986 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700987 )
988 }),
989 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400990 }
991}
David Tolnay8c81f622018-07-31 23:34:35 -0700992#[cfg(any(feature = "full", feature = "derive"))]
993pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
994 _visitor: &mut V,
995 _i: BareFnArgName,
996) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400997 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700998 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
999 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001000 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001001 }
1002 }
1003}
David Tolnay8c81f622018-07-31 23:34:35 -07001004#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001005pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -04001006 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001007 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001008 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001009 }
David Tolnay8c81f622018-07-31 23:34:35 -07001010 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001011 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001012 }
David Tolnay8c81f622018-07-31 23:34:35 -07001013 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001014 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001015 }
David Tolnay8c81f622018-07-31 23:34:35 -07001016 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001017 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001018 }
David Tolnay8c81f622018-07-31 23:34:35 -07001019 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001020 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001021 }
David Tolnay8c81f622018-07-31 23:34:35 -07001022 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001023 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001024 }
David Tolnay8c81f622018-07-31 23:34:35 -07001025 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001026 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001027 }
David Tolnay8c81f622018-07-31 23:34:35 -07001028 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001029 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001030 }
David Tolnay8c81f622018-07-31 23:34:35 -07001031 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001032 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001033 }
David Tolnay8c81f622018-07-31 23:34:35 -07001034 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001035 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001036 }
David Tolnay8c81f622018-07-31 23:34:35 -07001037 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001038 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001039 }
David Tolnay8c81f622018-07-31 23:34:35 -07001040 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001041 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001042 }
David Tolnay8c81f622018-07-31 23:34:35 -07001043 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001044 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001045 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001046 BinOp::Lt(_binding_0) => {
1047 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1048 }
David Tolnay8c81f622018-07-31 23:34:35 -07001049 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001050 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001051 }
David Tolnay8c81f622018-07-31 23:34:35 -07001052 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001053 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001054 }
David Tolnay8c81f622018-07-31 23:34:35 -07001055 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001056 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001057 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001058 BinOp::Gt(_binding_0) => {
1059 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1060 }
David Tolnay8c81f622018-07-31 23:34:35 -07001061 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001062 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001063 }
David Tolnay8c81f622018-07-31 23:34:35 -07001064 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001065 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001066 }
David Tolnay8c81f622018-07-31 23:34:35 -07001067 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001068 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001069 }
David Tolnay8c81f622018-07-31 23:34:35 -07001070 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001071 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001072 }
David Tolnay8c81f622018-07-31 23:34:35 -07001073 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001074 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001075 }
David Tolnay8c81f622018-07-31 23:34:35 -07001076 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001077 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001078 }
David Tolnay8c81f622018-07-31 23:34:35 -07001079 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001080 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001081 }
David Tolnay8c81f622018-07-31 23:34:35 -07001082 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001083 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001084 }
David Tolnay8c81f622018-07-31 23:34:35 -07001085 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001086 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001087 }
David Tolnay8c81f622018-07-31 23:34:35 -07001088 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001089 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001090 }
1091 }
1092}
David Tolnay8c81f622018-07-31 23:34:35 -07001093#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001094pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001095 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001096 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001097 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001098 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001099 }
1100}
David Tolnay8c81f622018-07-31 23:34:35 -07001101#[cfg(any(feature = "full", feature = "derive"))]
1102#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001103pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001104 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001105 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001106 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001107 }
1108}
David Tolnay8c81f622018-07-31 23:34:35 -07001109#[cfg(any(feature = "full", feature = "derive"))]
1110pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1111 _visitor: &mut V,
1112 _i: BoundLifetimes,
1113) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001114 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001115 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1116 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001117 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001118 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001119 }
1120}
David Tolnay8c81f622018-07-31 23:34:35 -07001121#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001122pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001123 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001124 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001125 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001126 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001127 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001128 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001129 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001130 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001131 }
1132}
David Tolnay9d0882a2018-09-01 19:49:14 -07001133#[cfg(any(feature = "full", feature = "derive"))]
1134pub fn fold_constraint<V: Fold + ?Sized>(_visitor: &mut V, _i: Constraint) -> Constraint {
1135 Constraint {
1136 ident: _visitor.fold_ident(_i.ident),
1137 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
1138 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1139 }
1140}
David Tolnay8c81f622018-07-31 23:34:35 -07001141#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001142pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001143 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001144 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1145 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1146 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001147 }
1148}
David Tolnay8c81f622018-07-31 23:34:35 -07001149#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001150pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001151 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001152 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1153 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001154 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001155 }
1156}
David Tolnay8c81f622018-07-31 23:34:35 -07001157#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001158pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001159 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001160 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001161 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001162 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001163 }
1164}
David Tolnay8c81f622018-07-31 23:34:35 -07001165#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001166pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001167 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001168 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001169 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001170 }
1171}
David Tolnay8c81f622018-07-31 23:34:35 -07001172#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001173pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001174 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001175 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1176 vis: _visitor.fold_visibility(_i.vis),
1177 ident: _visitor.fold_ident(_i.ident),
1178 generics: _visitor.fold_generics(_i.generics),
1179 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001180 }
1181}
David Tolnay8c81f622018-07-31 23:34:35 -07001182#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001183pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001184 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001185 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1186 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1187 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1188 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1189 Expr::MethodCall(_binding_0) => {
1190 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001191 }
David Tolnay8c81f622018-07-31 23:34:35 -07001192 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1193 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1194 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1195 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1196 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1197 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
David Tolnay9c119122018-09-01 18:47:02 -07001198 Expr::Let(_binding_0) => Expr::Let(full!(_visitor.fold_expr_let(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001199 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001200 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001201 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1202 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1203 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1204 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1205 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1206 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1207 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1208 Expr::AssignOp(_binding_0) => {
1209 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001210 }
David Tolnay8c81f622018-07-31 23:34:35 -07001211 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1212 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1213 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1214 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1215 Expr::Reference(_binding_0) => {
1216 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001217 }
David Tolnay8c81f622018-07-31 23:34:35 -07001218 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1219 Expr::Continue(_binding_0) => {
1220 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001221 }
David Tolnay8c81f622018-07-31 23:34:35 -07001222 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1223 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1224 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1225 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1226 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1227 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1228 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001229 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001230 Expr::TryBlock(_binding_0) => {
1231 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1232 }
David Tolnay8c81f622018-07-31 23:34:35 -07001233 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1234 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001235 }
1236}
David Tolnay8c81f622018-07-31 23:34:35 -07001237#[cfg(feature = "full")]
1238#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001239pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001240 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001241 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001242 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001243 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001244 }
1245}
David Tolnay8c81f622018-07-31 23:34:35 -07001246#[cfg(feature = "full")]
1247#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001248pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001249 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001250 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1251 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001252 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001253 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001254 }
1255}
David Tolnay8c81f622018-07-31 23:34:35 -07001256#[cfg(feature = "full")]
1257#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001258pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001259 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001260 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1261 left: Box::new(_visitor.fold_expr(*_i.left)),
1262 op: _visitor.fold_bin_op(_i.op),
1263 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001264 }
1265}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001266#[cfg(feature = "full")]
1267#[cfg(any(feature = "full", feature = "derive"))]
1268pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1269 ExprAsync {
1270 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1271 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
1272 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1273 block: _visitor.fold_block(_i.block),
1274 }
1275}
David Tolnay8c81f622018-07-31 23:34:35 -07001276#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001277pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001278 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001279 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1280 left: Box::new(_visitor.fold_expr(*_i.left)),
1281 op: _visitor.fold_bin_op(_i.op),
1282 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001283 }
1284}
David Tolnay8c81f622018-07-31 23:34:35 -07001285#[cfg(feature = "full")]
1286#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001287pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001288 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001289 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001290 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001291 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001292 }
1293}
David Tolnay8c81f622018-07-31 23:34:35 -07001294#[cfg(feature = "full")]
1295#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001296pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001297 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001298 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001299 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001300 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001301 }
1302}
David Tolnay8c81f622018-07-31 23:34:35 -07001303#[cfg(feature = "full")]
1304#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001305pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001306 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001307 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001308 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001309 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1310 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001311 }
1312}
David Tolnay8c81f622018-07-31 23:34:35 -07001313#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001314pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001315 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001316 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1317 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001318 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001319 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001320 }
1321}
David Tolnay8c81f622018-07-31 23:34:35 -07001322#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001323pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001324 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001325 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1326 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001327 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001328 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001329 }
1330}
David Tolnay8c81f622018-07-31 23:34:35 -07001331#[cfg(feature = "full")]
1332#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001333pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001334 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001335 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001336 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001337 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1338 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1339 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001340 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001341 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001342 output: _visitor.fold_return_type(_i.output),
1343 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001344 }
1345}
David Tolnay8c81f622018-07-31 23:34:35 -07001346#[cfg(feature = "full")]
1347#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001348pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001349 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001350 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001351 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001352 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001353 }
1354}
David Tolnay8c81f622018-07-31 23:34:35 -07001355#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001356pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001357 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001358 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1359 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001360 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001361 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001362 }
1363}
David Tolnay8c81f622018-07-31 23:34:35 -07001364#[cfg(feature = "full")]
1365#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001366pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001367 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001368 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1369 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001370 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001371 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001372 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001373 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1374 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001375 }
1376}
David Tolnay8c81f622018-07-31 23:34:35 -07001377#[cfg(feature = "full")]
1378#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001379pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001380 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001381 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001382 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001383 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001384 }
1385}
David Tolnay8c81f622018-07-31 23:34:35 -07001386#[cfg(feature = "full")]
1387#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001388pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001389 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001390 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001391 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001392 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1393 then_branch: _visitor.fold_block(_i.then_branch),
1394 else_branch: (_i.else_branch).map(|it| {
1395 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001396 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001397 Box::new(_visitor.fold_expr(*(it).1)),
1398 )
1399 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001400 }
1401}
David Tolnay8c81f622018-07-31 23:34:35 -07001402#[cfg(feature = "full")]
1403#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001404pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001405 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001406 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1407 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001408 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001409 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001410 }
1411}
David Tolnay8c81f622018-07-31 23:34:35 -07001412#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001413pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001414 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001415 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1416 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001417 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001418 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001419 }
1420}
David Tolnay9c119122018-09-01 18:47:02 -07001421#[cfg(feature = "full")]
1422#[cfg(any(feature = "full", feature = "derive"))]
1423pub fn fold_expr_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLet) -> ExprLet {
1424 ExprLet {
1425 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1426 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
1427 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
1428 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
1429 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1430 }
1431}
David Tolnay8c81f622018-07-31 23:34:35 -07001432#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001433pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001434 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001435 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1436 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001437 }
1438}
David Tolnay8c81f622018-07-31 23:34:35 -07001439#[cfg(feature = "full")]
1440#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001441pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001442 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001443 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1444 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001445 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001446 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001447 }
1448}
David Tolnay8c81f622018-07-31 23:34:35 -07001449#[cfg(feature = "full")]
1450#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001451pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001452 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001453 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1454 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001455 }
1456}
David Tolnay8c81f622018-07-31 23:34:35 -07001457#[cfg(feature = "full")]
1458#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001459pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001460 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001461 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001462 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001463 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001464 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001465 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001466 }
1467}
David Tolnay8c81f622018-07-31 23:34:35 -07001468#[cfg(feature = "full")]
1469#[cfg(any(feature = "full", feature = "derive"))]
1470pub fn fold_expr_method_call<V: Fold + ?Sized>(
1471 _visitor: &mut V,
1472 _i: ExprMethodCall,
1473) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001474 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001475 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1476 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001477 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001478 method: _visitor.fold_ident(_i.method),
1479 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001480 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001481 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001482 }
1483}
David Tolnay8c81f622018-07-31 23:34:35 -07001484#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001485pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001486 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001487 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001488 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001489 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001490 }
1491}
David Tolnay8c81f622018-07-31 23:34:35 -07001492#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001493pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001494 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001495 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1496 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1497 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001498 }
1499}
David Tolnay8c81f622018-07-31 23:34:35 -07001500#[cfg(feature = "full")]
1501#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001502pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001503 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001504 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1505 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1506 limits: _visitor.fold_range_limits(_i.limits),
1507 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001508 }
1509}
David Tolnay8c81f622018-07-31 23:34:35 -07001510#[cfg(feature = "full")]
1511#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001512pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1513 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001514 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001515 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1516 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001517 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001518 }
1519}
David Tolnay8c81f622018-07-31 23:34:35 -07001520#[cfg(feature = "full")]
1521#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001522pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001523 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001524 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001525 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001526 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001527 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001528 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001529 }
1530}
David Tolnay8c81f622018-07-31 23:34:35 -07001531#[cfg(feature = "full")]
1532#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001533pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001534 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001535 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001536 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001537 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001538 }
1539}
David Tolnay8c81f622018-07-31 23:34:35 -07001540#[cfg(feature = "full")]
1541#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001542pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001543 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001544 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1545 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001546 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001547 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001548 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001549 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001550 }
1551}
David Tolnay8c81f622018-07-31 23:34:35 -07001552#[cfg(feature = "full")]
1553#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001554pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001555 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001556 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1557 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001558 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001559 }
1560}
David Tolnay8c81f622018-07-31 23:34:35 -07001561#[cfg(feature = "full")]
1562#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001563pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1564 ExprTryBlock {
1565 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1566 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1567 block: _visitor.fold_block(_i.block),
1568 }
1569}
1570#[cfg(feature = "full")]
1571#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001572pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001573 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001574 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001575 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001576 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001577 }
1578}
David Tolnay8c81f622018-07-31 23:34:35 -07001579#[cfg(feature = "full")]
1580#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001581pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001582 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001583 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1584 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001585 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001586 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001587 }
1588}
David Tolnay8c81f622018-07-31 23:34:35 -07001589#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001590pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001591 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001592 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1593 op: _visitor.fold_un_op(_i.op),
1594 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001595 }
1596}
David Tolnay8c81f622018-07-31 23:34:35 -07001597#[cfg(feature = "full")]
1598#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001599pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001600 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001601 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001602 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001603 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001604 }
1605}
David Tolnay8c81f622018-07-31 23:34:35 -07001606#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001607pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001608 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001609}
David Tolnay8c81f622018-07-31 23:34:35 -07001610#[cfg(feature = "full")]
1611#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001612pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001613 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001614 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1615 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001616 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001617 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1618 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001619 }
1620}
David Tolnay8c81f622018-07-31 23:34:35 -07001621#[cfg(feature = "full")]
1622#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001623pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001624 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001625 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001626 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001627 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001628 }
1629}
David Tolnay8c81f622018-07-31 23:34:35 -07001630#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001631pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001632 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001633 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1634 vis: _visitor.fold_visibility(_i.vis),
1635 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001636 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001637 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001638 }
1639}
David Tolnay8c81f622018-07-31 23:34:35 -07001640#[cfg(any(feature = "full", feature = "derive"))]
1641#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001642pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001643 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001644 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1645 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001646 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001647 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001648 }
1649}
David Tolnay8c81f622018-07-31 23:34:35 -07001650#[cfg(any(feature = "full", feature = "derive"))]
1651#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001652pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001653 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001654 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1655 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001656 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001657 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001658 }
1659}
David Tolnay8c81f622018-07-31 23:34:35 -07001660#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001661pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001662 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001663 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1664 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1665 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001666 }
1667}
David Tolnay8c81f622018-07-31 23:34:35 -07001668#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001669pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001670 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001671 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001672 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001673 }
1674}
David Tolnay8c81f622018-07-31 23:34:35 -07001675#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001676pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001677 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001678 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001679 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001680 }
1681}
David Tolnay8c81f622018-07-31 23:34:35 -07001682#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001683pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001684 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001685 shebang: _i.shebang,
1686 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1687 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001688 }
1689}
David Tolnay8c81f622018-07-31 23:34:35 -07001690#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001691pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001692 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001693 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1694 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1695 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1696 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1697 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001698 }
1699}
David Tolnay8c81f622018-07-31 23:34:35 -07001700#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001701pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001702 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001703 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001704 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001705 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001706 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001707 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001708 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001709 }
1710}
David Tolnay8c81f622018-07-31 23:34:35 -07001711#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001712pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001713 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001714 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1715 ForeignItem::Static(_binding_0) => {
1716 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001717 }
David Tolnay8c81f622018-07-31 23:34:35 -07001718 ForeignItem::Type(_binding_0) => {
1719 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001720 }
David Tolnay435c1782018-08-24 16:15:44 -04001721 ForeignItem::Macro(_binding_0) => {
1722 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1723 }
David Tolnay8c81f622018-07-31 23:34:35 -07001724 ForeignItem::Verbatim(_binding_0) => {
1725 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001726 }
Nika Layzell27726662017-10-24 23:16:35 -04001727 }
1728}
David Tolnay8c81f622018-07-31 23:34:35 -07001729#[cfg(feature = "full")]
1730pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1731 _visitor: &mut V,
1732 _i: ForeignItemFn,
1733) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001734 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001735 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1736 vis: _visitor.fold_visibility(_i.vis),
1737 ident: _visitor.fold_ident(_i.ident),
1738 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001739 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001740 }
1741}
David Tolnay8c81f622018-07-31 23:34:35 -07001742#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001743pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1744 _visitor: &mut V,
1745 _i: ForeignItemMacro,
1746) -> ForeignItemMacro {
1747 ForeignItemMacro {
1748 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1749 mac: _visitor.fold_macro(_i.mac),
1750 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1751 }
1752}
1753#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001754pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1755 _visitor: &mut V,
1756 _i: ForeignItemStatic,
1757) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001758 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001759 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1760 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001761 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1762 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001763 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001764 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001765 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001766 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001767 }
1768}
David Tolnay8c81f622018-07-31 23:34:35 -07001769#[cfg(feature = "full")]
1770pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1771 _visitor: &mut V,
1772 _i: ForeignItemType,
1773) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001774 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001775 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1776 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001777 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001778 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001779 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001780 }
1781}
David Tolnay8c81f622018-07-31 23:34:35 -07001782#[cfg(feature = "full")]
1783pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1784 _visitor: &mut V,
1785 _i: ForeignItemVerbatim,
1786) -> ForeignItemVerbatim {
1787 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001788}
David Tolnay8c81f622018-07-31 23:34:35 -07001789#[cfg(any(feature = "full", feature = "derive"))]
1790pub fn fold_generic_argument<V: Fold + ?Sized>(
1791 _visitor: &mut V,
1792 _i: GenericArgument,
1793) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001794 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001795 GenericArgument::Lifetime(_binding_0) => {
1796 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001797 }
David Tolnay8c81f622018-07-31 23:34:35 -07001798 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1799 GenericArgument::Binding(_binding_0) => {
1800 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001801 }
David Tolnay9d0882a2018-09-01 19:49:14 -07001802 GenericArgument::Constraint(_binding_0) => {
1803 GenericArgument::Constraint(_visitor.fold_constraint(_binding_0))
1804 }
David Tolnay8c81f622018-07-31 23:34:35 -07001805 GenericArgument::Const(_binding_0) => {
1806 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001807 }
Nika Layzell357885a2017-12-04 15:47:07 -05001808 }
1809}
David Tolnay8c81f622018-07-31 23:34:35 -07001810#[cfg(any(feature = "full", feature = "derive"))]
1811#[cfg(feature = "full")]
1812pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1813 _visitor: &mut V,
1814 _i: GenericMethodArgument,
1815) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001816 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001817 GenericMethodArgument::Type(_binding_0) => {
1818 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001819 }
David Tolnay8c81f622018-07-31 23:34:35 -07001820 GenericMethodArgument::Const(_binding_0) => {
1821 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001822 }
1823 }
1824}
David Tolnay8c81f622018-07-31 23:34:35 -07001825#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001826pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001827 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001828 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1829 GenericParam::Lifetime(_binding_0) => {
1830 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001831 }
David Tolnay8c81f622018-07-31 23:34:35 -07001832 GenericParam::Const(_binding_0) => {
1833 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001834 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001835 }
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_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001839 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001840 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001841 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001842 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001843 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001844 }
1845}
Alex Crichtond261d092018-05-18 13:47:35 -07001846pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001847 let mut _i = _i;
1848 let span = _visitor.fold_span(_i.span());
1849 _i.set_span(span);
1850 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001851}
David Tolnay8c81f622018-07-31 23:34:35 -07001852#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001853pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001854 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001855 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1856 ImplItem::Method(_binding_0) => {
1857 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001858 }
David Tolnay8c81f622018-07-31 23:34:35 -07001859 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001860 ImplItem::Existential(_binding_0) => {
1861 ImplItem::Existential(_visitor.fold_impl_item_existential(_binding_0))
1862 }
David Tolnay8c81f622018-07-31 23:34:35 -07001863 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1864 ImplItem::Verbatim(_binding_0) => {
1865 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001866 }
Nika Layzell27726662017-10-24 23:16:35 -04001867 }
1868}
David Tolnay8c81f622018-07-31 23:34:35 -07001869#[cfg(feature = "full")]
1870pub fn fold_impl_item_const<V: Fold + ?Sized>(
1871 _visitor: &mut V,
1872 _i: ImplItemConst,
1873) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001874 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001875 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1876 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001877 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1878 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001879 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001880 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001881 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001882 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001883 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001884 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001885 }
1886}
David Tolnay8c81f622018-07-31 23:34:35 -07001887#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001888pub fn fold_impl_item_existential<V: Fold + ?Sized>(
1889 _visitor: &mut V,
1890 _i: ImplItemExistential,
1891) -> ImplItemExistential {
1892 ImplItemExistential {
1893 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1894 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
1895 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
1896 ident: _visitor.fold_ident(_i.ident),
1897 generics: _visitor.fold_generics(_i.generics),
1898 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1899 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1900 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1901 }
1902}
1903#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001904pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1905 _visitor: &mut V,
1906 _i: ImplItemMacro,
1907) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001908 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001909 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1910 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001911 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001912 }
1913}
David Tolnay8c81f622018-07-31 23:34:35 -07001914#[cfg(feature = "full")]
1915pub fn fold_impl_item_method<V: Fold + ?Sized>(
1916 _visitor: &mut V,
1917 _i: ImplItemMethod,
1918) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001919 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001920 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1921 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001922 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001923 sig: _visitor.fold_method_sig(_i.sig),
1924 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001925 }
1926}
David Tolnay8c81f622018-07-31 23:34:35 -07001927#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001928pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001929 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001930 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1931 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001932 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1933 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001934 ident: _visitor.fold_ident(_i.ident),
1935 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001936 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001937 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001938 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001939 }
1940}
David Tolnay8c81f622018-07-31 23:34:35 -07001941#[cfg(feature = "full")]
1942pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1943 _visitor: &mut V,
1944 _i: ImplItemVerbatim,
1945) -> ImplItemVerbatim {
1946 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001947}
David Tolnay8c81f622018-07-31 23:34:35 -07001948#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001949pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001950 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001951 index: _i.index,
1952 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001953 }
1954}
David Tolnay8c81f622018-07-31 23:34:35 -07001955#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001956pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001957 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001958 Item::ExternCrate(_binding_0) => {
1959 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001960 }
David Tolnay8c81f622018-07-31 23:34:35 -07001961 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1962 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1963 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1964 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1965 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1966 Item::ForeignMod(_binding_0) => {
1967 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001968 }
David Tolnay8c81f622018-07-31 23:34:35 -07001969 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001970 Item::Existential(_binding_0) => {
1971 Item::Existential(_visitor.fold_item_existential(_binding_0))
1972 }
David Tolnay8c81f622018-07-31 23:34:35 -07001973 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1974 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1975 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1976 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07001977 Item::TraitAlias(_binding_0) => {
1978 Item::TraitAlias(_visitor.fold_item_trait_alias(_binding_0))
1979 }
David Tolnay8c81f622018-07-31 23:34:35 -07001980 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1981 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1982 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1983 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001984 }
1985}
David Tolnay8c81f622018-07-31 23:34:35 -07001986#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001987pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001988 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001989 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1990 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001991 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001992 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001993 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001994 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001995 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001996 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001997 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001998 }
1999}
David Tolnay8c81f622018-07-31 23:34:35 -07002000#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002001pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002002 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07002003 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2004 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002005 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002006 ident: _visitor.fold_ident(_i.ident),
2007 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002008 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002009 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002010 }
2011}
David Tolnay8c81f622018-07-31 23:34:35 -07002012#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04002013pub fn fold_item_existential<V: Fold + ?Sized>(
2014 _visitor: &mut V,
2015 _i: ItemExistential,
2016) -> ItemExistential {
2017 ItemExistential {
2018 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2019 vis: _visitor.fold_visibility(_i.vis),
2020 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
2021 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
2022 ident: _visitor.fold_ident(_i.ident),
2023 generics: _visitor.fold_generics(_i.generics),
2024 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
2025 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2026 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2027 }
2028}
2029#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07002030pub fn fold_item_extern_crate<V: Fold + ?Sized>(
2031 _visitor: &mut V,
2032 _i: ItemExternCrate,
2033) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002034 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07002035 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2036 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002037 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
2038 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002039 ident: _visitor.fold_ident(_i.ident),
2040 rename: (_i.rename).map(|it| {
2041 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002042 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002043 _visitor.fold_ident((it).1),
2044 )
2045 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002046 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002047 }
2048}
David Tolnay8c81f622018-07-31 23:34:35 -07002049#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002050pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002051 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07002052 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2053 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002054 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2055 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002056 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002057 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2058 ident: _visitor.fold_ident(_i.ident),
2059 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2060 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002061 }
2062}
David Tolnay8c81f622018-07-31 23:34:35 -07002063#[cfg(feature = "full")]
2064pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2065 _visitor: &mut V,
2066 _i: ItemForeignMod,
2067) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002068 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002069 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2070 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002071 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002072 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002073 }
2074}
David Tolnay8c81f622018-07-31 23:34:35 -07002075#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002076pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002077 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002078 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002079 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2080 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2081 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002082 generics: _visitor.fold_generics(_i.generics),
2083 trait_: (_i.trait_).map(|it| {
2084 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002085 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002086 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002087 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002088 )
2089 }),
2090 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002091 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002092 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002093 }
2094}
David Tolnay8c81f622018-07-31 23:34:35 -07002095#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002096pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002097 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002098 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2099 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2100 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002101 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
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_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002106 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002107 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2108 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002109 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002110 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002111 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002112 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002113 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002114 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002115 }
2116}
David Tolnay8c81f622018-07-31 23:34:35 -07002117#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002118pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002119 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002120 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2121 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002122 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002123 ident: _visitor.fold_ident(_i.ident),
2124 content: (_i.content).map(|it| {
2125 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002126 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002127 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2128 )
2129 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002130 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002131 }
2132}
David Tolnay8c81f622018-07-31 23:34:35 -07002133#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002134pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002135 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002136 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2137 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002138 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2139 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002140 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002141 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002142 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002143 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002144 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002145 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002146 }
2147}
David Tolnay8c81f622018-07-31 23:34:35 -07002148#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002149pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002150 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002151 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2152 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002153 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002154 ident: _visitor.fold_ident(_i.ident),
2155 generics: _visitor.fold_generics(_i.generics),
2156 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002157 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002158 }
2159}
David Tolnay8c81f622018-07-31 23:34:35 -07002160#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002161pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002162 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002163 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2164 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002165 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2166 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2167 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002168 ident: _visitor.fold_ident(_i.ident),
2169 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002170 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002171 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002172 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002173 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002174 }
2175}
David Tolnay8c81f622018-07-31 23:34:35 -07002176#[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -07002177pub fn fold_item_trait_alias<V: Fold + ?Sized>(
2178 _visitor: &mut V,
2179 _i: ItemTraitAlias,
2180) -> ItemTraitAlias {
2181 ItemTraitAlias {
2182 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2183 vis: _visitor.fold_visibility(_i.vis),
2184 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
2185 ident: _visitor.fold_ident(_i.ident),
2186 generics: _visitor.fold_generics(_i.generics),
2187 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
2188 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2189 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2190 }
2191}
2192#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002193pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002194 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002195 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2196 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002197 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002198 ident: _visitor.fold_ident(_i.ident),
2199 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002200 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002201 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002202 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002203 }
2204}
David Tolnay8c81f622018-07-31 23:34:35 -07002205#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002206pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002207 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002208 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2209 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002210 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002211 ident: _visitor.fold_ident(_i.ident),
2212 generics: _visitor.fold_generics(_i.generics),
2213 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002214 }
2215}
David Tolnay8c81f622018-07-31 23:34:35 -07002216#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002217pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002218 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002219 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2220 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002221 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002222 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002223 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002224 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002225 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002226 }
2227}
David Tolnay8c81f622018-07-31 23:34:35 -07002228#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002229pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002230 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002231}
David Tolnay8c81f622018-07-31 23:34:35 -07002232#[cfg(any(feature = "full", feature = "derive"))]
2233#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002234pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002235 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002236 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002237 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002238 }
2239}
Alex Crichton131308c2018-05-18 14:00:24 -07002240pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2241 Lifetime {
David Tolnay17f63892018-08-31 10:36:32 -07002242 apostrophe: _visitor.fold_span(_i.apostrophe),
David Tolnay8c81f622018-07-31 23:34:35 -07002243 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002244 }
2245}
David Tolnay8c81f622018-07-31 23:34:35 -07002246#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002247pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002248 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002249 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2250 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002251 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002252 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002253 }
2254}
David Tolnay8c81f622018-07-31 23:34:35 -07002255#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002256pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002257 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002258 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2259 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2260 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2261 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2262 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2263 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2264 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2265 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002266 }
2267}
David Tolnay8c81f622018-07-31 23:34:35 -07002268#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002269pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002270 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002271 value: _i.value,
2272 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002273 }
2274}
David Tolnay8c81f622018-07-31 23:34:35 -07002275#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002276pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002277 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002278}
David Tolnay8c81f622018-07-31 23:34:35 -07002279#[cfg(any(feature = "full", feature = "derive"))]
2280#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002281pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002282 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002283 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002284 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002285 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2286 ty: (_i.ty).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_type(*(it).1)),
2290 )
2291 }),
2292 init: (_i.init).map(|it| {
2293 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002294 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002295 Box::new(_visitor.fold_expr(*(it).1)),
2296 )
2297 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002298 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002299 }
2300}
David Tolnay8c81f622018-07-31 23:34:35 -07002301#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002302pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002303 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002304 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002305 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002306 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2307 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002308 }
2309}
David Tolnay8c81f622018-07-31 23:34:35 -07002310#[cfg(any(feature = "full", feature = "derive"))]
2311pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2312 _visitor: &mut V,
2313 _i: MacroDelimiter,
2314) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002315 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002316 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002317 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002318 }
David Tolnay8c81f622018-07-31 23:34:35 -07002319 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002320 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002321 }
David Tolnay8c81f622018-07-31 23:34:35 -07002322 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002323 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002324 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002325 }
2326}
David Tolnay8c81f622018-07-31 23:34:35 -07002327#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002328pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002329 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002330 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2331 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002332 }
2333}
David Tolnay8c81f622018-07-31 23:34:35 -07002334#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002335pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002336 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002337 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2338 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2339 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002340 }
2341}
David Tolnay8c81f622018-07-31 23:34:35 -07002342#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002343pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2344 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002345 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002346 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002347 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002348 }
2349}
David Tolnay8c81f622018-07-31 23:34:35 -07002350#[cfg(any(feature = "full", feature = "derive"))]
2351pub fn fold_meta_name_value<V: Fold + ?Sized>(
2352 _visitor: &mut V,
2353 _i: MetaNameValue,
2354) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002355 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002356 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002357 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002358 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002359 }
2360}
David Tolnay8c81f622018-07-31 23:34:35 -07002361#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002362pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002363 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002364 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2365 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002366 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002367 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2368 ident: _visitor.fold_ident(_i.ident),
2369 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002370 }
2371}
David Tolnay8c81f622018-07-31 23:34:35 -07002372#[cfg(any(feature = "full", feature = "derive"))]
2373#[cfg(feature = "full")]
2374pub fn fold_method_turbofish<V: Fold + ?Sized>(
2375 _visitor: &mut V,
2376 _i: MethodTurbofish,
2377) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002378 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002379 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2380 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002381 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002382 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002383 }
2384}
David Tolnay8c81f622018-07-31 23:34:35 -07002385#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002386pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002387 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002388 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2389 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002390 }
2391}
David Tolnay8c81f622018-07-31 23:34:35 -07002392#[cfg(any(feature = "full", feature = "derive"))]
2393pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2394 _visitor: &mut V,
2395 _i: ParenthesizedGenericArguments,
2396) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002397 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002398 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002399 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2400 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002401 }
2402}
David Tolnay8c81f622018-07-31 23:34:35 -07002403#[cfg(any(feature = "full", feature = "derive"))]
2404#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002405pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002406 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002407 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2408 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2409 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2410 Pat::TupleStruct(_binding_0) => {
2411 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002412 }
David Tolnay8c81f622018-07-31 23:34:35 -07002413 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2414 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2415 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2416 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2417 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2418 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2419 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2420 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2421 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002422 }
2423}
David Tolnay8c81f622018-07-31 23:34:35 -07002424#[cfg(any(feature = "full", feature = "derive"))]
2425#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002426pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002427 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002428 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002429 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002430 }
2431}
David Tolnay8c81f622018-07-31 23:34:35 -07002432#[cfg(any(feature = "full", feature = "derive"))]
2433#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002434pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002435 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002436 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2437 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002438 ident: _visitor.fold_ident(_i.ident),
2439 subpat: (_i.subpat).map(|it| {
2440 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002441 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002442 Box::new(_visitor.fold_pat(*(it).1)),
2443 )
2444 }),
Nika Layzell27726662017-10-24 23:16:35 -04002445 }
2446}
David Tolnay8c81f622018-07-31 23:34:35 -07002447#[cfg(any(feature = "full", feature = "derive"))]
2448#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002449pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002450 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002451 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002452 }
2453}
David Tolnay8c81f622018-07-31 23:34:35 -07002454#[cfg(any(feature = "full", feature = "derive"))]
2455#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002456pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002457 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002458 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002459 }
2460}
David Tolnay8c81f622018-07-31 23:34:35 -07002461#[cfg(any(feature = "full", feature = "derive"))]
2462#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002463pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002464 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002465 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2466 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002467 }
2468}
David Tolnay8c81f622018-07-31 23:34:35 -07002469#[cfg(any(feature = "full", feature = "derive"))]
2470#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002471pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002472 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002473 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2474 limits: _visitor.fold_range_limits(_i.limits),
2475 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002476 }
2477}
David Tolnay8c81f622018-07-31 23:34:35 -07002478#[cfg(any(feature = "full", feature = "derive"))]
2479#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002480pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002481 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002482 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2483 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002484 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002485 }
2486}
David Tolnay8c81f622018-07-31 23:34:35 -07002487#[cfg(any(feature = "full", feature = "derive"))]
2488#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002489pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002490 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002491 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002492 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2493 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002494 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2495 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002496 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002497 }
2498}
David Tolnay8c81f622018-07-31 23:34:35 -07002499#[cfg(any(feature = "full", feature = "derive"))]
2500#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002501pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002502 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002503 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002504 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002505 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002506 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002507 }
2508}
David Tolnay8c81f622018-07-31 23:34:35 -07002509#[cfg(any(feature = "full", feature = "derive"))]
2510#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002511pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002512 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002513 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002514 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002515 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2516 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002517 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002518 }
2519}
David Tolnay8c81f622018-07-31 23:34:35 -07002520#[cfg(any(feature = "full", feature = "derive"))]
2521#[cfg(feature = "full")]
2522pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2523 _visitor: &mut V,
2524 _i: PatTupleStruct,
2525) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002526 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002527 path: _visitor.fold_path(_i.path),
2528 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002529 }
2530}
David Tolnay8c81f622018-07-31 23:34:35 -07002531#[cfg(any(feature = "full", feature = "derive"))]
2532#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002533pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002534 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002535}
David Tolnay8c81f622018-07-31 23:34:35 -07002536#[cfg(any(feature = "full", feature = "derive"))]
2537#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002538pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002539 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002540 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002541 }
2542}
David Tolnay8c81f622018-07-31 23:34:35 -07002543#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002544pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002545 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002546 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002547 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002548 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002549 }
2550}
David Tolnay8c81f622018-07-31 23:34:35 -07002551#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002552pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002553 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002554 PathArguments::None => PathArguments::None,
2555 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2556 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2557 ),
2558 PathArguments::Parenthesized(_binding_0) => {
2559 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002560 }
2561 }
2562}
David Tolnay8c81f622018-07-31 23:34:35 -07002563#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002564pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002565 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002566 ident: _visitor.fold_ident(_i.ident),
2567 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002568 }
2569}
David Tolnay8c81f622018-07-31 23:34:35 -07002570#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002571pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002572 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002573 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002574 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002575 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002576 }
2577}
David Tolnay8c81f622018-07-31 23:34:35 -07002578#[cfg(any(feature = "full", feature = "derive"))]
2579pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2580 _visitor: &mut V,
2581 _i: PredicateLifetime,
2582) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002583 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002584 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay1b8e2852018-08-26 08:25:18 -04002585 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002586 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002587 }
2588}
David Tolnay8c81f622018-07-31 23:34:35 -07002589#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002590pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002591 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002592 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2593 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002594 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002595 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002596 }
2597}
David Tolnay8c81f622018-07-31 23:34:35 -07002598#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002599pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002600 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002601 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002602 ty: Box::new(_visitor.fold_type(*_i.ty)),
2603 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002604 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2605 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002606 }
2607}
David Tolnay8c81f622018-07-31 23:34:35 -07002608#[cfg(any(feature = "full", feature = "derive"))]
2609#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002610pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002611 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002612 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002613 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002614 }
David Tolnay8c81f622018-07-31 23:34:35 -07002615 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002616 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002617 }
2618 }
2619}
David Tolnay8c81f622018-07-31 23:34:35 -07002620#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002621pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002622 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002623 ReturnType::Default => ReturnType::Default,
2624 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002625 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002626 Box::new(_visitor.fold_type(*_binding_1)),
2627 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002628 }
2629}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002630pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002631 _i
2632}
David Tolnay8c81f622018-07-31 23:34:35 -07002633#[cfg(any(feature = "full", feature = "derive"))]
2634#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002635pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002636 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002637 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2638 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2639 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2640 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2641 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002642 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002643 ),
Nika Layzell27726662017-10-24 23:16:35 -04002644 }
2645}
David Tolnay8c81f622018-07-31 23:34:35 -07002646#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002647pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002648 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002649 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002650 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2651 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2652 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002653 }
2654}
David Tolnay8c81f622018-07-31 23:34:35 -07002655#[cfg(any(feature = "full", feature = "derive"))]
2656pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2657 _visitor: &mut V,
2658 _i: TraitBoundModifier,
2659) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002660 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002661 TraitBoundModifier::None => TraitBoundModifier::None,
2662 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002663 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002664 }
2665 }
2666}
David Tolnay8c81f622018-07-31 23:34:35 -07002667#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002668pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002669 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002670 TraitItem::Const(_binding_0) => {
2671 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002672 }
David Tolnay8c81f622018-07-31 23:34:35 -07002673 TraitItem::Method(_binding_0) => {
2674 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002675 }
David Tolnay8c81f622018-07-31 23:34:35 -07002676 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2677 TraitItem::Macro(_binding_0) => {
2678 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002679 }
David Tolnay8c81f622018-07-31 23:34:35 -07002680 TraitItem::Verbatim(_binding_0) => {
2681 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002682 }
Nika Layzell27726662017-10-24 23:16:35 -04002683 }
2684}
David Tolnay8c81f622018-07-31 23:34:35 -07002685#[cfg(feature = "full")]
2686pub fn fold_trait_item_const<V: Fold + ?Sized>(
2687 _visitor: &mut V,
2688 _i: TraitItemConst,
2689) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002690 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002691 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002692 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002693 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002694 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002695 ty: _visitor.fold_type(_i.ty),
2696 default: (_i.default).map(|it| {
2697 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002698 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002699 _visitor.fold_expr((it).1),
2700 )
2701 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002702 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002703 }
2704}
David Tolnay8c81f622018-07-31 23:34:35 -07002705#[cfg(feature = "full")]
2706pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2707 _visitor: &mut V,
2708 _i: TraitItemMacro,
2709) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002710 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002711 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2712 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002713 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002714 }
2715}
David Tolnay8c81f622018-07-31 23:34:35 -07002716#[cfg(feature = "full")]
2717pub fn fold_trait_item_method<V: Fold + ?Sized>(
2718 _visitor: &mut V,
2719 _i: TraitItemMethod,
2720) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002721 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002722 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2723 sig: _visitor.fold_method_sig(_i.sig),
2724 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002725 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002726 }
2727}
David Tolnay8c81f622018-07-31 23:34:35 -07002728#[cfg(feature = "full")]
2729pub fn fold_trait_item_type<V: Fold + ?Sized>(
2730 _visitor: &mut V,
2731 _i: TraitItemType,
2732) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002733 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002734 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002735 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002736 ident: _visitor.fold_ident(_i.ident),
2737 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002738 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002739 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2740 default: (_i.default).map(|it| {
2741 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002742 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002743 _visitor.fold_type((it).1),
2744 )
2745 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002746 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002747 }
2748}
David Tolnay8c81f622018-07-31 23:34:35 -07002749#[cfg(feature = "full")]
2750pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2751 _visitor: &mut V,
2752 _i: TraitItemVerbatim,
2753) -> TraitItemVerbatim {
2754 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002755}
David Tolnay8c81f622018-07-31 23:34:35 -07002756#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002757pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002758 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002759 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2760 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2761 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2762 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2763 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2764 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2765 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2766 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2767 Type::TraitObject(_binding_0) => {
2768 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002769 }
David Tolnay8c81f622018-07-31 23:34:35 -07002770 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2771 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2772 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2773 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2774 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2775 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002776 }
2777}
David Tolnay8c81f622018-07-31 23:34:35 -07002778#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002779pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002780 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002781 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002782 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002783 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002784 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002785 }
2786}
David Tolnay8c81f622018-07-31 23:34:35 -07002787#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002788pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002789 TypeBareFn {
David Tolnay3779bb72018-08-26 18:46:07 -07002790 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002791 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002792 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002793 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002794 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002795 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002796 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002797 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002798 }
2799}
David Tolnay8c81f622018-07-31 23:34:35 -07002800#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002801pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002802 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002803 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002804 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002805 }
2806}
David Tolnay8c81f622018-07-31 23:34:35 -07002807#[cfg(any(feature = "full", feature = "derive"))]
2808pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2809 _visitor: &mut V,
2810 _i: TypeImplTrait,
2811) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002812 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002813 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002814 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
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_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002819 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002820 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002821 }
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_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002825 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002826 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002827 }
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_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002831 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002832 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002833 }
2834}
David Tolnay8c81f622018-07-31 23:34:35 -07002835#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002836pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002837 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002838 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2839 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002840 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002841 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002842 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002843 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002844 }
2845}
David Tolnay8c81f622018-07-31 23:34:35 -07002846#[cfg(any(feature = "full", feature = "derive"))]
2847pub fn fold_type_param_bound<V: Fold + ?Sized>(
2848 _visitor: &mut V,
2849 _i: TypeParamBound,
2850) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002851 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002852 TypeParamBound::Trait(_binding_0) => {
2853 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002854 }
David Tolnay8c81f622018-07-31 23:34:35 -07002855 TypeParamBound::Lifetime(_binding_0) => {
2856 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002857 }
2858 }
2859}
David Tolnay8c81f622018-07-31 23:34:35 -07002860#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002861pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002862 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002863 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002864 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002865 }
2866}
David Tolnay8c81f622018-07-31 23:34:35 -07002867#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002868pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002869 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002870 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2871 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002872 }
2873}
David Tolnay8c81f622018-07-31 23:34:35 -07002874#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002875pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002876 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002877 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2878 const_token: (_i.const_token)
2879 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2880 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002881 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002882 }
2883}
David Tolnay8c81f622018-07-31 23:34:35 -07002884#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002885pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002886 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002887 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002888 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002889 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002890 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002891 }
2892}
David Tolnay8c81f622018-07-31 23:34:35 -07002893#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002894pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002895 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002896 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002897 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002898 }
2899}
David Tolnay8c81f622018-07-31 23:34:35 -07002900#[cfg(any(feature = "full", feature = "derive"))]
2901pub fn fold_type_trait_object<V: Fold + ?Sized>(
2902 _visitor: &mut V,
2903 _i: TypeTraitObject,
2904) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002905 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002906 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002907 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002908 }
2909}
David Tolnay8c81f622018-07-31 23:34:35 -07002910#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002911pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002912 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002913 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002914 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002915 }
2916}
David Tolnay8c81f622018-07-31 23:34:35 -07002917#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002918pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002919 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002920}
David Tolnay8c81f622018-07-31 23:34:35 -07002921#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002922pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002923 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002924 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002925 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002926 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002927 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2928 UnOp::Neg(_binding_0) => {
2929 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2930 }
Nika Layzell27726662017-10-24 23:16:35 -04002931 }
2932}
David Tolnay8c81f622018-07-31 23:34:35 -07002933#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002934pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002935 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002936 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002937 }
2938}
David Tolnay8c81f622018-07-31 23:34:35 -07002939#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002940pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2941 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002942 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002943 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002944 }
2945}
David Tolnay8c81f622018-07-31 23:34:35 -07002946#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002947pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2948 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002949 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002950 }
2951}
David Tolnay8c81f622018-07-31 23:34:35 -07002952#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002953pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002954 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002955 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002956 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002957 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002958 }
2959}
David Tolnay8c81f622018-07-31 23:34:35 -07002960#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002961pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2962 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002963 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002964 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002965 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002966 }
2967}
David Tolnay8c81f622018-07-31 23:34:35 -07002968#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002969pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002970 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002971 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2972 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2973 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2974 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2975 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002976 }
2977}
David Tolnay8c81f622018-07-31 23:34:35 -07002978#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002979pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002980 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002981 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2982 ident: _visitor.fold_ident(_i.ident),
2983 fields: _visitor.fold_fields(_i.fields),
2984 discriminant: (_i.discriminant).map(|it| {
2985 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002986 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002987 _visitor.fold_expr((it).1),
2988 )
2989 }),
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_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002994 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002995 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_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_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04003000 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04003001 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04003002 }
3003}
David Tolnay8c81f622018-07-31 23:34:35 -07003004#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003005pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04003006 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04003007 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
3008 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
3009 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07003010 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04003011 }
3012}
David Tolnay8c81f622018-07-31 23:34:35 -07003013#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003014pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04003015 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003016 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
3017 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
3018 Visibility::Restricted(_binding_0) => {
3019 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003020 }
David Tolnay8c81f622018-07-31 23:34:35 -07003021 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04003022 }
3023}
David Tolnay8c81f622018-07-31 23:34:35 -07003024#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003025pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04003026 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04003027 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07003028 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04003029 }
3030}
David Tolnay8c81f622018-07-31 23:34:35 -07003031#[cfg(any(feature = "full", feature = "derive"))]
3032pub fn fold_where_predicate<V: Fold + ?Sized>(
3033 _visitor: &mut V,
3034 _i: WherePredicate,
3035) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04003036 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003037 WherePredicate::Type(_binding_0) => {
3038 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003039 }
David Tolnay8c81f622018-07-31 23:34:35 -07003040 WherePredicate::Lifetime(_binding_0) => {
3041 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003042 }
David Tolnay8c81f622018-07-31 23:34:35 -07003043 WherePredicate::Eq(_binding_0) => {
3044 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003045 }
3046 }
3047}