blob: df96cc36854394fe0c3858657b327911dc6c2f2f [file] [log] [blame]
Nika Layzell27726662017-10-24 23:16:35 -04001// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT
2
Nika Layzell27726662017-10-24 23:16:35 -04003#![allow(unreachable_code)]
David Tolnayf0d63bf2017-12-26 12:29:47 -05004#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
David Tolnay0a0d78c2018-01-05 15:24:01 -08005#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05006use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07007use proc_macro2::Span;
8#[cfg(any(feature = "full", feature = "derive"))]
9use token::{Brace, Bracket, Group, Paren};
10use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040011#[cfg(feature = "full")]
12macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070013 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070014 $e
15 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040016}
David Tolnay0a0d78c2018-01-05 15:24:01 -080017#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040018macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070019 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070020 unreachable!()
21 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040022}
David Tolnay6af48992018-08-01 11:16:28 -070023#[doc = r" Syntax tree traversal to transform the nodes of an owned syntax tree."]
24#[doc = r""]
25#[doc = r" See the [module documentation] for details."]
26#[doc = r""]
27#[doc = r" [module documentation]: index.html"]
28#[doc = r""]
29#[doc = r#" *This trait is available if Syn is built with the `"fold"` feature.*"#]
David Tolnay4b4c4b62018-01-06 13:48:05 -080030pub trait Fold {
David Tolnay8c81f622018-07-31 23:34:35 -070031 #[cfg(any(feature = "full", feature = "derive"))]
32 fn fold_abi(&mut self, i: Abi) -> Abi {
33 fold_abi(self, i)
34 }
35 #[cfg(any(feature = "full", feature = "derive"))]
36 fn fold_angle_bracketed_generic_arguments(
37 &mut self,
38 i: AngleBracketedGenericArguments,
39 ) -> AngleBracketedGenericArguments {
40 fold_angle_bracketed_generic_arguments(self, i)
41 }
42 #[cfg(feature = "full")]
43 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
44 fold_arg_captured(self, i)
45 }
46 #[cfg(feature = "full")]
47 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
48 fold_arg_self(self, i)
49 }
50 #[cfg(feature = "full")]
51 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
52 fold_arg_self_ref(self, i)
53 }
54 #[cfg(any(feature = "full", feature = "derive"))]
55 #[cfg(feature = "full")]
56 fn fold_arm(&mut self, i: Arm) -> Arm {
57 fold_arm(self, i)
58 }
59 #[cfg(any(feature = "full", feature = "derive"))]
60 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
61 fold_attr_style(self, i)
62 }
63 #[cfg(any(feature = "full", feature = "derive"))]
64 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
65 fold_attribute(self, i)
66 }
67 #[cfg(any(feature = "full", feature = "derive"))]
68 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
69 fold_bare_fn_arg(self, i)
70 }
71 #[cfg(any(feature = "full", feature = "derive"))]
72 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
73 fold_bare_fn_arg_name(self, i)
74 }
75 #[cfg(any(feature = "full", feature = "derive"))]
76 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
77 fold_bin_op(self, i)
78 }
79 #[cfg(any(feature = "full", feature = "derive"))]
80 fn fold_binding(&mut self, i: Binding) -> Binding {
81 fold_binding(self, i)
82 }
83 #[cfg(any(feature = "full", feature = "derive"))]
84 #[cfg(feature = "full")]
85 fn fold_block(&mut self, i: Block) -> Block {
86 fold_block(self, i)
87 }
88 #[cfg(any(feature = "full", feature = "derive"))]
89 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
90 fold_bound_lifetimes(self, i)
91 }
92 #[cfg(any(feature = "full", feature = "derive"))]
93 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
94 fold_const_param(self, i)
95 }
96 #[cfg(feature = "derive")]
97 fn fold_data(&mut self, i: Data) -> Data {
98 fold_data(self, i)
99 }
100 #[cfg(feature = "derive")]
101 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
102 fold_data_enum(self, i)
103 }
104 #[cfg(feature = "derive")]
105 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
106 fold_data_struct(self, i)
107 }
108 #[cfg(feature = "derive")]
109 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
110 fold_data_union(self, i)
111 }
112 #[cfg(feature = "derive")]
113 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
114 fold_derive_input(self, i)
115 }
116 #[cfg(any(feature = "full", feature = "derive"))]
117 fn fold_expr(&mut self, i: Expr) -> Expr {
118 fold_expr(self, i)
119 }
120 #[cfg(feature = "full")]
121 #[cfg(any(feature = "full", feature = "derive"))]
122 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
123 fold_expr_array(self, i)
124 }
125 #[cfg(feature = "full")]
126 #[cfg(any(feature = "full", feature = "derive"))]
127 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
128 fold_expr_assign(self, i)
129 }
130 #[cfg(feature = "full")]
131 #[cfg(any(feature = "full", feature = "derive"))]
132 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
133 fold_expr_assign_op(self, i)
134 }
David Tolnay02a9c6f2018-08-24 18:58:45 -0400135 #[cfg(feature = "full")]
136 #[cfg(any(feature = "full", feature = "derive"))]
137 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
138 fold_expr_async(self, i)
139 }
David Tolnay8c81f622018-07-31 23:34:35 -0700140 #[cfg(any(feature = "full", feature = "derive"))]
141 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
142 fold_expr_binary(self, i)
143 }
144 #[cfg(feature = "full")]
145 #[cfg(any(feature = "full", feature = "derive"))]
146 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
147 fold_expr_block(self, i)
148 }
149 #[cfg(feature = "full")]
150 #[cfg(any(feature = "full", feature = "derive"))]
151 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
152 fold_expr_box(self, i)
153 }
154 #[cfg(feature = "full")]
155 #[cfg(any(feature = "full", feature = "derive"))]
156 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
157 fold_expr_break(self, i)
158 }
159 #[cfg(any(feature = "full", feature = "derive"))]
160 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
161 fold_expr_call(self, i)
162 }
163 #[cfg(any(feature = "full", feature = "derive"))]
164 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
165 fold_expr_cast(self, i)
166 }
167 #[cfg(feature = "full")]
168 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700169 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
170 fold_expr_closure(self, i)
171 }
172 #[cfg(feature = "full")]
173 #[cfg(any(feature = "full", feature = "derive"))]
174 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
175 fold_expr_continue(self, i)
176 }
177 #[cfg(any(feature = "full", feature = "derive"))]
178 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
179 fold_expr_field(self, i)
180 }
181 #[cfg(feature = "full")]
182 #[cfg(any(feature = "full", feature = "derive"))]
183 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
184 fold_expr_for_loop(self, i)
185 }
186 #[cfg(feature = "full")]
187 #[cfg(any(feature = "full", feature = "derive"))]
188 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
189 fold_expr_group(self, i)
190 }
191 #[cfg(feature = "full")]
192 #[cfg(any(feature = "full", feature = "derive"))]
193 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
194 fold_expr_if(self, i)
195 }
196 #[cfg(feature = "full")]
197 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700198 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
199 fold_expr_in_place(self, i)
200 }
201 #[cfg(any(feature = "full", feature = "derive"))]
202 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
203 fold_expr_index(self, i)
204 }
David Tolnay9c119122018-09-01 18:47:02 -0700205 #[cfg(feature = "full")]
206 #[cfg(any(feature = "full", feature = "derive"))]
207 fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet {
208 fold_expr_let(self, i)
209 }
David Tolnay8c81f622018-07-31 23:34:35 -0700210 #[cfg(any(feature = "full", feature = "derive"))]
211 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
212 fold_expr_lit(self, i)
213 }
214 #[cfg(feature = "full")]
215 #[cfg(any(feature = "full", feature = "derive"))]
216 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
217 fold_expr_loop(self, i)
218 }
219 #[cfg(feature = "full")]
220 #[cfg(any(feature = "full", feature = "derive"))]
221 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
222 fold_expr_macro(self, i)
223 }
224 #[cfg(feature = "full")]
225 #[cfg(any(feature = "full", feature = "derive"))]
226 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
227 fold_expr_match(self, i)
228 }
229 #[cfg(feature = "full")]
230 #[cfg(any(feature = "full", feature = "derive"))]
231 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
232 fold_expr_method_call(self, i)
233 }
234 #[cfg(any(feature = "full", feature = "derive"))]
235 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
236 fold_expr_paren(self, i)
237 }
238 #[cfg(any(feature = "full", feature = "derive"))]
239 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
240 fold_expr_path(self, i)
241 }
242 #[cfg(feature = "full")]
243 #[cfg(any(feature = "full", feature = "derive"))]
244 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
245 fold_expr_range(self, i)
246 }
247 #[cfg(feature = "full")]
248 #[cfg(any(feature = "full", feature = "derive"))]
249 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
250 fold_expr_reference(self, i)
251 }
252 #[cfg(feature = "full")]
253 #[cfg(any(feature = "full", feature = "derive"))]
254 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
255 fold_expr_repeat(self, i)
256 }
257 #[cfg(feature = "full")]
258 #[cfg(any(feature = "full", feature = "derive"))]
259 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
260 fold_expr_return(self, i)
261 }
262 #[cfg(feature = "full")]
263 #[cfg(any(feature = "full", feature = "derive"))]
264 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
265 fold_expr_struct(self, i)
266 }
267 #[cfg(feature = "full")]
268 #[cfg(any(feature = "full", feature = "derive"))]
269 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
270 fold_expr_try(self, i)
271 }
272 #[cfg(feature = "full")]
273 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -0400274 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
275 fold_expr_try_block(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700279 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
280 fold_expr_tuple(self, i)
281 }
282 #[cfg(feature = "full")]
283 #[cfg(any(feature = "full", feature = "derive"))]
284 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
285 fold_expr_type(self, i)
286 }
287 #[cfg(any(feature = "full", feature = "derive"))]
288 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
289 fold_expr_unary(self, i)
290 }
291 #[cfg(feature = "full")]
292 #[cfg(any(feature = "full", feature = "derive"))]
293 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
294 fold_expr_unsafe(self, i)
295 }
296 #[cfg(any(feature = "full", feature = "derive"))]
297 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
298 fold_expr_verbatim(self, i)
299 }
300 #[cfg(feature = "full")]
301 #[cfg(any(feature = "full", feature = "derive"))]
302 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
303 fold_expr_while(self, i)
304 }
305 #[cfg(feature = "full")]
306 #[cfg(any(feature = "full", feature = "derive"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700307 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
308 fold_expr_yield(self, i)
309 }
310 #[cfg(any(feature = "full", feature = "derive"))]
311 fn fold_field(&mut self, i: Field) -> Field {
312 fold_field(self, i)
313 }
314 #[cfg(any(feature = "full", feature = "derive"))]
315 #[cfg(feature = "full")]
316 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
317 fold_field_pat(self, i)
318 }
319 #[cfg(any(feature = "full", feature = "derive"))]
320 #[cfg(feature = "full")]
321 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
322 fold_field_value(self, i)
323 }
324 #[cfg(any(feature = "full", feature = "derive"))]
325 fn fold_fields(&mut self, i: Fields) -> Fields {
326 fold_fields(self, i)
327 }
328 #[cfg(any(feature = "full", feature = "derive"))]
329 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
330 fold_fields_named(self, i)
331 }
332 #[cfg(any(feature = "full", feature = "derive"))]
333 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
334 fold_fields_unnamed(self, i)
335 }
336 #[cfg(feature = "full")]
337 fn fold_file(&mut self, i: File) -> File {
338 fold_file(self, i)
339 }
340 #[cfg(feature = "full")]
341 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
342 fold_fn_arg(self, i)
343 }
344 #[cfg(feature = "full")]
345 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
346 fold_fn_decl(self, i)
347 }
348 #[cfg(feature = "full")]
349 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
350 fold_foreign_item(self, i)
351 }
352 #[cfg(feature = "full")]
353 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
354 fold_foreign_item_fn(self, i)
355 }
356 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400357 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
358 fold_foreign_item_macro(self, i)
359 }
360 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700361 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
362 fold_foreign_item_static(self, i)
363 }
364 #[cfg(feature = "full")]
365 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
366 fold_foreign_item_type(self, i)
367 }
368 #[cfg(feature = "full")]
369 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
370 fold_foreign_item_verbatim(self, i)
371 }
372 #[cfg(any(feature = "full", feature = "derive"))]
373 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
374 fold_generic_argument(self, i)
375 }
376 #[cfg(any(feature = "full", feature = "derive"))]
377 #[cfg(feature = "full")]
378 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
379 fold_generic_method_argument(self, i)
380 }
381 #[cfg(any(feature = "full", feature = "derive"))]
382 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
383 fold_generic_param(self, i)
384 }
385 #[cfg(any(feature = "full", feature = "derive"))]
386 fn fold_generics(&mut self, i: Generics) -> Generics {
387 fold_generics(self, i)
388 }
David Tolnay8c81f622018-07-31 23:34:35 -0700389 fn fold_ident(&mut self, i: Ident) -> Ident {
390 fold_ident(self, i)
391 }
392 #[cfg(feature = "full")]
393 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
394 fold_impl_item(self, i)
395 }
396 #[cfg(feature = "full")]
397 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
398 fold_impl_item_const(self, i)
399 }
400 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400401 fn fold_impl_item_existential(&mut self, i: ImplItemExistential) -> ImplItemExistential {
402 fold_impl_item_existential(self, i)
403 }
404 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700405 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
406 fold_impl_item_macro(self, i)
407 }
408 #[cfg(feature = "full")]
409 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
410 fold_impl_item_method(self, i)
411 }
412 #[cfg(feature = "full")]
413 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
414 fold_impl_item_type(self, i)
415 }
416 #[cfg(feature = "full")]
417 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
418 fold_impl_item_verbatim(self, i)
419 }
420 #[cfg(any(feature = "full", feature = "derive"))]
421 fn fold_index(&mut self, i: Index) -> Index {
422 fold_index(self, i)
423 }
424 #[cfg(feature = "full")]
425 fn fold_item(&mut self, i: Item) -> Item {
426 fold_item(self, i)
427 }
428 #[cfg(feature = "full")]
429 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
430 fold_item_const(self, i)
431 }
432 #[cfg(feature = "full")]
433 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
434 fold_item_enum(self, i)
435 }
436 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400437 fn fold_item_existential(&mut self, i: ItemExistential) -> ItemExistential {
438 fold_item_existential(self, i)
439 }
440 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700441 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
442 fold_item_extern_crate(self, i)
443 }
444 #[cfg(feature = "full")]
445 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
446 fold_item_fn(self, i)
447 }
448 #[cfg(feature = "full")]
449 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
450 fold_item_foreign_mod(self, i)
451 }
452 #[cfg(feature = "full")]
453 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
454 fold_item_impl(self, i)
455 }
456 #[cfg(feature = "full")]
457 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
458 fold_item_macro(self, i)
459 }
460 #[cfg(feature = "full")]
461 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
462 fold_item_macro2(self, i)
463 }
464 #[cfg(feature = "full")]
465 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
466 fold_item_mod(self, i)
467 }
468 #[cfg(feature = "full")]
469 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
470 fold_item_static(self, i)
471 }
472 #[cfg(feature = "full")]
473 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
474 fold_item_struct(self, i)
475 }
476 #[cfg(feature = "full")]
477 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
478 fold_item_trait(self, i)
479 }
480 #[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -0700481 fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias {
482 fold_item_trait_alias(self, i)
483 }
484 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700485 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
486 fold_item_type(self, i)
487 }
488 #[cfg(feature = "full")]
489 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
490 fold_item_union(self, i)
491 }
492 #[cfg(feature = "full")]
493 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
494 fold_item_use(self, i)
495 }
496 #[cfg(feature = "full")]
497 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
498 fold_item_verbatim(self, i)
499 }
500 #[cfg(any(feature = "full", feature = "derive"))]
501 #[cfg(feature = "full")]
502 fn fold_label(&mut self, i: Label) -> Label {
503 fold_label(self, i)
504 }
David Tolnay8c81f622018-07-31 23:34:35 -0700505 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
506 fold_lifetime(self, i)
507 }
508 #[cfg(any(feature = "full", feature = "derive"))]
509 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
510 fold_lifetime_def(self, i)
511 }
512 #[cfg(any(feature = "full", feature = "derive"))]
513 fn fold_lit(&mut self, i: Lit) -> Lit {
514 fold_lit(self, i)
515 }
516 #[cfg(any(feature = "full", feature = "derive"))]
517 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
518 fold_lit_bool(self, i)
519 }
520 #[cfg(any(feature = "full", feature = "derive"))]
521 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
522 fold_lit_byte(self, i)
523 }
524 #[cfg(any(feature = "full", feature = "derive"))]
525 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
526 fold_lit_byte_str(self, i)
527 }
528 #[cfg(any(feature = "full", feature = "derive"))]
529 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
530 fold_lit_char(self, i)
531 }
532 #[cfg(any(feature = "full", feature = "derive"))]
533 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
534 fold_lit_float(self, i)
535 }
536 #[cfg(any(feature = "full", feature = "derive"))]
537 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
538 fold_lit_int(self, i)
539 }
540 #[cfg(any(feature = "full", feature = "derive"))]
541 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
542 fold_lit_str(self, i)
543 }
544 #[cfg(any(feature = "full", feature = "derive"))]
545 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
546 fold_lit_verbatim(self, i)
547 }
548 #[cfg(any(feature = "full", feature = "derive"))]
549 #[cfg(feature = "full")]
550 fn fold_local(&mut self, i: Local) -> Local {
551 fold_local(self, i)
552 }
553 #[cfg(any(feature = "full", feature = "derive"))]
554 fn fold_macro(&mut self, i: Macro) -> Macro {
555 fold_macro(self, i)
556 }
557 #[cfg(any(feature = "full", feature = "derive"))]
558 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
559 fold_macro_delimiter(self, i)
560 }
561 #[cfg(any(feature = "full", feature = "derive"))]
562 fn fold_member(&mut self, i: Member) -> Member {
563 fold_member(self, i)
564 }
565 #[cfg(any(feature = "full", feature = "derive"))]
566 fn fold_meta(&mut self, i: Meta) -> Meta {
567 fold_meta(self, i)
568 }
569 #[cfg(any(feature = "full", feature = "derive"))]
570 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
571 fold_meta_list(self, i)
572 }
573 #[cfg(any(feature = "full", feature = "derive"))]
574 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
575 fold_meta_name_value(self, i)
576 }
577 #[cfg(feature = "full")]
578 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
579 fold_method_sig(self, i)
580 }
581 #[cfg(any(feature = "full", feature = "derive"))]
582 #[cfg(feature = "full")]
583 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
584 fold_method_turbofish(self, i)
585 }
586 #[cfg(any(feature = "full", feature = "derive"))]
587 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
588 fold_nested_meta(self, i)
589 }
590 #[cfg(any(feature = "full", feature = "derive"))]
591 fn fold_parenthesized_generic_arguments(
592 &mut self,
593 i: ParenthesizedGenericArguments,
594 ) -> ParenthesizedGenericArguments {
595 fold_parenthesized_generic_arguments(self, i)
596 }
597 #[cfg(any(feature = "full", feature = "derive"))]
598 #[cfg(feature = "full")]
599 fn fold_pat(&mut self, i: Pat) -> Pat {
600 fold_pat(self, i)
601 }
602 #[cfg(any(feature = "full", feature = "derive"))]
603 #[cfg(feature = "full")]
604 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
605 fold_pat_box(self, i)
606 }
607 #[cfg(any(feature = "full", feature = "derive"))]
608 #[cfg(feature = "full")]
609 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
610 fold_pat_ident(self, i)
611 }
612 #[cfg(any(feature = "full", feature = "derive"))]
613 #[cfg(feature = "full")]
614 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
615 fold_pat_lit(self, i)
616 }
617 #[cfg(any(feature = "full", feature = "derive"))]
618 #[cfg(feature = "full")]
619 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
620 fold_pat_macro(self, i)
621 }
622 #[cfg(any(feature = "full", feature = "derive"))]
623 #[cfg(feature = "full")]
624 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
625 fold_pat_path(self, i)
626 }
627 #[cfg(any(feature = "full", feature = "derive"))]
628 #[cfg(feature = "full")]
629 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
630 fold_pat_range(self, i)
631 }
632 #[cfg(any(feature = "full", feature = "derive"))]
633 #[cfg(feature = "full")]
634 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
635 fold_pat_ref(self, i)
636 }
637 #[cfg(any(feature = "full", feature = "derive"))]
638 #[cfg(feature = "full")]
639 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
640 fold_pat_slice(self, i)
641 }
642 #[cfg(any(feature = "full", feature = "derive"))]
643 #[cfg(feature = "full")]
644 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
645 fold_pat_struct(self, i)
646 }
647 #[cfg(any(feature = "full", feature = "derive"))]
648 #[cfg(feature = "full")]
649 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
650 fold_pat_tuple(self, i)
651 }
652 #[cfg(any(feature = "full", feature = "derive"))]
653 #[cfg(feature = "full")]
654 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
655 fold_pat_tuple_struct(self, i)
656 }
657 #[cfg(any(feature = "full", feature = "derive"))]
658 #[cfg(feature = "full")]
659 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
660 fold_pat_verbatim(self, i)
661 }
662 #[cfg(any(feature = "full", feature = "derive"))]
663 #[cfg(feature = "full")]
664 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
665 fold_pat_wild(self, i)
666 }
667 #[cfg(any(feature = "full", feature = "derive"))]
668 fn fold_path(&mut self, i: Path) -> Path {
669 fold_path(self, i)
670 }
671 #[cfg(any(feature = "full", feature = "derive"))]
672 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
673 fold_path_arguments(self, i)
674 }
675 #[cfg(any(feature = "full", feature = "derive"))]
676 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
677 fold_path_segment(self, i)
678 }
679 #[cfg(any(feature = "full", feature = "derive"))]
680 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
681 fold_predicate_eq(self, i)
682 }
683 #[cfg(any(feature = "full", feature = "derive"))]
684 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
685 fold_predicate_lifetime(self, i)
686 }
687 #[cfg(any(feature = "full", feature = "derive"))]
688 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
689 fold_predicate_type(self, i)
690 }
691 #[cfg(any(feature = "full", feature = "derive"))]
692 fn fold_qself(&mut self, i: QSelf) -> QSelf {
693 fold_qself(self, i)
694 }
695 #[cfg(any(feature = "full", feature = "derive"))]
696 #[cfg(feature = "full")]
697 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
698 fold_range_limits(self, i)
699 }
700 #[cfg(any(feature = "full", feature = "derive"))]
701 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
702 fold_return_type(self, i)
703 }
David Tolnay8c81f622018-07-31 23:34:35 -0700704 fn fold_span(&mut self, i: Span) -> Span {
705 fold_span(self, i)
706 }
707 #[cfg(any(feature = "full", feature = "derive"))]
708 #[cfg(feature = "full")]
709 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
710 fold_stmt(self, i)
711 }
712 #[cfg(any(feature = "full", feature = "derive"))]
713 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
714 fold_trait_bound(self, i)
715 }
716 #[cfg(any(feature = "full", feature = "derive"))]
717 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
718 fold_trait_bound_modifier(self, i)
719 }
720 #[cfg(feature = "full")]
721 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
722 fold_trait_item(self, i)
723 }
724 #[cfg(feature = "full")]
725 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
726 fold_trait_item_const(self, i)
727 }
728 #[cfg(feature = "full")]
729 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
730 fold_trait_item_macro(self, i)
731 }
732 #[cfg(feature = "full")]
733 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
734 fold_trait_item_method(self, i)
735 }
736 #[cfg(feature = "full")]
737 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
738 fold_trait_item_type(self, i)
739 }
740 #[cfg(feature = "full")]
741 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
742 fold_trait_item_verbatim(self, i)
743 }
744 #[cfg(any(feature = "full", feature = "derive"))]
745 fn fold_type(&mut self, i: Type) -> Type {
746 fold_type(self, i)
747 }
748 #[cfg(any(feature = "full", feature = "derive"))]
749 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
750 fold_type_array(self, i)
751 }
752 #[cfg(any(feature = "full", feature = "derive"))]
753 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
754 fold_type_bare_fn(self, i)
755 }
756 #[cfg(any(feature = "full", feature = "derive"))]
757 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
758 fold_type_group(self, i)
759 }
760 #[cfg(any(feature = "full", feature = "derive"))]
761 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
762 fold_type_impl_trait(self, i)
763 }
764 #[cfg(any(feature = "full", feature = "derive"))]
765 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
766 fold_type_infer(self, i)
767 }
768 #[cfg(any(feature = "full", feature = "derive"))]
769 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
770 fold_type_macro(self, i)
771 }
772 #[cfg(any(feature = "full", feature = "derive"))]
773 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
774 fold_type_never(self, i)
775 }
776 #[cfg(any(feature = "full", feature = "derive"))]
777 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
778 fold_type_param(self, i)
779 }
780 #[cfg(any(feature = "full", feature = "derive"))]
781 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
782 fold_type_param_bound(self, i)
783 }
784 #[cfg(any(feature = "full", feature = "derive"))]
785 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
786 fold_type_paren(self, i)
787 }
788 #[cfg(any(feature = "full", feature = "derive"))]
789 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
790 fold_type_path(self, i)
791 }
792 #[cfg(any(feature = "full", feature = "derive"))]
793 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
794 fold_type_ptr(self, i)
795 }
796 #[cfg(any(feature = "full", feature = "derive"))]
797 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
798 fold_type_reference(self, i)
799 }
800 #[cfg(any(feature = "full", feature = "derive"))]
801 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
802 fold_type_slice(self, i)
803 }
804 #[cfg(any(feature = "full", feature = "derive"))]
805 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
806 fold_type_trait_object(self, i)
807 }
808 #[cfg(any(feature = "full", feature = "derive"))]
809 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
810 fold_type_tuple(self, i)
811 }
812 #[cfg(any(feature = "full", feature = "derive"))]
813 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
814 fold_type_verbatim(self, i)
815 }
816 #[cfg(any(feature = "full", feature = "derive"))]
817 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
818 fold_un_op(self, i)
819 }
820 #[cfg(feature = "full")]
821 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
822 fold_use_glob(self, i)
823 }
824 #[cfg(feature = "full")]
825 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
826 fold_use_group(self, i)
827 }
828 #[cfg(feature = "full")]
829 fn fold_use_name(&mut self, i: UseName) -> UseName {
830 fold_use_name(self, i)
831 }
832 #[cfg(feature = "full")]
833 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
834 fold_use_path(self, i)
835 }
836 #[cfg(feature = "full")]
837 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
838 fold_use_rename(self, i)
839 }
840 #[cfg(feature = "full")]
841 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
842 fold_use_tree(self, i)
843 }
844 #[cfg(any(feature = "full", feature = "derive"))]
845 fn fold_variant(&mut self, i: Variant) -> Variant {
846 fold_variant(self, i)
847 }
848 #[cfg(any(feature = "full", feature = "derive"))]
849 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
850 fold_vis_crate(self, i)
851 }
852 #[cfg(any(feature = "full", feature = "derive"))]
853 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
854 fold_vis_public(self, i)
855 }
856 #[cfg(any(feature = "full", feature = "derive"))]
857 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
858 fold_vis_restricted(self, i)
859 }
860 #[cfg(any(feature = "full", feature = "derive"))]
861 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
862 fold_visibility(self, i)
863 }
864 #[cfg(any(feature = "full", feature = "derive"))]
865 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
866 fold_where_clause(self, i)
867 }
868 #[cfg(any(feature = "full", feature = "derive"))]
869 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
870 fold_where_predicate(self, i)
871 }
Nika Layzell27726662017-10-24 23:16:35 -0400872}
David Tolnayd3f32142018-05-20 20:21:12 -0700873#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800874macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700875 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800876 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700877 let span = _visitor.fold_span(_i.span());
878 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800879 _i
880 }
David Tolnay8c81f622018-07-31 23:34:35 -0700881 };
David Tolnayd0adf522017-12-29 01:30:07 -0500882}
David Tolnay360efd22018-01-04 23:35:26 -0800883#[cfg(any(feature = "full", feature = "derive"))]
884fold_span_only!(fold_lit_byte: LitByte);
885#[cfg(any(feature = "full", feature = "derive"))]
886fold_span_only!(fold_lit_byte_str: LitByteStr);
887#[cfg(any(feature = "full", feature = "derive"))]
888fold_span_only!(fold_lit_char: LitChar);
889#[cfg(any(feature = "full", feature = "derive"))]
890fold_span_only!(fold_lit_float: LitFloat);
891#[cfg(any(feature = "full", feature = "derive"))]
892fold_span_only!(fold_lit_int: LitInt);
893#[cfg(any(feature = "full", feature = "derive"))]
894fold_span_only!(fold_lit_str: LitStr);
David Tolnay8c81f622018-07-31 23:34:35 -0700895#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800896pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400897 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400898 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700899 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400900 }
901}
David Tolnay8c81f622018-07-31 23:34:35 -0700902#[cfg(any(feature = "full", feature = "derive"))]
903pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
904 _visitor: &mut V,
905 _i: AngleBracketedGenericArguments,
906) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500907 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400908 colon2_token: (_i.colon2_token)
909 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
910 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700911 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400912 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400913 }
914}
David Tolnay8c81f622018-07-31 23:34:35 -0700915#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800916pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400917 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700918 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400919 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700920 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400921 }
922}
David Tolnay8c81f622018-07-31 23:34:35 -0700923#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800924pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400925 ArgSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -0400926 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
927 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400928 }
929}
David Tolnay8c81f622018-07-31 23:34:35 -0700930#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800931pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400932 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400933 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700934 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400935 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
936 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400937 }
938}
David Tolnay8c81f622018-07-31 23:34:35 -0700939#[cfg(any(feature = "full", feature = "derive"))]
940#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800941pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400942 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700943 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400944 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700945 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
946 guard: (_i.guard).map(|it| {
947 (
David Tolnay7ac699c2018-08-24 14:00:58 -0400948 Token ! [ if ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700949 Box::new(_visitor.fold_expr(*(it).1)),
950 )
951 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400952 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700953 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400954 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400955 }
956}
David Tolnay8c81f622018-07-31 23:34:35 -0700957#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800958pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400959 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700960 AttrStyle::Outer => AttrStyle::Outer,
961 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400962 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400963 }
964 }
965}
David Tolnay8c81f622018-07-31 23:34:35 -0700966#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800967pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400968 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400969 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700970 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400971 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700972 path: _visitor.fold_path(_i.path),
973 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400974 }
975}
David Tolnay8c81f622018-07-31 23:34:35 -0700976#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800977pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400978 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700979 name: (_i.name).map(|it| {
980 (
981 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400982 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700983 )
984 }),
985 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400986 }
987}
David Tolnay8c81f622018-07-31 23:34:35 -0700988#[cfg(any(feature = "full", feature = "derive"))]
989pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
990 _visitor: &mut V,
991 _i: BareFnArgName,
992) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400993 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700994 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
995 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400996 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400997 }
998 }
999}
David Tolnay8c81f622018-07-31 23:34:35 -07001000#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001001pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -04001002 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001003 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001004 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001005 }
David Tolnay8c81f622018-07-31 23:34:35 -07001006 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001007 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001008 }
David Tolnay8c81f622018-07-31 23:34:35 -07001009 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001010 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001011 }
David Tolnay8c81f622018-07-31 23:34:35 -07001012 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001013 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001014 }
David Tolnay8c81f622018-07-31 23:34:35 -07001015 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001016 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001017 }
David Tolnay8c81f622018-07-31 23:34:35 -07001018 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001019 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001020 }
David Tolnay8c81f622018-07-31 23:34:35 -07001021 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001022 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001023 }
David Tolnay8c81f622018-07-31 23:34:35 -07001024 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001025 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001026 }
David Tolnay8c81f622018-07-31 23:34:35 -07001027 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001028 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001029 }
David Tolnay8c81f622018-07-31 23:34:35 -07001030 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001031 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001032 }
David Tolnay8c81f622018-07-31 23:34:35 -07001033 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001034 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001035 }
David Tolnay8c81f622018-07-31 23:34:35 -07001036 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001037 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001038 }
David Tolnay8c81f622018-07-31 23:34:35 -07001039 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001040 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001041 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001042 BinOp::Lt(_binding_0) => {
1043 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
1044 }
David Tolnay8c81f622018-07-31 23:34:35 -07001045 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001046 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001047 }
David Tolnay8c81f622018-07-31 23:34:35 -07001048 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001049 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001050 }
David Tolnay8c81f622018-07-31 23:34:35 -07001051 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001052 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001053 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001054 BinOp::Gt(_binding_0) => {
1055 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1056 }
David Tolnay8c81f622018-07-31 23:34:35 -07001057 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001058 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001059 }
David Tolnay8c81f622018-07-31 23:34:35 -07001060 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001061 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001062 }
David Tolnay8c81f622018-07-31 23:34:35 -07001063 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001064 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001065 }
David Tolnay8c81f622018-07-31 23:34:35 -07001066 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001067 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001068 }
David Tolnay8c81f622018-07-31 23:34:35 -07001069 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001070 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001071 }
David Tolnay8c81f622018-07-31 23:34:35 -07001072 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001073 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001074 }
David Tolnay8c81f622018-07-31 23:34:35 -07001075 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001076 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001077 }
David Tolnay8c81f622018-07-31 23:34:35 -07001078 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001079 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001080 }
David Tolnay8c81f622018-07-31 23:34:35 -07001081 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001082 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001083 }
David Tolnay8c81f622018-07-31 23:34:35 -07001084 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001085 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001086 }
1087 }
1088}
David Tolnay8c81f622018-07-31 23:34:35 -07001089#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001090pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001091 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001092 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001093 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001094 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001095 }
1096}
David Tolnay8c81f622018-07-31 23:34:35 -07001097#[cfg(any(feature = "full", feature = "derive"))]
1098#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001099pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001100 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001101 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001102 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001103 }
1104}
David Tolnay8c81f622018-07-31 23:34:35 -07001105#[cfg(any(feature = "full", feature = "derive"))]
1106pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1107 _visitor: &mut V,
1108 _i: BoundLifetimes,
1109) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001110 BoundLifetimes {
David Tolnay7ac699c2018-08-24 14:00:58 -04001111 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
1112 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001113 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001114 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001115 }
1116}
David Tolnay8c81f622018-07-31 23:34:35 -07001117#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001118pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001119 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001120 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001121 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001122 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001123 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001124 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001125 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001126 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001127 }
1128}
David Tolnay8c81f622018-07-31 23:34:35 -07001129#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001130pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001131 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001132 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1133 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1134 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001135 }
1136}
David Tolnay8c81f622018-07-31 23:34:35 -07001137#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001138pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001139 DataEnum {
David Tolnay7ac699c2018-08-24 14:00:58 -04001140 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
1141 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001142 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001143 }
1144}
David Tolnay8c81f622018-07-31 23:34:35 -07001145#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001146pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001147 DataStruct {
David Tolnay7ac699c2018-08-24 14:00:58 -04001148 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001149 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001150 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001151 }
1152}
David Tolnay8c81f622018-07-31 23:34:35 -07001153#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001154pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001155 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001156 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001157 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001158 }
1159}
David Tolnay8c81f622018-07-31 23:34:35 -07001160#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001161pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001162 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001163 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1164 vis: _visitor.fold_visibility(_i.vis),
1165 ident: _visitor.fold_ident(_i.ident),
1166 generics: _visitor.fold_generics(_i.generics),
1167 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001168 }
1169}
David Tolnay8c81f622018-07-31 23:34:35 -07001170#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001171pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001172 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001173 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1174 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1175 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1176 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1177 Expr::MethodCall(_binding_0) => {
1178 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001179 }
David Tolnay8c81f622018-07-31 23:34:35 -07001180 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1181 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1182 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1183 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1184 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1185 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
David Tolnay9c119122018-09-01 18:47:02 -07001186 Expr::Let(_binding_0) => Expr::Let(full!(_visitor.fold_expr_let(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001187 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001188 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001189 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1190 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1191 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1192 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1193 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1194 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1195 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1196 Expr::AssignOp(_binding_0) => {
1197 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001198 }
David Tolnay8c81f622018-07-31 23:34:35 -07001199 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1200 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1201 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1202 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1203 Expr::Reference(_binding_0) => {
1204 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001205 }
David Tolnay8c81f622018-07-31 23:34:35 -07001206 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1207 Expr::Continue(_binding_0) => {
1208 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001209 }
David Tolnay8c81f622018-07-31 23:34:35 -07001210 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1211 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1212 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1213 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1214 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1215 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1216 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001217 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001218 Expr::TryBlock(_binding_0) => {
1219 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1220 }
David Tolnay8c81f622018-07-31 23:34:35 -07001221 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1222 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001223 }
1224}
David Tolnay8c81f622018-07-31 23:34:35 -07001225#[cfg(feature = "full")]
1226#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001227pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001228 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001229 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001230 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001231 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001232 }
1233}
David Tolnay8c81f622018-07-31 23:34:35 -07001234#[cfg(feature = "full")]
1235#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001236pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001237 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001238 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1239 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001240 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001241 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001242 }
1243}
David Tolnay8c81f622018-07-31 23:34:35 -07001244#[cfg(feature = "full")]
1245#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001246pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001247 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001248 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1249 left: Box::new(_visitor.fold_expr(*_i.left)),
1250 op: _visitor.fold_bin_op(_i.op),
1251 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001252 }
1253}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001254#[cfg(feature = "full")]
1255#[cfg(any(feature = "full", feature = "derive"))]
1256pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1257 ExprAsync {
1258 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1259 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
1260 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1261 block: _visitor.fold_block(_i.block),
1262 }
1263}
David Tolnay8c81f622018-07-31 23:34:35 -07001264#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001265pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001266 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001267 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1268 left: Box::new(_visitor.fold_expr(*_i.left)),
1269 op: _visitor.fold_bin_op(_i.op),
1270 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001271 }
1272}
David Tolnay8c81f622018-07-31 23:34:35 -07001273#[cfg(feature = "full")]
1274#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001275pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001276 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001277 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001278 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001279 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001280 }
1281}
David Tolnay8c81f622018-07-31 23:34:35 -07001282#[cfg(feature = "full")]
1283#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001284pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001285 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001286 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001287 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001288 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001289 }
1290}
David Tolnay8c81f622018-07-31 23:34:35 -07001291#[cfg(feature = "full")]
1292#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001293pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001294 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001295 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001296 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001297 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1298 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001299 }
1300}
David Tolnay8c81f622018-07-31 23:34:35 -07001301#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001302pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001303 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001304 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1305 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001306 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001307 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001308 }
1309}
David Tolnay8c81f622018-07-31 23:34:35 -07001310#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001311pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001312 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001313 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1314 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001315 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001316 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001317 }
1318}
David Tolnay8c81f622018-07-31 23:34:35 -07001319#[cfg(feature = "full")]
1320#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001321pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001322 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001323 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001324 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001325 movability: (_i.movability).map(|it| Token ! [ static ](tokens_helper(_visitor, &it.span))),
1326 capture: (_i.capture).map(|it| Token ! [ move ](tokens_helper(_visitor, &it.span))),
1327 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001328 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001329 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001330 output: _visitor.fold_return_type(_i.output),
1331 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001332 }
1333}
David Tolnay8c81f622018-07-31 23:34:35 -07001334#[cfg(feature = "full")]
1335#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001336pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001337 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001338 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001339 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001340 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001341 }
1342}
David Tolnay8c81f622018-07-31 23:34:35 -07001343#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001344pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001345 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001346 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1347 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001348 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001349 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001350 }
1351}
David Tolnay8c81f622018-07-31 23:34:35 -07001352#[cfg(feature = "full")]
1353#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001354pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001355 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001356 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1357 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001358 for_token: Token ! [ for ](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001359 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001360 in_token: Token ! [ in ](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001361 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1362 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001363 }
1364}
David Tolnay8c81f622018-07-31 23:34:35 -07001365#[cfg(feature = "full")]
1366#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001367pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001368 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001369 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001370 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001371 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001372 }
1373}
David Tolnay8c81f622018-07-31 23:34:35 -07001374#[cfg(feature = "full")]
1375#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001376pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001377 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001378 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001379 if_token: Token ! [ if ](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001380 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1381 then_branch: _visitor.fold_block(_i.then_branch),
1382 else_branch: (_i.else_branch).map(|it| {
1383 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001384 Token ! [ else ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001385 Box::new(_visitor.fold_expr(*(it).1)),
1386 )
1387 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001388 }
1389}
David Tolnay8c81f622018-07-31 23:34:35 -07001390#[cfg(feature = "full")]
1391#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001392pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001393 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001394 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1395 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001396 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001397 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001398 }
1399}
David Tolnay8c81f622018-07-31 23:34:35 -07001400#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001401pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001402 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001403 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1404 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001405 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001406 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001407 }
1408}
David Tolnay9c119122018-09-01 18:47:02 -07001409#[cfg(feature = "full")]
1410#[cfg(any(feature = "full", feature = "derive"))]
1411pub fn fold_expr_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLet) -> ExprLet {
1412 ExprLet {
1413 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1414 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
1415 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
1416 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
1417 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1418 }
1419}
David Tolnay8c81f622018-07-31 23:34:35 -07001420#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001421pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001422 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001423 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1424 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001425 }
1426}
David Tolnay8c81f622018-07-31 23:34:35 -07001427#[cfg(feature = "full")]
1428#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001429pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001430 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001431 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1432 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001433 loop_token: Token ! [ loop ](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001434 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001435 }
1436}
David Tolnay8c81f622018-07-31 23:34:35 -07001437#[cfg(feature = "full")]
1438#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001439pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001440 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001441 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1442 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001443 }
1444}
David Tolnay8c81f622018-07-31 23:34:35 -07001445#[cfg(feature = "full")]
1446#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001447pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001448 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001449 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001450 match_token: Token ! [ match ](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001451 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001452 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001453 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001454 }
1455}
David Tolnay8c81f622018-07-31 23:34:35 -07001456#[cfg(feature = "full")]
1457#[cfg(any(feature = "full", feature = "derive"))]
1458pub fn fold_expr_method_call<V: Fold + ?Sized>(
1459 _visitor: &mut V,
1460 _i: ExprMethodCall,
1461) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001462 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001463 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1464 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001465 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001466 method: _visitor.fold_ident(_i.method),
1467 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001468 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001469 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001470 }
1471}
David Tolnay8c81f622018-07-31 23:34:35 -07001472#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001473pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001474 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001475 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001476 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001477 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001478 }
1479}
David Tolnay8c81f622018-07-31 23:34:35 -07001480#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001481pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001482 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001483 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1484 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1485 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001486 }
1487}
David Tolnay8c81f622018-07-31 23:34:35 -07001488#[cfg(feature = "full")]
1489#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001490pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001491 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001492 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1493 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1494 limits: _visitor.fold_range_limits(_i.limits),
1495 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001496 }
1497}
David Tolnay8c81f622018-07-31 23:34:35 -07001498#[cfg(feature = "full")]
1499#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay00674ba2018-03-31 18:14:11 +02001500pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1501 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001502 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001503 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
1504 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001505 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001506 }
1507}
David Tolnay8c81f622018-07-31 23:34:35 -07001508#[cfg(feature = "full")]
1509#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001510pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001511 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001512 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001513 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001514 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001515 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001516 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001517 }
1518}
David Tolnay8c81f622018-07-31 23:34:35 -07001519#[cfg(feature = "full")]
1520#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001521pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001522 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001523 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001524 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001525 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001526 }
1527}
David Tolnay8c81f622018-07-31 23:34:35 -07001528#[cfg(feature = "full")]
1529#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001530pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001531 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001532 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1533 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001534 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001535 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001536 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001537 rest: (_i.rest).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_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001543 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001544 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1545 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001546 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001547 }
1548}
David Tolnay8c81f622018-07-31 23:34:35 -07001549#[cfg(feature = "full")]
1550#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001551pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1552 ExprTryBlock {
1553 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1554 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1555 block: _visitor.fold_block(_i.block),
1556 }
1557}
1558#[cfg(feature = "full")]
1559#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001560pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001561 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001562 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001563 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001564 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001565 }
1566}
David Tolnay8c81f622018-07-31 23:34:35 -07001567#[cfg(feature = "full")]
1568#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001569pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001570 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001571 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1572 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001573 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001574 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001575 }
1576}
David Tolnay8c81f622018-07-31 23:34:35 -07001577#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001578pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001579 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001580 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1581 op: _visitor.fold_un_op(_i.op),
1582 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001583 }
1584}
David Tolnay8c81f622018-07-31 23:34:35 -07001585#[cfg(feature = "full")]
1586#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001587pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001588 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001589 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001590 unsafe_token: Token ! [ unsafe ](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001591 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001592 }
1593}
David Tolnay8c81f622018-07-31 23:34:35 -07001594#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001595pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001596 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001597}
David Tolnay8c81f622018-07-31 23:34:35 -07001598#[cfg(feature = "full")]
1599#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001600pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001601 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001602 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1603 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001604 while_token: Token ! [ while ](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001605 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1606 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001607 }
1608}
David Tolnay8c81f622018-07-31 23:34:35 -07001609#[cfg(feature = "full")]
1610#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001611pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001612 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001613 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001614 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001615 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001616 }
1617}
David Tolnay8c81f622018-07-31 23:34:35 -07001618#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001619pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001620 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001621 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1622 vis: _visitor.fold_visibility(_i.vis),
1623 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001624 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001625 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001626 }
1627}
David Tolnay8c81f622018-07-31 23:34:35 -07001628#[cfg(any(feature = "full", feature = "derive"))]
1629#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001630pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001631 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001632 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1633 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001634 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001635 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001636 }
1637}
David Tolnay8c81f622018-07-31 23:34:35 -07001638#[cfg(any(feature = "full", feature = "derive"))]
1639#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001640pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001641 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001642 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1643 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001644 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001645 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001646 }
1647}
David Tolnay8c81f622018-07-31 23:34:35 -07001648#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001649pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001650 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001651 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1652 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1653 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001654 }
1655}
David Tolnay8c81f622018-07-31 23:34:35 -07001656#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001657pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001658 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001659 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001660 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001661 }
1662}
David Tolnay8c81f622018-07-31 23:34:35 -07001663#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001664pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001665 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001666 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001667 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001668 }
1669}
David Tolnay8c81f622018-07-31 23:34:35 -07001670#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001671pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001672 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001673 shebang: _i.shebang,
1674 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1675 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001676 }
1677}
David Tolnay8c81f622018-07-31 23:34:35 -07001678#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001679pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001680 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001681 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1682 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1683 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1684 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1685 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001686 }
1687}
David Tolnay8c81f622018-07-31 23:34:35 -07001688#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001689pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001690 FnDecl {
David Tolnay7ac699c2018-08-24 14:00:58 -04001691 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001692 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001693 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001694 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001695 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001696 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001697 }
1698}
David Tolnay8c81f622018-07-31 23:34:35 -07001699#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001700pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001701 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001702 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1703 ForeignItem::Static(_binding_0) => {
1704 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001705 }
David Tolnay8c81f622018-07-31 23:34:35 -07001706 ForeignItem::Type(_binding_0) => {
1707 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001708 }
David Tolnay435c1782018-08-24 16:15:44 -04001709 ForeignItem::Macro(_binding_0) => {
1710 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1711 }
David Tolnay8c81f622018-07-31 23:34:35 -07001712 ForeignItem::Verbatim(_binding_0) => {
1713 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001714 }
Nika Layzell27726662017-10-24 23:16:35 -04001715 }
1716}
David Tolnay8c81f622018-07-31 23:34:35 -07001717#[cfg(feature = "full")]
1718pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1719 _visitor: &mut V,
1720 _i: ForeignItemFn,
1721) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001722 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001723 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1724 vis: _visitor.fold_visibility(_i.vis),
1725 ident: _visitor.fold_ident(_i.ident),
1726 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001727 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001728 }
1729}
David Tolnay8c81f622018-07-31 23:34:35 -07001730#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001731pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1732 _visitor: &mut V,
1733 _i: ForeignItemMacro,
1734) -> ForeignItemMacro {
1735 ForeignItemMacro {
1736 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1737 mac: _visitor.fold_macro(_i.mac),
1738 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1739 }
1740}
1741#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001742pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1743 _visitor: &mut V,
1744 _i: ForeignItemStatic,
1745) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001746 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001747 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1748 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001749 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
1750 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001751 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001752 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001753 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001754 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001755 }
1756}
David Tolnay8c81f622018-07-31 23:34:35 -07001757#[cfg(feature = "full")]
1758pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1759 _visitor: &mut V,
1760 _i: ForeignItemType,
1761) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001762 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001763 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1764 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001765 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001766 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001767 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001768 }
1769}
David Tolnay8c81f622018-07-31 23:34:35 -07001770#[cfg(feature = "full")]
1771pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1772 _visitor: &mut V,
1773 _i: ForeignItemVerbatim,
1774) -> ForeignItemVerbatim {
1775 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001776}
David Tolnay8c81f622018-07-31 23:34:35 -07001777#[cfg(any(feature = "full", feature = "derive"))]
1778pub fn fold_generic_argument<V: Fold + ?Sized>(
1779 _visitor: &mut V,
1780 _i: GenericArgument,
1781) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001782 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001783 GenericArgument::Lifetime(_binding_0) => {
1784 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001785 }
David Tolnay8c81f622018-07-31 23:34:35 -07001786 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1787 GenericArgument::Binding(_binding_0) => {
1788 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001789 }
David Tolnay8c81f622018-07-31 23:34:35 -07001790 GenericArgument::Const(_binding_0) => {
1791 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001792 }
Nika Layzell357885a2017-12-04 15:47:07 -05001793 }
1794}
David Tolnay8c81f622018-07-31 23:34:35 -07001795#[cfg(any(feature = "full", feature = "derive"))]
1796#[cfg(feature = "full")]
1797pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1798 _visitor: &mut V,
1799 _i: GenericMethodArgument,
1800) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001801 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001802 GenericMethodArgument::Type(_binding_0) => {
1803 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001804 }
David Tolnay8c81f622018-07-31 23:34:35 -07001805 GenericMethodArgument::Const(_binding_0) => {
1806 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001807 }
1808 }
1809}
David Tolnay8c81f622018-07-31 23:34:35 -07001810#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001811pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001812 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001813 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1814 GenericParam::Lifetime(_binding_0) => {
1815 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001816 }
David Tolnay8c81f622018-07-31 23:34:35 -07001817 GenericParam::Const(_binding_0) => {
1818 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001819 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001820 }
1821}
David Tolnay8c81f622018-07-31 23:34:35 -07001822#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001823pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001824 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001825 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001826 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001827 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001828 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001829 }
1830}
Alex Crichtond261d092018-05-18 13:47:35 -07001831pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
David Tolnaya23b4432018-05-20 20:38:44 -07001832 let mut _i = _i;
1833 let span = _visitor.fold_span(_i.span());
1834 _i.set_span(span);
1835 _i
Alex Crichtond261d092018-05-18 13:47:35 -07001836}
David Tolnay8c81f622018-07-31 23:34:35 -07001837#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001838pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001839 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001840 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1841 ImplItem::Method(_binding_0) => {
1842 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001843 }
David Tolnay8c81f622018-07-31 23:34:35 -07001844 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001845 ImplItem::Existential(_binding_0) => {
1846 ImplItem::Existential(_visitor.fold_impl_item_existential(_binding_0))
1847 }
David Tolnay8c81f622018-07-31 23:34:35 -07001848 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1849 ImplItem::Verbatim(_binding_0) => {
1850 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001851 }
Nika Layzell27726662017-10-24 23:16:35 -04001852 }
1853}
David Tolnay8c81f622018-07-31 23:34:35 -07001854#[cfg(feature = "full")]
1855pub fn fold_impl_item_const<V: Fold + ?Sized>(
1856 _visitor: &mut V,
1857 _i: ImplItemConst,
1858) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001859 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001860 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1861 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001862 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1863 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001864 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001865 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001866 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001867 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001868 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001869 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001870 }
1871}
David Tolnay8c81f622018-07-31 23:34:35 -07001872#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001873pub fn fold_impl_item_existential<V: Fold + ?Sized>(
1874 _visitor: &mut V,
1875 _i: ImplItemExistential,
1876) -> ImplItemExistential {
1877 ImplItemExistential {
1878 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1879 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
1880 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
1881 ident: _visitor.fold_ident(_i.ident),
1882 generics: _visitor.fold_generics(_i.generics),
1883 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1884 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1885 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1886 }
1887}
1888#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001889pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1890 _visitor: &mut V,
1891 _i: ImplItemMacro,
1892) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001893 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001894 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1895 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001896 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001897 }
1898}
David Tolnay8c81f622018-07-31 23:34:35 -07001899#[cfg(feature = "full")]
1900pub fn fold_impl_item_method<V: Fold + ?Sized>(
1901 _visitor: &mut V,
1902 _i: ImplItemMethod,
1903) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001904 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001905 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1906 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001907 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001908 sig: _visitor.fold_method_sig(_i.sig),
1909 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001910 }
1911}
David Tolnay8c81f622018-07-31 23:34:35 -07001912#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001913pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001914 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001915 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1916 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001917 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
1918 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001919 ident: _visitor.fold_ident(_i.ident),
1920 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001921 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001922 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001923 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001924 }
1925}
David Tolnay8c81f622018-07-31 23:34:35 -07001926#[cfg(feature = "full")]
1927pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1928 _visitor: &mut V,
1929 _i: ImplItemVerbatim,
1930) -> ImplItemVerbatim {
1931 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001932}
David Tolnay8c81f622018-07-31 23:34:35 -07001933#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001934pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001935 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001936 index: _i.index,
1937 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001938 }
1939}
David Tolnay8c81f622018-07-31 23:34:35 -07001940#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001941pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001942 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001943 Item::ExternCrate(_binding_0) => {
1944 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001945 }
David Tolnay8c81f622018-07-31 23:34:35 -07001946 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1947 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1948 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1949 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1950 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1951 Item::ForeignMod(_binding_0) => {
1952 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001953 }
David Tolnay8c81f622018-07-31 23:34:35 -07001954 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001955 Item::Existential(_binding_0) => {
1956 Item::Existential(_visitor.fold_item_existential(_binding_0))
1957 }
David Tolnay8c81f622018-07-31 23:34:35 -07001958 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1959 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1960 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1961 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07001962 Item::TraitAlias(_binding_0) => {
1963 Item::TraitAlias(_visitor.fold_item_trait_alias(_binding_0))
1964 }
David Tolnay8c81f622018-07-31 23:34:35 -07001965 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1966 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1967 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1968 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001969 }
1970}
David Tolnay8c81f622018-07-31 23:34:35 -07001971#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001972pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001973 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001974 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1975 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001976 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001977 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001978 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001979 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001980 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001981 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001982 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001983 }
1984}
David Tolnay8c81f622018-07-31 23:34:35 -07001985#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001986pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001987 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001988 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1989 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001990 enum_token: Token ! [ enum ](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001991 ident: _visitor.fold_ident(_i.ident),
1992 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001993 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001994 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001995 }
1996}
David Tolnay8c81f622018-07-31 23:34:35 -07001997#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001998pub fn fold_item_existential<V: Fold + ?Sized>(
1999 _visitor: &mut V,
2000 _i: ItemExistential,
2001) -> ItemExistential {
2002 ItemExistential {
2003 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2004 vis: _visitor.fold_visibility(_i.vis),
2005 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
2006 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
2007 ident: _visitor.fold_ident(_i.ident),
2008 generics: _visitor.fold_generics(_i.generics),
2009 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
2010 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2011 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2012 }
2013}
2014#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07002015pub fn fold_item_extern_crate<V: Fold + ?Sized>(
2016 _visitor: &mut V,
2017 _i: ItemExternCrate,
2018) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002019 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07002020 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2021 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002022 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
2023 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002024 ident: _visitor.fold_ident(_i.ident),
2025 rename: (_i.rename).map(|it| {
2026 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002027 Token ! [ as ](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002028 _visitor.fold_ident((it).1),
2029 )
2030 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002031 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002032 }
2033}
David Tolnay8c81f622018-07-31 23:34:35 -07002034#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002035pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002036 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07002037 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2038 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002039 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2040 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002041 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002042 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2043 ident: _visitor.fold_ident(_i.ident),
2044 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
2045 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002046 }
2047}
David Tolnay8c81f622018-07-31 23:34:35 -07002048#[cfg(feature = "full")]
2049pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
2050 _visitor: &mut V,
2051 _i: ItemForeignMod,
2052) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002053 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002054 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2055 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04002056 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002057 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002058 }
2059}
David Tolnay8c81f622018-07-31 23:34:35 -07002060#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002061pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08002062 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07002063 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002064 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
2065 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2066 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002067 generics: _visitor.fold_generics(_i.generics),
2068 trait_: (_i.trait_).map(|it| {
2069 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002070 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002071 _visitor.fold_path((it).1),
David Tolnay7ac699c2018-08-24 14:00:58 -04002072 Token ! [ for ](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002073 )
2074 }),
2075 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002076 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002077 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002078 }
2079}
David Tolnay8c81f622018-07-31 23:34:35 -07002080#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002081pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002082 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002083 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2084 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2085 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002086 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002087 }
2088}
David Tolnay8c81f622018-07-31 23:34:35 -07002089#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002090pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002091 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002092 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2093 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002094 macro_token: Token ! [ macro ](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002095 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002096 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002097 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002098 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002099 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002100 }
2101}
David Tolnay8c81f622018-07-31 23:34:35 -07002102#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002103pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002104 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002105 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2106 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002107 mod_token: Token ! [ mod ](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002108 ident: _visitor.fold_ident(_i.ident),
2109 content: (_i.content).map(|it| {
2110 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002111 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002112 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2113 )
2114 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002115 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002116 }
2117}
David Tolnay8c81f622018-07-31 23:34:35 -07002118#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002119pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002120 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002121 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2122 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002123 static_token: Token ! [ static ](tokens_helper(_visitor, &_i.static_token.span)),
2124 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002125 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002126 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002127 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002128 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002129 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002130 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.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_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002135 ItemStruct {
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 struct_token: Token ! [ struct ](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002139 ident: _visitor.fold_ident(_i.ident),
2140 generics: _visitor.fold_generics(_i.generics),
2141 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002142 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002143 }
2144}
David Tolnay8c81f622018-07-31 23:34:35 -07002145#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002146pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002147 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002148 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2149 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002150 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
2151 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
2152 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002153 ident: _visitor.fold_ident(_i.ident),
2154 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002155 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002156 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002157 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002158 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002159 }
2160}
David Tolnay8c81f622018-07-31 23:34:35 -07002161#[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -07002162pub fn fold_item_trait_alias<V: Fold + ?Sized>(
2163 _visitor: &mut V,
2164 _i: ItemTraitAlias,
2165) -> ItemTraitAlias {
2166 ItemTraitAlias {
2167 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2168 vis: _visitor.fold_visibility(_i.vis),
2169 trait_token: Token ! [ trait ](tokens_helper(_visitor, &_i.trait_token.span)),
2170 ident: _visitor.fold_ident(_i.ident),
2171 generics: _visitor.fold_generics(_i.generics),
2172 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
2173 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2174 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2175 }
2176}
2177#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002178pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002179 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002180 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2181 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002182 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002183 ident: _visitor.fold_ident(_i.ident),
2184 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002185 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002186 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002187 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002188 }
2189}
David Tolnay8c81f622018-07-31 23:34:35 -07002190#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002191pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002192 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002193 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2194 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002195 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002196 ident: _visitor.fold_ident(_i.ident),
2197 generics: _visitor.fold_generics(_i.generics),
2198 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002199 }
2200}
David Tolnay8c81f622018-07-31 23:34:35 -07002201#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002202pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002203 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002204 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2205 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002206 use_token: Token ! [ use ](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002207 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002208 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002209 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002210 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002211 }
2212}
David Tolnay8c81f622018-07-31 23:34:35 -07002213#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002214pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002215 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002216}
David Tolnay8c81f622018-07-31 23:34:35 -07002217#[cfg(any(feature = "full", feature = "derive"))]
2218#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002219pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002220 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002221 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002222 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002223 }
2224}
Alex Crichton131308c2018-05-18 14:00:24 -07002225pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2226 Lifetime {
David Tolnay17f63892018-08-31 10:36:32 -07002227 apostrophe: _visitor.fold_span(_i.apostrophe),
David Tolnay8c81f622018-07-31 23:34:35 -07002228 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002229 }
2230}
David Tolnay8c81f622018-07-31 23:34:35 -07002231#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002232pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002233 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002234 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2235 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002236 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002237 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002238 }
2239}
David Tolnay8c81f622018-07-31 23:34:35 -07002240#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002241pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002242 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002243 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2244 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2245 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2246 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2247 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2248 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2249 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2250 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002251 }
2252}
David Tolnay8c81f622018-07-31 23:34:35 -07002253#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002254pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002255 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002256 value: _i.value,
2257 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002258 }
2259}
David Tolnay8c81f622018-07-31 23:34:35 -07002260#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002261pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002262 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002263}
David Tolnay8c81f622018-07-31 23:34:35 -07002264#[cfg(any(feature = "full", feature = "derive"))]
2265#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002266pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002267 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002268 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002269 let_token: Token ! [ let ](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002270 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2271 ty: (_i.ty).map(|it| {
2272 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002273 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002274 Box::new(_visitor.fold_type(*(it).1)),
2275 )
2276 }),
2277 init: (_i.init).map(|it| {
2278 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002279 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002280 Box::new(_visitor.fold_expr(*(it).1)),
2281 )
2282 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002283 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002284 }
2285}
David Tolnay8c81f622018-07-31 23:34:35 -07002286#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002287pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002288 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002289 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002290 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002291 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2292 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002293 }
2294}
David Tolnay8c81f622018-07-31 23:34:35 -07002295#[cfg(any(feature = "full", feature = "derive"))]
2296pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2297 _visitor: &mut V,
2298 _i: MacroDelimiter,
2299) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002300 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002301 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002302 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002303 }
David Tolnay8c81f622018-07-31 23:34:35 -07002304 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002305 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002306 }
David Tolnay8c81f622018-07-31 23:34:35 -07002307 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002308 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002309 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002310 }
2311}
David Tolnay8c81f622018-07-31 23:34:35 -07002312#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002313pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002314 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002315 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2316 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002317 }
2318}
David Tolnay8c81f622018-07-31 23:34:35 -07002319#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002320pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002321 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002322 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2323 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2324 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002325 }
2326}
David Tolnay8c81f622018-07-31 23:34:35 -07002327#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002328pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2329 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002330 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002331 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002332 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002333 }
2334}
David Tolnay8c81f622018-07-31 23:34:35 -07002335#[cfg(any(feature = "full", feature = "derive"))]
2336pub fn fold_meta_name_value<V: Fold + ?Sized>(
2337 _visitor: &mut V,
2338 _i: MetaNameValue,
2339) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002340 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002341 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002342 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002343 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002344 }
2345}
David Tolnay8c81f622018-07-31 23:34:35 -07002346#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002347pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002348 MethodSig {
David Tolnay7ac699c2018-08-24 14:00:58 -04002349 constness: (_i.constness).map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2350 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002351 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002352 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2353 ident: _visitor.fold_ident(_i.ident),
2354 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002355 }
2356}
David Tolnay8c81f622018-07-31 23:34:35 -07002357#[cfg(any(feature = "full", feature = "derive"))]
2358#[cfg(feature = "full")]
2359pub fn fold_method_turbofish<V: Fold + ?Sized>(
2360 _visitor: &mut V,
2361 _i: MethodTurbofish,
2362) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002363 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002364 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2365 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002366 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002367 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002368 }
2369}
David Tolnay8c81f622018-07-31 23:34:35 -07002370#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002371pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002372 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002373 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2374 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002375 }
2376}
David Tolnay8c81f622018-07-31 23:34:35 -07002377#[cfg(any(feature = "full", feature = "derive"))]
2378pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2379 _visitor: &mut V,
2380 _i: ParenthesizedGenericArguments,
2381) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002382 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002383 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002384 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2385 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002386 }
2387}
David Tolnay8c81f622018-07-31 23:34:35 -07002388#[cfg(any(feature = "full", feature = "derive"))]
2389#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002390pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002391 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002392 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2393 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2394 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2395 Pat::TupleStruct(_binding_0) => {
2396 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002397 }
David Tolnay8c81f622018-07-31 23:34:35 -07002398 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2399 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2400 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2401 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2402 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2403 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2404 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2405 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2406 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002407 }
2408}
David Tolnay8c81f622018-07-31 23:34:35 -07002409#[cfg(any(feature = "full", feature = "derive"))]
2410#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002411pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002412 PatBox {
David Tolnay7ac699c2018-08-24 14:00:58 -04002413 box_token: Token ! [ box ](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002414 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002415 }
2416}
David Tolnay8c81f622018-07-31 23:34:35 -07002417#[cfg(any(feature = "full", feature = "derive"))]
2418#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002419pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002420 PatIdent {
David Tolnay7ac699c2018-08-24 14:00:58 -04002421 by_ref: (_i.by_ref).map(|it| Token ! [ ref ](tokens_helper(_visitor, &it.span))),
2422 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002423 ident: _visitor.fold_ident(_i.ident),
2424 subpat: (_i.subpat).map(|it| {
2425 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002426 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002427 Box::new(_visitor.fold_pat(*(it).1)),
2428 )
2429 }),
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_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002435 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002436 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002437 }
2438}
David Tolnay8c81f622018-07-31 23:34:35 -07002439#[cfg(any(feature = "full", feature = "derive"))]
2440#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002441pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002442 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002443 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002444 }
2445}
David Tolnay8c81f622018-07-31 23:34:35 -07002446#[cfg(any(feature = "full", feature = "derive"))]
2447#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002448pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002449 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002450 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2451 path: _visitor.fold_path(_i.path),
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_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002457 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002458 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2459 limits: _visitor.fold_range_limits(_i.limits),
2460 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002461 }
2462}
David Tolnay8c81f622018-07-31 23:34:35 -07002463#[cfg(any(feature = "full", feature = "derive"))]
2464#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002465pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002466 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002467 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
2468 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002469 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002470 }
2471}
David Tolnay8c81f622018-07-31 23:34:35 -07002472#[cfg(any(feature = "full", feature = "derive"))]
2473#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002474pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002475 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002476 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002477 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2478 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002479 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2480 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002481 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002482 }
2483}
David Tolnay8c81f622018-07-31 23:34:35 -07002484#[cfg(any(feature = "full", feature = "derive"))]
2485#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002486pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002487 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002488 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002489 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002490 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002491 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002492 }
2493}
David Tolnay8c81f622018-07-31 23:34:35 -07002494#[cfg(any(feature = "full", feature = "derive"))]
2495#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002496pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002497 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002498 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002499 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002500 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2501 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002502 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002503 }
2504}
David Tolnay8c81f622018-07-31 23:34:35 -07002505#[cfg(any(feature = "full", feature = "derive"))]
2506#[cfg(feature = "full")]
2507pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2508 _visitor: &mut V,
2509 _i: PatTupleStruct,
2510) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002511 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002512 path: _visitor.fold_path(_i.path),
2513 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002514 }
2515}
David Tolnay8c81f622018-07-31 23:34:35 -07002516#[cfg(any(feature = "full", feature = "derive"))]
2517#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002518pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002519 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002520}
David Tolnay8c81f622018-07-31 23:34:35 -07002521#[cfg(any(feature = "full", feature = "derive"))]
2522#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002523pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002524 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002525 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002526 }
2527}
David Tolnay8c81f622018-07-31 23:34:35 -07002528#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002529pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002530 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002531 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002532 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002533 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002534 }
2535}
David Tolnay8c81f622018-07-31 23:34:35 -07002536#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002537pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002538 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002539 PathArguments::None => PathArguments::None,
2540 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2541 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2542 ),
2543 PathArguments::Parenthesized(_binding_0) => {
2544 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002545 }
2546 }
2547}
David Tolnay8c81f622018-07-31 23:34:35 -07002548#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002549pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002550 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002551 ident: _visitor.fold_ident(_i.ident),
2552 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002553 }
2554}
David Tolnay8c81f622018-07-31 23:34:35 -07002555#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002556pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002557 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002558 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002559 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002560 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002561 }
2562}
David Tolnay8c81f622018-07-31 23:34:35 -07002563#[cfg(any(feature = "full", feature = "derive"))]
2564pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2565 _visitor: &mut V,
2566 _i: PredicateLifetime,
2567) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002568 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002569 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay1b8e2852018-08-26 08:25:18 -04002570 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002571 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002572 }
2573}
David Tolnay8c81f622018-07-31 23:34:35 -07002574#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002575pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002576 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002577 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2578 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002579 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002580 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002581 }
2582}
David Tolnay8c81f622018-07-31 23:34:35 -07002583#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002584pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002585 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002586 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002587 ty: Box::new(_visitor.fold_type(*_i.ty)),
2588 position: _i.position,
David Tolnay7ac699c2018-08-24 14:00:58 -04002589 as_token: (_i.as_token).map(|it| Token ! [ as ](tokens_helper(_visitor, &it.span))),
2590 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002591 }
2592}
David Tolnay8c81f622018-07-31 23:34:35 -07002593#[cfg(any(feature = "full", feature = "derive"))]
2594#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002595pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002596 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002597 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002598 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002599 }
David Tolnay8c81f622018-07-31 23:34:35 -07002600 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002601 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002602 }
2603 }
2604}
David Tolnay8c81f622018-07-31 23:34:35 -07002605#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002606pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002607 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002608 ReturnType::Default => ReturnType::Default,
2609 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002610 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002611 Box::new(_visitor.fold_type(*_binding_1)),
2612 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002613 }
2614}
David Tolnay4b4c4b62018-01-06 13:48:05 -08002615pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
Nika Layzellefb83ba2017-12-19 18:23:55 -05002616 _i
2617}
David Tolnay8c81f622018-07-31 23:34:35 -07002618#[cfg(any(feature = "full", feature = "derive"))]
2619#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002620pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002621 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002622 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2623 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2624 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2625 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2626 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002627 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002628 ),
Nika Layzell27726662017-10-24 23:16:35 -04002629 }
2630}
David Tolnay8c81f622018-07-31 23:34:35 -07002631#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002632pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002633 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002634 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002635 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2636 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2637 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002638 }
2639}
David Tolnay8c81f622018-07-31 23:34:35 -07002640#[cfg(any(feature = "full", feature = "derive"))]
2641pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2642 _visitor: &mut V,
2643 _i: TraitBoundModifier,
2644) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002645 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002646 TraitBoundModifier::None => TraitBoundModifier::None,
2647 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002648 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002649 }
2650 }
2651}
David Tolnay8c81f622018-07-31 23:34:35 -07002652#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002653pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002654 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002655 TraitItem::Const(_binding_0) => {
2656 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002657 }
David Tolnay8c81f622018-07-31 23:34:35 -07002658 TraitItem::Method(_binding_0) => {
2659 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002660 }
David Tolnay8c81f622018-07-31 23:34:35 -07002661 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2662 TraitItem::Macro(_binding_0) => {
2663 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002664 }
David Tolnay8c81f622018-07-31 23:34:35 -07002665 TraitItem::Verbatim(_binding_0) => {
2666 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002667 }
Nika Layzell27726662017-10-24 23:16:35 -04002668 }
2669}
David Tolnay8c81f622018-07-31 23:34:35 -07002670#[cfg(feature = "full")]
2671pub fn fold_trait_item_const<V: Fold + ?Sized>(
2672 _visitor: &mut V,
2673 _i: TraitItemConst,
2674) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002675 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002676 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002677 const_token: Token ! [ const ](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002678 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002679 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002680 ty: _visitor.fold_type(_i.ty),
2681 default: (_i.default).map(|it| {
2682 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002683 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002684 _visitor.fold_expr((it).1),
2685 )
2686 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002687 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002688 }
2689}
David Tolnay8c81f622018-07-31 23:34:35 -07002690#[cfg(feature = "full")]
2691pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2692 _visitor: &mut V,
2693 _i: TraitItemMacro,
2694) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002695 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002696 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2697 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002698 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002699 }
2700}
David Tolnay8c81f622018-07-31 23:34:35 -07002701#[cfg(feature = "full")]
2702pub fn fold_trait_item_method<V: Fold + ?Sized>(
2703 _visitor: &mut V,
2704 _i: TraitItemMethod,
2705) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002706 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002707 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2708 sig: _visitor.fold_method_sig(_i.sig),
2709 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002710 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002711 }
2712}
David Tolnay8c81f622018-07-31 23:34:35 -07002713#[cfg(feature = "full")]
2714pub fn fold_trait_item_type<V: Fold + ?Sized>(
2715 _visitor: &mut V,
2716 _i: TraitItemType,
2717) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002718 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002719 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002720 type_token: Token ! [ type ](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002721 ident: _visitor.fold_ident(_i.ident),
2722 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002723 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002724 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2725 default: (_i.default).map(|it| {
2726 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002727 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002728 _visitor.fold_type((it).1),
2729 )
2730 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002731 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002732 }
2733}
David Tolnay8c81f622018-07-31 23:34:35 -07002734#[cfg(feature = "full")]
2735pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2736 _visitor: &mut V,
2737 _i: TraitItemVerbatim,
2738) -> TraitItemVerbatim {
2739 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002740}
David Tolnay8c81f622018-07-31 23:34:35 -07002741#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002742pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002743 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002744 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2745 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2746 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2747 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2748 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2749 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2750 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2751 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2752 Type::TraitObject(_binding_0) => {
2753 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002754 }
David Tolnay8c81f622018-07-31 23:34:35 -07002755 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2756 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2757 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2758 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2759 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2760 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002761 }
2762}
David Tolnay8c81f622018-07-31 23:34:35 -07002763#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002764pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002765 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002766 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002767 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002768 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002769 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002770 }
2771}
David Tolnay8c81f622018-07-31 23:34:35 -07002772#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002773pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002774 TypeBareFn {
David Tolnay3779bb72018-08-26 18:46:07 -07002775 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002776 unsafety: (_i.unsafety).map(|it| Token ! [ unsafe ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002777 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002778 fn_token: Token ! [ fn ](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002779 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002780 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002781 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002782 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002783 }
2784}
David Tolnay8c81f622018-07-31 23:34:35 -07002785#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002786pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002787 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002788 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002789 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002790 }
2791}
David Tolnay8c81f622018-07-31 23:34:35 -07002792#[cfg(any(feature = "full", feature = "derive"))]
2793pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2794 _visitor: &mut V,
2795 _i: TypeImplTrait,
2796) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002797 TypeImplTrait {
David Tolnay7ac699c2018-08-24 14:00:58 -04002798 impl_token: Token![impl ](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002799 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002800 }
2801}
David Tolnay8c81f622018-07-31 23:34:35 -07002802#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002803pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002804 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002805 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002806 }
2807}
David Tolnay8c81f622018-07-31 23:34:35 -07002808#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002809pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002810 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002811 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002812 }
2813}
David Tolnay8c81f622018-07-31 23:34:35 -07002814#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002815pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002816 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002817 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002818 }
2819}
David Tolnay8c81f622018-07-31 23:34:35 -07002820#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002821pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002822 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002823 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2824 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002825 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002826 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002827 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002828 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002829 }
2830}
David Tolnay8c81f622018-07-31 23:34:35 -07002831#[cfg(any(feature = "full", feature = "derive"))]
2832pub fn fold_type_param_bound<V: Fold + ?Sized>(
2833 _visitor: &mut V,
2834 _i: TypeParamBound,
2835) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002836 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002837 TypeParamBound::Trait(_binding_0) => {
2838 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002839 }
David Tolnay8c81f622018-07-31 23:34:35 -07002840 TypeParamBound::Lifetime(_binding_0) => {
2841 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002842 }
2843 }
2844}
David Tolnay8c81f622018-07-31 23:34:35 -07002845#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002846pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002847 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002848 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002849 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002850 }
2851}
David Tolnay8c81f622018-07-31 23:34:35 -07002852#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002853pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002854 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002855 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2856 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002857 }
2858}
David Tolnay8c81f622018-07-31 23:34:35 -07002859#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002860pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002861 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002862 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
2863 const_token: (_i.const_token)
2864 .map(|it| Token ! [ const ](tokens_helper(_visitor, &it.span))),
2865 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002866 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002867 }
2868}
David Tolnay8c81f622018-07-31 23:34:35 -07002869#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002870pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002871 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002872 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002873 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002874 mutability: (_i.mutability).map(|it| Token ! [ mut ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002875 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002876 }
2877}
David Tolnay8c81f622018-07-31 23:34:35 -07002878#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002879pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002880 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002881 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002882 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002883 }
2884}
David Tolnay8c81f622018-07-31 23:34:35 -07002885#[cfg(any(feature = "full", feature = "derive"))]
2886pub fn fold_type_trait_object<V: Fold + ?Sized>(
2887 _visitor: &mut V,
2888 _i: TypeTraitObject,
2889) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002890 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002891 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002892 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002893 }
2894}
David Tolnay8c81f622018-07-31 23:34:35 -07002895#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002896pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002897 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002898 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002899 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002900 }
2901}
David Tolnay8c81f622018-07-31 23:34:35 -07002902#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002903pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002904 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002905}
David Tolnay8c81f622018-07-31 23:34:35 -07002906#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002907pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002908 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002909 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002910 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002911 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002912 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2913 UnOp::Neg(_binding_0) => {
2914 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2915 }
Nika Layzell27726662017-10-24 23:16:35 -04002916 }
2917}
David Tolnay8c81f622018-07-31 23:34:35 -07002918#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002919pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002920 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002921 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002922 }
2923}
David Tolnay8c81f622018-07-31 23:34:35 -07002924#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002925pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2926 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002927 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002928 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002929 }
2930}
David Tolnay8c81f622018-07-31 23:34:35 -07002931#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002932pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2933 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002934 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002935 }
2936}
David Tolnay8c81f622018-07-31 23:34:35 -07002937#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002938pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002939 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002940 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002941 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002942 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002943 }
2944}
David Tolnay8c81f622018-07-31 23:34:35 -07002945#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002946pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2947 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002948 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002949 as_token: Token ! [ as ](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002950 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002951 }
2952}
David Tolnay8c81f622018-07-31 23:34:35 -07002953#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002954pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002955 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002956 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2957 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2958 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2959 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2960 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002961 }
2962}
David Tolnay8c81f622018-07-31 23:34:35 -07002963#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002964pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002965 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002966 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2967 ident: _visitor.fold_ident(_i.ident),
2968 fields: _visitor.fold_fields(_i.fields),
2969 discriminant: (_i.discriminant).map(|it| {
2970 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002971 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002972 _visitor.fold_expr((it).1),
2973 )
2974 }),
Nika Layzell27726662017-10-24 23:16:35 -04002975 }
2976}
David Tolnay8c81f622018-07-31 23:34:35 -07002977#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002978pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002979 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002980 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002981 }
2982}
David Tolnay8c81f622018-07-31 23:34:35 -07002983#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002984pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002985 VisPublic {
David Tolnay7ac699c2018-08-24 14:00:58 -04002986 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002987 }
2988}
David Tolnay8c81f622018-07-31 23:34:35 -07002989#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002990pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002991 VisRestricted {
David Tolnay7ac699c2018-08-24 14:00:58 -04002992 pub_token: Token ! [ pub ](tokens_helper(_visitor, &_i.pub_token.span)),
2993 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
2994 in_token: (_i.in_token).map(|it| Token ! [ in ](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002995 path: Box::new(_visitor.fold_path(*_i.path)),
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_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04003000 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003001 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
3002 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
3003 Visibility::Restricted(_binding_0) => {
3004 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003005 }
David Tolnay8c81f622018-07-31 23:34:35 -07003006 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04003007 }
3008}
David Tolnay8c81f622018-07-31 23:34:35 -07003009#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08003010pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04003011 WhereClause {
David Tolnay7ac699c2018-08-24 14:00:58 -04003012 where_token: Token ! [ where ](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07003013 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04003014 }
3015}
David Tolnay8c81f622018-07-31 23:34:35 -07003016#[cfg(any(feature = "full", feature = "derive"))]
3017pub fn fold_where_predicate<V: Fold + ?Sized>(
3018 _visitor: &mut V,
3019 _i: WherePredicate,
3020) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04003021 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07003022 WherePredicate::Type(_binding_0) => {
3023 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003024 }
David Tolnay8c81f622018-07-31 23:34:35 -07003025 WherePredicate::Lifetime(_binding_0) => {
3026 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003027 }
David Tolnay8c81f622018-07-31 23:34:35 -07003028 WherePredicate::Eq(_binding_0) => {
3029 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04003030 }
3031 }
3032}