blob: ed6b3c0ea40722334eb2e2bc0aaa7cc954163ecd [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 Tolnay0a0d78c2018-01-05 15:24:01 -08004#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05005use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07006use proc_macro2::Span;
7#[cfg(any(feature = "full", feature = "derive"))]
8use token::{Brace, Bracket, Group, Paren};
9use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040010#[cfg(feature = "full")]
11macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070012 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070013 $e
14 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040015}
David Tolnay0a0d78c2018-01-05 15:24:01 -080016#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040017macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070018 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070019 unreachable!()
20 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040021}
David Tolnay53160352019-02-07 23:36:17 +010022/// Syntax tree traversal to transform the nodes of an owned syntax tree.
23///
24/// See the [module documentation] for details.
25///
26/// [module documentation]: index.html
27///
28/// *This trait is available if Syn is built with the `"fold"` feature.*
David Tolnay4b4c4b62018-01-06 13:48:05 -080029pub trait Fold {
David Tolnay440fe582019-02-15 20:23:14 -080030 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070031 fn fold_abi(&mut self, i: Abi) -> Abi {
32 fold_abi(self, i)
33 }
David Tolnay440fe582019-02-15 20:23:14 -080034 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070035 fn fold_angle_bracketed_generic_arguments(
36 &mut self,
37 i: AngleBracketedGenericArguments,
38 ) -> AngleBracketedGenericArguments {
39 fold_angle_bracketed_generic_arguments(self, i)
40 }
41 #[cfg(feature = "full")]
42 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
43 fold_arg_captured(self, i)
44 }
45 #[cfg(feature = "full")]
46 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
47 fold_arg_self(self, i)
48 }
49 #[cfg(feature = "full")]
50 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
51 fold_arg_self_ref(self, i)
52 }
David Tolnay8c81f622018-07-31 23:34:35 -070053 #[cfg(feature = "full")]
54 fn fold_arm(&mut self, i: Arm) -> Arm {
55 fold_arm(self, i)
56 }
David Tolnay440fe582019-02-15 20:23:14 -080057 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070058 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
59 fold_attr_style(self, i)
60 }
David Tolnay440fe582019-02-15 20:23:14 -080061 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070062 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
63 fold_attribute(self, i)
64 }
David Tolnay440fe582019-02-15 20:23:14 -080065 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070066 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
67 fold_bare_fn_arg(self, i)
68 }
David Tolnay440fe582019-02-15 20:23:14 -080069 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070070 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
71 fold_bare_fn_arg_name(self, i)
72 }
David Tolnay440fe582019-02-15 20:23:14 -080073 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070074 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
75 fold_bin_op(self, i)
76 }
David Tolnay440fe582019-02-15 20:23:14 -080077 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070078 fn fold_binding(&mut self, i: Binding) -> Binding {
79 fold_binding(self, i)
80 }
David Tolnay8c81f622018-07-31 23:34:35 -070081 #[cfg(feature = "full")]
82 fn fold_block(&mut self, i: Block) -> Block {
83 fold_block(self, i)
84 }
David Tolnay440fe582019-02-15 20:23:14 -080085 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070086 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
87 fold_bound_lifetimes(self, i)
88 }
David Tolnay440fe582019-02-15 20:23:14 -080089 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070090 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
91 fold_const_param(self, i)
92 }
David Tolnay440fe582019-02-15 20:23:14 -080093 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay9d0882a2018-09-01 19:49:14 -070094 fn fold_constraint(&mut self, i: Constraint) -> Constraint {
95 fold_constraint(self, i)
96 }
David Tolnay8c81f622018-07-31 23:34:35 -070097 #[cfg(feature = "derive")]
98 fn fold_data(&mut self, i: Data) -> Data {
99 fold_data(self, i)
100 }
101 #[cfg(feature = "derive")]
102 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
103 fold_data_enum(self, i)
104 }
105 #[cfg(feature = "derive")]
106 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
107 fold_data_struct(self, i)
108 }
109 #[cfg(feature = "derive")]
110 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
111 fold_data_union(self, i)
112 }
113 #[cfg(feature = "derive")]
114 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
115 fold_derive_input(self, i)
116 }
David Tolnay440fe582019-02-15 20:23:14 -0800117 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700118 fn fold_expr(&mut self, i: Expr) -> Expr {
119 fold_expr(self, i)
120 }
121 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700122 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
123 fold_expr_array(self, i)
124 }
125 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700126 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
127 fold_expr_assign(self, i)
128 }
129 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700130 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
131 fold_expr_assign_op(self, i)
132 }
David Tolnay02a9c6f2018-08-24 18:58:45 -0400133 #[cfg(feature = "full")]
David Tolnay02a9c6f2018-08-24 18:58:45 -0400134 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
135 fold_expr_async(self, i)
136 }
David Tolnay440fe582019-02-15 20:23:14 -0800137 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700138 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
139 fold_expr_binary(self, i)
140 }
141 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700142 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
143 fold_expr_block(self, i)
144 }
145 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700146 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
147 fold_expr_box(self, i)
148 }
149 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700150 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
151 fold_expr_break(self, i)
152 }
David Tolnay440fe582019-02-15 20:23:14 -0800153 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700154 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
155 fold_expr_call(self, i)
156 }
David Tolnay440fe582019-02-15 20:23:14 -0800157 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700158 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
159 fold_expr_cast(self, i)
160 }
161 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700162 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
163 fold_expr_closure(self, i)
164 }
165 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700166 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
167 fold_expr_continue(self, i)
168 }
David Tolnay440fe582019-02-15 20:23:14 -0800169 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700170 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
171 fold_expr_field(self, i)
172 }
173 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700174 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
175 fold_expr_for_loop(self, i)
176 }
177 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700178 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
179 fold_expr_group(self, i)
180 }
181 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700182 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
183 fold_expr_if(self, i)
184 }
185 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700186 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
187 fold_expr_in_place(self, i)
188 }
David Tolnay440fe582019-02-15 20:23:14 -0800189 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700190 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
191 fold_expr_index(self, i)
192 }
David Tolnay9c119122018-09-01 18:47:02 -0700193 #[cfg(feature = "full")]
David Tolnay9c119122018-09-01 18:47:02 -0700194 fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet {
195 fold_expr_let(self, i)
196 }
David Tolnay440fe582019-02-15 20:23:14 -0800197 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700198 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
199 fold_expr_lit(self, i)
200 }
201 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700202 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
203 fold_expr_loop(self, i)
204 }
205 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700206 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
207 fold_expr_macro(self, i)
208 }
209 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700210 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
211 fold_expr_match(self, i)
212 }
213 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700214 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
215 fold_expr_method_call(self, i)
216 }
David Tolnay440fe582019-02-15 20:23:14 -0800217 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700218 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
219 fold_expr_paren(self, i)
220 }
David Tolnay440fe582019-02-15 20:23:14 -0800221 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700222 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
223 fold_expr_path(self, i)
224 }
225 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700226 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
227 fold_expr_range(self, i)
228 }
229 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700230 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
231 fold_expr_reference(self, i)
232 }
233 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700234 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
235 fold_expr_repeat(self, i)
236 }
237 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700238 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
239 fold_expr_return(self, i)
240 }
241 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700242 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
243 fold_expr_struct(self, i)
244 }
245 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700246 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
247 fold_expr_try(self, i)
248 }
249 #[cfg(feature = "full")]
David Tolnayfb2dd4b2018-08-24 16:45:34 -0400250 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
251 fold_expr_try_block(self, i)
252 }
253 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700254 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
255 fold_expr_tuple(self, i)
256 }
257 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700258 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
259 fold_expr_type(self, i)
260 }
David Tolnay440fe582019-02-15 20:23:14 -0800261 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700262 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
263 fold_expr_unary(self, i)
264 }
265 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700266 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
267 fold_expr_unsafe(self, i)
268 }
David Tolnay440fe582019-02-15 20:23:14 -0800269 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700270 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
271 fold_expr_verbatim(self, i)
272 }
273 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700274 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
275 fold_expr_while(self, i)
276 }
277 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700278 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
279 fold_expr_yield(self, i)
280 }
David Tolnay440fe582019-02-15 20:23:14 -0800281 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700282 fn fold_field(&mut self, i: Field) -> Field {
283 fold_field(self, i)
284 }
David Tolnay8c81f622018-07-31 23:34:35 -0700285 #[cfg(feature = "full")]
286 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
287 fold_field_pat(self, i)
288 }
David Tolnay8c81f622018-07-31 23:34:35 -0700289 #[cfg(feature = "full")]
290 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
291 fold_field_value(self, i)
292 }
David Tolnay440fe582019-02-15 20:23:14 -0800293 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700294 fn fold_fields(&mut self, i: Fields) -> Fields {
295 fold_fields(self, i)
296 }
David Tolnay440fe582019-02-15 20:23:14 -0800297 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700298 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
299 fold_fields_named(self, i)
300 }
David Tolnay440fe582019-02-15 20:23:14 -0800301 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700302 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
303 fold_fields_unnamed(self, i)
304 }
305 #[cfg(feature = "full")]
306 fn fold_file(&mut self, i: File) -> File {
307 fold_file(self, i)
308 }
309 #[cfg(feature = "full")]
310 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
311 fold_fn_arg(self, i)
312 }
313 #[cfg(feature = "full")]
314 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
315 fold_fn_decl(self, i)
316 }
317 #[cfg(feature = "full")]
318 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
319 fold_foreign_item(self, i)
320 }
321 #[cfg(feature = "full")]
322 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
323 fold_foreign_item_fn(self, i)
324 }
325 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400326 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
327 fold_foreign_item_macro(self, i)
328 }
329 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700330 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
331 fold_foreign_item_static(self, i)
332 }
333 #[cfg(feature = "full")]
334 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
335 fold_foreign_item_type(self, i)
336 }
337 #[cfg(feature = "full")]
338 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
339 fold_foreign_item_verbatim(self, i)
340 }
David Tolnay440fe582019-02-15 20:23:14 -0800341 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700342 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
343 fold_generic_argument(self, i)
344 }
David Tolnay8c81f622018-07-31 23:34:35 -0700345 #[cfg(feature = "full")]
346 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
347 fold_generic_method_argument(self, i)
348 }
David Tolnay440fe582019-02-15 20:23:14 -0800349 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700350 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
351 fold_generic_param(self, i)
352 }
David Tolnay440fe582019-02-15 20:23:14 -0800353 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700354 fn fold_generics(&mut self, i: Generics) -> Generics {
355 fold_generics(self, i)
356 }
David Tolnay8c81f622018-07-31 23:34:35 -0700357 #[cfg(feature = "full")]
358 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
359 fold_impl_item(self, i)
360 }
361 #[cfg(feature = "full")]
362 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
363 fold_impl_item_const(self, i)
364 }
365 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400366 fn fold_impl_item_existential(&mut self, i: ImplItemExistential) -> ImplItemExistential {
367 fold_impl_item_existential(self, i)
368 }
369 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700370 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
371 fold_impl_item_macro(self, i)
372 }
373 #[cfg(feature = "full")]
374 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
375 fold_impl_item_method(self, i)
376 }
377 #[cfg(feature = "full")]
378 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
379 fold_impl_item_type(self, i)
380 }
381 #[cfg(feature = "full")]
382 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
383 fold_impl_item_verbatim(self, i)
384 }
David Tolnay440fe582019-02-15 20:23:14 -0800385 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700386 fn fold_index(&mut self, i: Index) -> Index {
387 fold_index(self, i)
388 }
389 #[cfg(feature = "full")]
390 fn fold_item(&mut self, i: Item) -> Item {
391 fold_item(self, i)
392 }
393 #[cfg(feature = "full")]
394 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
395 fold_item_const(self, i)
396 }
397 #[cfg(feature = "full")]
398 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
399 fold_item_enum(self, i)
400 }
401 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400402 fn fold_item_existential(&mut self, i: ItemExistential) -> ItemExistential {
403 fold_item_existential(self, i)
404 }
405 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700406 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
407 fold_item_extern_crate(self, i)
408 }
409 #[cfg(feature = "full")]
410 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
411 fold_item_fn(self, i)
412 }
413 #[cfg(feature = "full")]
414 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
415 fold_item_foreign_mod(self, i)
416 }
417 #[cfg(feature = "full")]
418 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
419 fold_item_impl(self, i)
420 }
421 #[cfg(feature = "full")]
422 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
423 fold_item_macro(self, i)
424 }
425 #[cfg(feature = "full")]
426 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
427 fold_item_macro2(self, i)
428 }
429 #[cfg(feature = "full")]
430 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
431 fold_item_mod(self, i)
432 }
433 #[cfg(feature = "full")]
434 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
435 fold_item_static(self, i)
436 }
437 #[cfg(feature = "full")]
438 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
439 fold_item_struct(self, i)
440 }
441 #[cfg(feature = "full")]
442 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
443 fold_item_trait(self, i)
444 }
445 #[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -0700446 fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias {
447 fold_item_trait_alias(self, i)
448 }
449 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700450 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
451 fold_item_type(self, i)
452 }
453 #[cfg(feature = "full")]
454 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
455 fold_item_union(self, i)
456 }
457 #[cfg(feature = "full")]
458 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
459 fold_item_use(self, i)
460 }
461 #[cfg(feature = "full")]
462 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
463 fold_item_verbatim(self, i)
464 }
David Tolnay8c81f622018-07-31 23:34:35 -0700465 #[cfg(feature = "full")]
466 fn fold_label(&mut self, i: Label) -> Label {
467 fold_label(self, i)
468 }
David Tolnay8c81f622018-07-31 23:34:35 -0700469 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
470 fold_lifetime(self, i)
471 }
David Tolnay440fe582019-02-15 20:23:14 -0800472 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700473 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
474 fold_lifetime_def(self, i)
475 }
David Tolnay440fe582019-02-15 20:23:14 -0800476 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700477 fn fold_lit(&mut self, i: Lit) -> Lit {
478 fold_lit(self, i)
479 }
David Tolnay440fe582019-02-15 20:23:14 -0800480 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700481 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
482 fold_lit_bool(self, i)
483 }
David Tolnay440fe582019-02-15 20:23:14 -0800484 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700485 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
486 fold_lit_byte(self, i)
487 }
David Tolnay440fe582019-02-15 20:23:14 -0800488 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700489 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
490 fold_lit_byte_str(self, i)
491 }
David Tolnay440fe582019-02-15 20:23:14 -0800492 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700493 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
494 fold_lit_char(self, i)
495 }
David Tolnay440fe582019-02-15 20:23:14 -0800496 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700497 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
498 fold_lit_float(self, i)
499 }
David Tolnay440fe582019-02-15 20:23:14 -0800500 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700501 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
502 fold_lit_int(self, i)
503 }
David Tolnay440fe582019-02-15 20:23:14 -0800504 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700505 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
506 fold_lit_str(self, i)
507 }
David Tolnay440fe582019-02-15 20:23:14 -0800508 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700509 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
510 fold_lit_verbatim(self, i)
511 }
David Tolnay8c81f622018-07-31 23:34:35 -0700512 #[cfg(feature = "full")]
513 fn fold_local(&mut self, i: Local) -> Local {
514 fold_local(self, i)
515 }
David Tolnay440fe582019-02-15 20:23:14 -0800516 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700517 fn fold_macro(&mut self, i: Macro) -> Macro {
518 fold_macro(self, i)
519 }
David Tolnay440fe582019-02-15 20:23:14 -0800520 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700521 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
522 fold_macro_delimiter(self, i)
523 }
David Tolnay440fe582019-02-15 20:23:14 -0800524 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700525 fn fold_member(&mut self, i: Member) -> Member {
526 fold_member(self, i)
527 }
David Tolnay440fe582019-02-15 20:23:14 -0800528 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700529 fn fold_meta(&mut self, i: Meta) -> Meta {
530 fold_meta(self, i)
531 }
David Tolnay440fe582019-02-15 20:23:14 -0800532 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700533 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
534 fold_meta_list(self, i)
535 }
David Tolnay440fe582019-02-15 20:23:14 -0800536 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700537 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
538 fold_meta_name_value(self, i)
539 }
540 #[cfg(feature = "full")]
541 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
542 fold_method_sig(self, i)
543 }
David Tolnay8c81f622018-07-31 23:34:35 -0700544 #[cfg(feature = "full")]
545 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
546 fold_method_turbofish(self, i)
547 }
David Tolnay440fe582019-02-15 20:23:14 -0800548 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700549 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
550 fold_nested_meta(self, i)
551 }
David Tolnay440fe582019-02-15 20:23:14 -0800552 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700553 fn fold_parenthesized_generic_arguments(
554 &mut self,
555 i: ParenthesizedGenericArguments,
556 ) -> ParenthesizedGenericArguments {
557 fold_parenthesized_generic_arguments(self, i)
558 }
David Tolnay8c81f622018-07-31 23:34:35 -0700559 #[cfg(feature = "full")]
560 fn fold_pat(&mut self, i: Pat) -> Pat {
561 fold_pat(self, i)
562 }
David Tolnay8c81f622018-07-31 23:34:35 -0700563 #[cfg(feature = "full")]
564 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
565 fold_pat_box(self, i)
566 }
David Tolnay8c81f622018-07-31 23:34:35 -0700567 #[cfg(feature = "full")]
568 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
569 fold_pat_ident(self, i)
570 }
David Tolnay8c81f622018-07-31 23:34:35 -0700571 #[cfg(feature = "full")]
572 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
573 fold_pat_lit(self, i)
574 }
David Tolnay8c81f622018-07-31 23:34:35 -0700575 #[cfg(feature = "full")]
576 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
577 fold_pat_macro(self, i)
578 }
David Tolnay8c81f622018-07-31 23:34:35 -0700579 #[cfg(feature = "full")]
580 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
581 fold_pat_path(self, i)
582 }
David Tolnay8c81f622018-07-31 23:34:35 -0700583 #[cfg(feature = "full")]
584 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
585 fold_pat_range(self, i)
586 }
David Tolnay8c81f622018-07-31 23:34:35 -0700587 #[cfg(feature = "full")]
588 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
589 fold_pat_ref(self, i)
590 }
David Tolnay8c81f622018-07-31 23:34:35 -0700591 #[cfg(feature = "full")]
592 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
593 fold_pat_slice(self, i)
594 }
David Tolnay8c81f622018-07-31 23:34:35 -0700595 #[cfg(feature = "full")]
596 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
597 fold_pat_struct(self, i)
598 }
David Tolnay8c81f622018-07-31 23:34:35 -0700599 #[cfg(feature = "full")]
600 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
601 fold_pat_tuple(self, i)
602 }
David Tolnay8c81f622018-07-31 23:34:35 -0700603 #[cfg(feature = "full")]
604 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
605 fold_pat_tuple_struct(self, i)
606 }
David Tolnay8c81f622018-07-31 23:34:35 -0700607 #[cfg(feature = "full")]
608 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
609 fold_pat_verbatim(self, i)
610 }
David Tolnay8c81f622018-07-31 23:34:35 -0700611 #[cfg(feature = "full")]
612 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
613 fold_pat_wild(self, i)
614 }
David Tolnay440fe582019-02-15 20:23:14 -0800615 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700616 fn fold_path(&mut self, i: Path) -> Path {
617 fold_path(self, i)
618 }
David Tolnay440fe582019-02-15 20:23:14 -0800619 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700620 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
621 fold_path_arguments(self, i)
622 }
David Tolnay440fe582019-02-15 20:23:14 -0800623 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700624 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
625 fold_path_segment(self, i)
626 }
David Tolnay440fe582019-02-15 20:23:14 -0800627 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700628 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
629 fold_predicate_eq(self, i)
630 }
David Tolnay440fe582019-02-15 20:23:14 -0800631 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700632 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
633 fold_predicate_lifetime(self, i)
634 }
David Tolnay440fe582019-02-15 20:23:14 -0800635 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700636 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
637 fold_predicate_type(self, i)
638 }
David Tolnay440fe582019-02-15 20:23:14 -0800639 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700640 fn fold_qself(&mut self, i: QSelf) -> QSelf {
641 fold_qself(self, i)
642 }
David Tolnay8c81f622018-07-31 23:34:35 -0700643 #[cfg(feature = "full")]
644 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
645 fold_range_limits(self, i)
646 }
David Tolnay440fe582019-02-15 20:23:14 -0800647 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700648 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
649 fold_return_type(self, i)
650 }
David Tolnay8c81f622018-07-31 23:34:35 -0700651 #[cfg(feature = "full")]
652 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
653 fold_stmt(self, i)
654 }
David Tolnay440fe582019-02-15 20:23:14 -0800655 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700656 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
657 fold_trait_bound(self, i)
658 }
David Tolnay440fe582019-02-15 20:23:14 -0800659 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700660 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
661 fold_trait_bound_modifier(self, i)
662 }
663 #[cfg(feature = "full")]
664 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
665 fold_trait_item(self, i)
666 }
667 #[cfg(feature = "full")]
668 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
669 fold_trait_item_const(self, i)
670 }
671 #[cfg(feature = "full")]
672 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
673 fold_trait_item_macro(self, i)
674 }
675 #[cfg(feature = "full")]
676 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
677 fold_trait_item_method(self, i)
678 }
679 #[cfg(feature = "full")]
680 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
681 fold_trait_item_type(self, i)
682 }
683 #[cfg(feature = "full")]
684 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
685 fold_trait_item_verbatim(self, i)
686 }
David Tolnay440fe582019-02-15 20:23:14 -0800687 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700688 fn fold_type(&mut self, i: Type) -> Type {
689 fold_type(self, i)
690 }
David Tolnay440fe582019-02-15 20:23:14 -0800691 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700692 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
693 fold_type_array(self, i)
694 }
David Tolnay440fe582019-02-15 20:23:14 -0800695 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700696 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
697 fold_type_bare_fn(self, i)
698 }
David Tolnay440fe582019-02-15 20:23:14 -0800699 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700700 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
701 fold_type_group(self, i)
702 }
David Tolnay440fe582019-02-15 20:23:14 -0800703 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700704 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
705 fold_type_impl_trait(self, i)
706 }
David Tolnay440fe582019-02-15 20:23:14 -0800707 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700708 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
709 fold_type_infer(self, i)
710 }
David Tolnay440fe582019-02-15 20:23:14 -0800711 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700712 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
713 fold_type_macro(self, i)
714 }
David Tolnay440fe582019-02-15 20:23:14 -0800715 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700716 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
717 fold_type_never(self, i)
718 }
David Tolnay440fe582019-02-15 20:23:14 -0800719 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700720 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
721 fold_type_param(self, i)
722 }
David Tolnay440fe582019-02-15 20:23:14 -0800723 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700724 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
725 fold_type_param_bound(self, i)
726 }
David Tolnay440fe582019-02-15 20:23:14 -0800727 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700728 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
729 fold_type_paren(self, i)
730 }
David Tolnay440fe582019-02-15 20:23:14 -0800731 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700732 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
733 fold_type_path(self, i)
734 }
David Tolnay440fe582019-02-15 20:23:14 -0800735 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700736 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
737 fold_type_ptr(self, i)
738 }
David Tolnay440fe582019-02-15 20:23:14 -0800739 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700740 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
741 fold_type_reference(self, i)
742 }
David Tolnay440fe582019-02-15 20:23:14 -0800743 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700744 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
745 fold_type_slice(self, i)
746 }
David Tolnay440fe582019-02-15 20:23:14 -0800747 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700748 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
749 fold_type_trait_object(self, i)
750 }
David Tolnay440fe582019-02-15 20:23:14 -0800751 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700752 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
753 fold_type_tuple(self, i)
754 }
David Tolnay440fe582019-02-15 20:23:14 -0800755 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700756 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
757 fold_type_verbatim(self, i)
758 }
David Tolnay440fe582019-02-15 20:23:14 -0800759 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700760 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
761 fold_un_op(self, i)
762 }
763 #[cfg(feature = "full")]
764 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
765 fold_use_glob(self, i)
766 }
767 #[cfg(feature = "full")]
768 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
769 fold_use_group(self, i)
770 }
771 #[cfg(feature = "full")]
772 fn fold_use_name(&mut self, i: UseName) -> UseName {
773 fold_use_name(self, i)
774 }
775 #[cfg(feature = "full")]
776 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
777 fold_use_path(self, i)
778 }
779 #[cfg(feature = "full")]
780 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
781 fold_use_rename(self, i)
782 }
783 #[cfg(feature = "full")]
784 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
785 fold_use_tree(self, i)
786 }
David Tolnay440fe582019-02-15 20:23:14 -0800787 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700788 fn fold_variant(&mut self, i: Variant) -> Variant {
789 fold_variant(self, i)
790 }
David Tolnay440fe582019-02-15 20:23:14 -0800791 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700792 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
793 fold_vis_crate(self, i)
794 }
David Tolnay440fe582019-02-15 20:23:14 -0800795 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700796 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
797 fold_vis_public(self, i)
798 }
David Tolnay440fe582019-02-15 20:23:14 -0800799 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700800 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
801 fold_vis_restricted(self, i)
802 }
David Tolnay440fe582019-02-15 20:23:14 -0800803 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700804 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
805 fold_visibility(self, i)
806 }
David Tolnay440fe582019-02-15 20:23:14 -0800807 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700808 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
809 fold_where_clause(self, i)
810 }
David Tolnay440fe582019-02-15 20:23:14 -0800811 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700812 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
813 fold_where_predicate(self, i)
814 }
Carl Lerchecbf7cc12019-02-15 14:09:31 -0800815 fn fold_span(&mut self, i: Span) -> Span {
816 fold_span(self, i)
817 }
818 fn fold_ident(&mut self, i: Ident) -> Ident {
819 fold_ident(self, i)
820 }
Nika Layzell27726662017-10-24 23:16:35 -0400821}
David Tolnay440fe582019-02-15 20:23:14 -0800822#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800823pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400824 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400825 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700826 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400827 }
828}
David Tolnay440fe582019-02-15 20:23:14 -0800829#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700830pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
831 _visitor: &mut V,
832 _i: AngleBracketedGenericArguments,
833) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500834 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400835 colon2_token: (_i.colon2_token)
836 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
837 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700838 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400839 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400840 }
841}
David Tolnay8c81f622018-07-31 23:34:35 -0700842#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800843pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400844 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700845 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400846 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700847 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400848 }
849}
David Tolnay8c81f622018-07-31 23:34:35 -0700850#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800851pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400852 ArgSelf {
David Tolnay905ef2b2019-02-11 02:28:22 +0100853 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -0400854 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400855 }
856}
David Tolnay8c81f622018-07-31 23:34:35 -0700857#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800858pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400859 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400860 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700861 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +0100862 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -0400863 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400864 }
865}
David Tolnay8c81f622018-07-31 23:34:35 -0700866#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800867pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400868 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700869 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400870 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700871 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
872 guard: (_i.guard).map(|it| {
873 (
David Tolnay905ef2b2019-02-11 02:28:22 +0100874 Token![if](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700875 Box::new(_visitor.fold_expr(*(it).1)),
876 )
877 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400878 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700879 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400880 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400881 }
882}
David Tolnay440fe582019-02-15 20:23:14 -0800883#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800884pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400885 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700886 AttrStyle::Outer => AttrStyle::Outer,
887 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400888 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400889 }
890 }
891}
David Tolnay440fe582019-02-15 20:23:14 -0800892#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800893pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400894 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400895 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700896 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400897 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700898 path: _visitor.fold_path(_i.path),
899 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400900 }
901}
David Tolnay440fe582019-02-15 20:23:14 -0800902#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800903pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400904 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700905 name: (_i.name).map(|it| {
906 (
907 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400908 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700909 )
910 }),
911 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400912 }
913}
David Tolnay440fe582019-02-15 20:23:14 -0800914#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700915pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
916 _visitor: &mut V,
917 _i: BareFnArgName,
918) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400919 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700920 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
921 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400922 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400923 }
924 }
925}
David Tolnay440fe582019-02-15 20:23:14 -0800926#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800927pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -0400928 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700929 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400930 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400931 }
David Tolnay8c81f622018-07-31 23:34:35 -0700932 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400933 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400934 }
David Tolnay8c81f622018-07-31 23:34:35 -0700935 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400936 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400937 }
David Tolnay8c81f622018-07-31 23:34:35 -0700938 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400939 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400940 }
David Tolnay8c81f622018-07-31 23:34:35 -0700941 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400942 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400943 }
David Tolnay8c81f622018-07-31 23:34:35 -0700944 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400945 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400946 }
David Tolnay8c81f622018-07-31 23:34:35 -0700947 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400948 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400949 }
David Tolnay8c81f622018-07-31 23:34:35 -0700950 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400951 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400952 }
David Tolnay8c81f622018-07-31 23:34:35 -0700953 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400954 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400955 }
David Tolnay8c81f622018-07-31 23:34:35 -0700956 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400957 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400958 }
David Tolnay8c81f622018-07-31 23:34:35 -0700959 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400960 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400961 }
David Tolnay8c81f622018-07-31 23:34:35 -0700962 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400963 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400964 }
David Tolnay8c81f622018-07-31 23:34:35 -0700965 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400966 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400967 }
David Tolnay7ac699c2018-08-24 14:00:58 -0400968 BinOp::Lt(_binding_0) => {
969 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
970 }
David Tolnay8c81f622018-07-31 23:34:35 -0700971 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400972 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400973 }
David Tolnay8c81f622018-07-31 23:34:35 -0700974 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400975 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400976 }
David Tolnay8c81f622018-07-31 23:34:35 -0700977 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400978 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400979 }
David Tolnay7ac699c2018-08-24 14:00:58 -0400980 BinOp::Gt(_binding_0) => {
981 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
982 }
David Tolnay8c81f622018-07-31 23:34:35 -0700983 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400984 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400985 }
David Tolnay8c81f622018-07-31 23:34:35 -0700986 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400987 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400988 }
David Tolnay8c81f622018-07-31 23:34:35 -0700989 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400990 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400991 }
David Tolnay8c81f622018-07-31 23:34:35 -0700992 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400993 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400994 }
David Tolnay8c81f622018-07-31 23:34:35 -0700995 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400996 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400997 }
David Tolnay8c81f622018-07-31 23:34:35 -0700998 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400999 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001000 }
David Tolnay8c81f622018-07-31 23:34:35 -07001001 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001002 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001003 }
David Tolnay8c81f622018-07-31 23:34:35 -07001004 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001005 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001006 }
David Tolnay8c81f622018-07-31 23:34:35 -07001007 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001008 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001009 }
David Tolnay8c81f622018-07-31 23:34:35 -07001010 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001011 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001012 }
1013 }
1014}
David Tolnay440fe582019-02-15 20:23:14 -08001015#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001016pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001017 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001018 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001019 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001020 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001021 }
1022}
David Tolnay8c81f622018-07-31 23:34:35 -07001023#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001024pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001025 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001026 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001027 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001028 }
1029}
David Tolnay440fe582019-02-15 20:23:14 -08001030#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07001031pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1032 _visitor: &mut V,
1033 _i: BoundLifetimes,
1034) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001035 BoundLifetimes {
David Tolnay905ef2b2019-02-11 02:28:22 +01001036 for_token: Token![for](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001037 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001038 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001039 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001040 }
1041}
David Tolnay440fe582019-02-15 20:23:14 -08001042#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001043pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001044 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001045 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001046 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001047 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001048 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001049 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001050 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001051 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001052 }
1053}
David Tolnay440fe582019-02-15 20:23:14 -08001054#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay9d0882a2018-09-01 19:49:14 -07001055pub fn fold_constraint<V: Fold + ?Sized>(_visitor: &mut V, _i: Constraint) -> Constraint {
1056 Constraint {
1057 ident: _visitor.fold_ident(_i.ident),
1058 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
1059 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1060 }
1061}
David Tolnay8c81f622018-07-31 23:34:35 -07001062#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001063pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001064 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001065 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1066 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1067 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001068 }
1069}
David Tolnay8c81f622018-07-31 23:34:35 -07001070#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001071pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001072 DataEnum {
David Tolnay905ef2b2019-02-11 02:28:22 +01001073 enum_token: Token![enum](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001074 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001075 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001076 }
1077}
David Tolnay8c81f622018-07-31 23:34:35 -07001078#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001079pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001080 DataStruct {
David Tolnay905ef2b2019-02-11 02:28:22 +01001081 struct_token: Token![struct](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001082 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001083 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001084 }
1085}
David Tolnay8c81f622018-07-31 23:34:35 -07001086#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001087pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001088 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001089 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001090 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001091 }
1092}
David Tolnay8c81f622018-07-31 23:34:35 -07001093#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001094pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001095 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001096 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1097 vis: _visitor.fold_visibility(_i.vis),
1098 ident: _visitor.fold_ident(_i.ident),
1099 generics: _visitor.fold_generics(_i.generics),
1100 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001101 }
1102}
David Tolnay440fe582019-02-15 20:23:14 -08001103#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001104pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001105 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001106 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1107 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1108 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1109 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1110 Expr::MethodCall(_binding_0) => {
1111 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001112 }
David Tolnay8c81f622018-07-31 23:34:35 -07001113 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1114 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1115 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1116 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1117 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1118 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
David Tolnay9c119122018-09-01 18:47:02 -07001119 Expr::Let(_binding_0) => Expr::Let(full!(_visitor.fold_expr_let(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001120 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001121 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001122 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1123 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1124 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1125 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1126 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1127 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1128 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1129 Expr::AssignOp(_binding_0) => {
1130 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001131 }
David Tolnay8c81f622018-07-31 23:34:35 -07001132 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1133 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1134 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1135 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1136 Expr::Reference(_binding_0) => {
1137 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001138 }
David Tolnay8c81f622018-07-31 23:34:35 -07001139 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1140 Expr::Continue(_binding_0) => {
1141 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001142 }
David Tolnay8c81f622018-07-31 23:34:35 -07001143 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1144 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1145 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1146 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1147 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1148 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1149 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001150 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001151 Expr::TryBlock(_binding_0) => {
1152 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1153 }
David Tolnay8c81f622018-07-31 23:34:35 -07001154 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1155 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001156 }
1157}
David Tolnay8c81f622018-07-31 23:34:35 -07001158#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001159pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001160 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001161 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001162 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001163 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001164 }
1165}
David Tolnay8c81f622018-07-31 23:34:35 -07001166#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001167pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001168 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001169 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1170 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001171 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001172 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001173 }
1174}
David Tolnay8c81f622018-07-31 23:34:35 -07001175#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001176pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001177 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001178 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1179 left: Box::new(_visitor.fold_expr(*_i.left)),
1180 op: _visitor.fold_bin_op(_i.op),
1181 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001182 }
1183}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001184#[cfg(feature = "full")]
David Tolnay02a9c6f2018-08-24 18:58:45 -04001185pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1186 ExprAsync {
1187 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1188 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001189 capture: (_i.capture).map(|it| Token![move](tokens_helper(_visitor, &it.span))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001190 block: _visitor.fold_block(_i.block),
1191 }
1192}
David Tolnay440fe582019-02-15 20:23:14 -08001193#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001194pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001195 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001196 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1197 left: Box::new(_visitor.fold_expr(*_i.left)),
1198 op: _visitor.fold_bin_op(_i.op),
1199 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001200 }
1201}
David Tolnay8c81f622018-07-31 23:34:35 -07001202#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001203pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001204 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001205 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001206 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001207 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001208 }
1209}
David Tolnay8c81f622018-07-31 23:34:35 -07001210#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001211pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001212 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001213 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001214 box_token: Token![box](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001215 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001216 }
1217}
David Tolnay8c81f622018-07-31 23:34:35 -07001218#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001219pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001220 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001221 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001222 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001223 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1224 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001225 }
1226}
David Tolnay440fe582019-02-15 20:23:14 -08001227#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001228pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001229 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001230 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1231 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001232 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001233 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001234 }
1235}
David Tolnay440fe582019-02-15 20:23:14 -08001236#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001237pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001238 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001239 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1240 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001241 as_token: Token![as](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001242 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001243 }
1244}
David Tolnay8c81f622018-07-31 23:34:35 -07001245#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001246pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001247 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001248 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001249 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001250 movability: (_i.movability).map(|it| Token![static](tokens_helper(_visitor, &it.span))),
1251 capture: (_i.capture).map(|it| Token![move](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001252 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001253 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001254 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001255 output: _visitor.fold_return_type(_i.output),
1256 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001257 }
1258}
David Tolnay8c81f622018-07-31 23:34:35 -07001259#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001260pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001261 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001262 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001263 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001264 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001265 }
1266}
David Tolnay440fe582019-02-15 20:23:14 -08001267#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001268pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001269 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001270 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1271 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001272 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001273 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001274 }
1275}
David Tolnay8c81f622018-07-31 23:34:35 -07001276#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001277pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001278 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001279 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1280 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001281 for_token: Token![for](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001282 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001283 in_token: Token![in](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001284 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1285 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001286 }
1287}
David Tolnay8c81f622018-07-31 23:34:35 -07001288#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001289pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001290 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001291 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001292 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001293 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001294 }
1295}
David Tolnay8c81f622018-07-31 23:34:35 -07001296#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001297pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001298 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001299 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001300 if_token: Token![if](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001301 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1302 then_branch: _visitor.fold_block(_i.then_branch),
1303 else_branch: (_i.else_branch).map(|it| {
1304 (
David Tolnay905ef2b2019-02-11 02:28:22 +01001305 Token![else](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001306 Box::new(_visitor.fold_expr(*(it).1)),
1307 )
1308 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001309 }
1310}
David Tolnay8c81f622018-07-31 23:34:35 -07001311#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001312pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001313 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001314 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1315 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001316 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001317 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001318 }
1319}
David Tolnay440fe582019-02-15 20:23:14 -08001320#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001321pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001322 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001323 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1324 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001325 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001326 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001327 }
1328}
David Tolnay9c119122018-09-01 18:47:02 -07001329#[cfg(feature = "full")]
David Tolnay9c119122018-09-01 18:47:02 -07001330pub fn fold_expr_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLet) -> ExprLet {
1331 ExprLet {
1332 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001333 let_token: Token![let](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay9c119122018-09-01 18:47:02 -07001334 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
1335 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
1336 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1337 }
1338}
David Tolnay440fe582019-02-15 20:23:14 -08001339#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001340pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001341 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001342 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1343 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001344 }
1345}
David Tolnay8c81f622018-07-31 23:34:35 -07001346#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001347pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001348 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001349 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1350 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001351 loop_token: Token![loop](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001352 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001353 }
1354}
David Tolnay8c81f622018-07-31 23:34:35 -07001355#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001356pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001357 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001358 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1359 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001360 }
1361}
David Tolnay8c81f622018-07-31 23:34:35 -07001362#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001363pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001364 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001365 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001366 match_token: Token![match](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001367 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001368 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001369 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001370 }
1371}
David Tolnay8c81f622018-07-31 23:34:35 -07001372#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001373pub fn fold_expr_method_call<V: Fold + ?Sized>(
1374 _visitor: &mut V,
1375 _i: ExprMethodCall,
1376) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001377 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001378 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1379 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001380 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001381 method: _visitor.fold_ident(_i.method),
1382 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001383 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001384 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001385 }
1386}
David Tolnay440fe582019-02-15 20:23:14 -08001387#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001388pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001389 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001390 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001391 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001392 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001393 }
1394}
David Tolnay440fe582019-02-15 20:23:14 -08001395#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001396pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001397 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001398 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1399 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1400 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001401 }
1402}
David Tolnay8c81f622018-07-31 23:34:35 -07001403#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001404pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001405 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001406 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1407 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1408 limits: _visitor.fold_range_limits(_i.limits),
1409 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001410 }
1411}
David Tolnay8c81f622018-07-31 23:34:35 -07001412#[cfg(feature = "full")]
David Tolnay00674ba2018-03-31 18:14:11 +02001413pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1414 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001415 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001416 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001417 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001418 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001419 }
1420}
David Tolnay8c81f622018-07-31 23:34:35 -07001421#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001422pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001423 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001424 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001425 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001426 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001427 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001428 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001429 }
1430}
David Tolnay8c81f622018-07-31 23:34:35 -07001431#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001432pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001433 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001434 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001435 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001436 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001437 }
1438}
David Tolnay8c81f622018-07-31 23:34:35 -07001439#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001440pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001441 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001442 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1443 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001444 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001445 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001446 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001447 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001448 }
1449}
David Tolnay8c81f622018-07-31 23:34:35 -07001450#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001451pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001452 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001453 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1454 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001455 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001456 }
1457}
David Tolnay8c81f622018-07-31 23:34:35 -07001458#[cfg(feature = "full")]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001459pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1460 ExprTryBlock {
1461 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1462 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1463 block: _visitor.fold_block(_i.block),
1464 }
1465}
1466#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001467pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001468 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001469 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001470 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001471 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001472 }
1473}
David Tolnay8c81f622018-07-31 23:34:35 -07001474#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001475pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001476 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001477 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1478 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001479 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001480 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001481 }
1482}
David Tolnay440fe582019-02-15 20:23:14 -08001483#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001484pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001485 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001486 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1487 op: _visitor.fold_un_op(_i.op),
1488 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001489 }
1490}
David Tolnay8c81f622018-07-31 23:34:35 -07001491#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001492pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001493 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001494 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001495 unsafe_token: Token![unsafe](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001496 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001497 }
1498}
David Tolnay440fe582019-02-15 20:23:14 -08001499#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001500pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001501 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001502}
David Tolnay8c81f622018-07-31 23:34:35 -07001503#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001504pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001505 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001506 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1507 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001508 while_token: Token![while](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001509 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1510 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001511 }
1512}
David Tolnay8c81f622018-07-31 23:34:35 -07001513#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001514pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001515 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001516 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001517 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001518 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001519 }
1520}
David Tolnay440fe582019-02-15 20:23:14 -08001521#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001522pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001523 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001524 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1525 vis: _visitor.fold_visibility(_i.vis),
1526 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001527 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001528 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001529 }
1530}
David Tolnay8c81f622018-07-31 23:34:35 -07001531#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001532pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001533 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001534 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1535 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001536 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001537 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001538 }
1539}
David Tolnay8c81f622018-07-31 23:34:35 -07001540#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001541pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001542 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001543 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1544 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001545 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001546 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001547 }
1548}
David Tolnay440fe582019-02-15 20:23:14 -08001549#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001550pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001551 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001552 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1553 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1554 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001555 }
1556}
David Tolnay440fe582019-02-15 20:23:14 -08001557#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001558pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001559 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001560 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001561 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001562 }
1563}
David Tolnay440fe582019-02-15 20:23:14 -08001564#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001565pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001566 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001567 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001568 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001569 }
1570}
David Tolnay8c81f622018-07-31 23:34:35 -07001571#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001572pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001573 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001574 shebang: _i.shebang,
1575 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1576 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001577 }
1578}
David Tolnay8c81f622018-07-31 23:34:35 -07001579#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001580pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001581 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001582 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1583 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1584 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1585 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1586 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001587 }
1588}
David Tolnay8c81f622018-07-31 23:34:35 -07001589#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001590pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001591 FnDecl {
David Tolnay905ef2b2019-02-11 02:28:22 +01001592 fn_token: Token![fn](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001593 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001594 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001595 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001596 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001597 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001598 }
1599}
David Tolnay8c81f622018-07-31 23:34:35 -07001600#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001601pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001602 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001603 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1604 ForeignItem::Static(_binding_0) => {
1605 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001606 }
David Tolnay8c81f622018-07-31 23:34:35 -07001607 ForeignItem::Type(_binding_0) => {
1608 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001609 }
David Tolnay435c1782018-08-24 16:15:44 -04001610 ForeignItem::Macro(_binding_0) => {
1611 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1612 }
David Tolnay8c81f622018-07-31 23:34:35 -07001613 ForeignItem::Verbatim(_binding_0) => {
1614 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001615 }
Nika Layzell27726662017-10-24 23:16:35 -04001616 }
1617}
David Tolnay8c81f622018-07-31 23:34:35 -07001618#[cfg(feature = "full")]
1619pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1620 _visitor: &mut V,
1621 _i: ForeignItemFn,
1622) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001623 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001624 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1625 vis: _visitor.fold_visibility(_i.vis),
1626 ident: _visitor.fold_ident(_i.ident),
1627 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001628 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001629 }
1630}
David Tolnay8c81f622018-07-31 23:34:35 -07001631#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001632pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1633 _visitor: &mut V,
1634 _i: ForeignItemMacro,
1635) -> ForeignItemMacro {
1636 ForeignItemMacro {
1637 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1638 mac: _visitor.fold_macro(_i.mac),
1639 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1640 }
1641}
1642#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001643pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1644 _visitor: &mut V,
1645 _i: ForeignItemStatic,
1646) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001647 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001648 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1649 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001650 static_token: Token![static](tokens_helper(_visitor, &_i.static_token.span)),
1651 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001652 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001653 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001654 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001655 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001656 }
1657}
David Tolnay8c81f622018-07-31 23:34:35 -07001658#[cfg(feature = "full")]
1659pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1660 _visitor: &mut V,
1661 _i: ForeignItemType,
1662) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001663 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001664 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1665 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001666 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001667 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001668 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001669 }
1670}
David Tolnay8c81f622018-07-31 23:34:35 -07001671#[cfg(feature = "full")]
1672pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1673 _visitor: &mut V,
1674 _i: ForeignItemVerbatim,
1675) -> ForeignItemVerbatim {
1676 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001677}
David Tolnay440fe582019-02-15 20:23:14 -08001678#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07001679pub fn fold_generic_argument<V: Fold + ?Sized>(
1680 _visitor: &mut V,
1681 _i: GenericArgument,
1682) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001683 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001684 GenericArgument::Lifetime(_binding_0) => {
1685 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001686 }
David Tolnay8c81f622018-07-31 23:34:35 -07001687 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1688 GenericArgument::Binding(_binding_0) => {
1689 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001690 }
David Tolnay9d0882a2018-09-01 19:49:14 -07001691 GenericArgument::Constraint(_binding_0) => {
1692 GenericArgument::Constraint(_visitor.fold_constraint(_binding_0))
1693 }
David Tolnay8c81f622018-07-31 23:34:35 -07001694 GenericArgument::Const(_binding_0) => {
1695 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001696 }
Nika Layzell357885a2017-12-04 15:47:07 -05001697 }
1698}
David Tolnay8c81f622018-07-31 23:34:35 -07001699#[cfg(feature = "full")]
1700pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1701 _visitor: &mut V,
1702 _i: GenericMethodArgument,
1703) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001704 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001705 GenericMethodArgument::Type(_binding_0) => {
1706 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001707 }
David Tolnay8c81f622018-07-31 23:34:35 -07001708 GenericMethodArgument::Const(_binding_0) => {
1709 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001710 }
1711 }
1712}
David Tolnay440fe582019-02-15 20:23:14 -08001713#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001714pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001715 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001716 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1717 GenericParam::Lifetime(_binding_0) => {
1718 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001719 }
David Tolnay8c81f622018-07-31 23:34:35 -07001720 GenericParam::Const(_binding_0) => {
1721 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001722 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001723 }
1724}
David Tolnay440fe582019-02-15 20:23:14 -08001725#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001726pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001727 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001728 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001729 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001730 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001731 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001732 }
1733}
David Tolnay8c81f622018-07-31 23:34:35 -07001734#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001735pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001736 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001737 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1738 ImplItem::Method(_binding_0) => {
1739 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001740 }
David Tolnay8c81f622018-07-31 23:34:35 -07001741 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001742 ImplItem::Existential(_binding_0) => {
1743 ImplItem::Existential(_visitor.fold_impl_item_existential(_binding_0))
1744 }
David Tolnay8c81f622018-07-31 23:34:35 -07001745 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1746 ImplItem::Verbatim(_binding_0) => {
1747 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001748 }
Nika Layzell27726662017-10-24 23:16:35 -04001749 }
1750}
David Tolnay8c81f622018-07-31 23:34:35 -07001751#[cfg(feature = "full")]
1752pub fn fold_impl_item_const<V: Fold + ?Sized>(
1753 _visitor: &mut V,
1754 _i: ImplItemConst,
1755) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001756 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001757 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1758 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001759 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001760 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001761 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001762 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001763 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001764 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001765 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001766 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001767 }
1768}
David Tolnay8c81f622018-07-31 23:34:35 -07001769#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001770pub fn fold_impl_item_existential<V: Fold + ?Sized>(
1771 _visitor: &mut V,
1772 _i: ImplItemExistential,
1773) -> ImplItemExistential {
1774 ImplItemExistential {
1775 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1776 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001777 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001778 ident: _visitor.fold_ident(_i.ident),
1779 generics: _visitor.fold_generics(_i.generics),
1780 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1781 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1782 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1783 }
1784}
1785#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001786pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1787 _visitor: &mut V,
1788 _i: ImplItemMacro,
1789) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001790 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001791 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1792 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001793 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001794 }
1795}
David Tolnay8c81f622018-07-31 23:34:35 -07001796#[cfg(feature = "full")]
1797pub fn fold_impl_item_method<V: Fold + ?Sized>(
1798 _visitor: &mut V,
1799 _i: ImplItemMethod,
1800) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001801 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001802 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1803 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001804 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001805 sig: _visitor.fold_method_sig(_i.sig),
1806 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001807 }
1808}
David Tolnay8c81f622018-07-31 23:34:35 -07001809#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001810pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001811 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001812 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1813 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001814 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001815 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001816 ident: _visitor.fold_ident(_i.ident),
1817 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001818 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001819 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001820 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001821 }
1822}
David Tolnay8c81f622018-07-31 23:34:35 -07001823#[cfg(feature = "full")]
1824pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1825 _visitor: &mut V,
1826 _i: ImplItemVerbatim,
1827) -> ImplItemVerbatim {
1828 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001829}
David Tolnay440fe582019-02-15 20:23:14 -08001830#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001831pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001832 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001833 index: _i.index,
1834 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001835 }
1836}
David Tolnay8c81f622018-07-31 23:34:35 -07001837#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001838pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001839 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001840 Item::ExternCrate(_binding_0) => {
1841 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001842 }
David Tolnay8c81f622018-07-31 23:34:35 -07001843 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1844 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1845 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1846 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1847 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1848 Item::ForeignMod(_binding_0) => {
1849 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001850 }
David Tolnay8c81f622018-07-31 23:34:35 -07001851 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001852 Item::Existential(_binding_0) => {
1853 Item::Existential(_visitor.fold_item_existential(_binding_0))
1854 }
David Tolnay8c81f622018-07-31 23:34:35 -07001855 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1856 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1857 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1858 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07001859 Item::TraitAlias(_binding_0) => {
1860 Item::TraitAlias(_visitor.fold_item_trait_alias(_binding_0))
1861 }
David Tolnay8c81f622018-07-31 23:34:35 -07001862 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1863 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1864 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1865 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001866 }
1867}
David Tolnay8c81f622018-07-31 23:34:35 -07001868#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001869pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001870 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001871 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1872 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001873 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001874 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001875 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001876 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001877 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001878 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001879 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001880 }
1881}
David Tolnay8c81f622018-07-31 23:34:35 -07001882#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001883pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001884 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001885 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1886 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001887 enum_token: Token![enum](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001888 ident: _visitor.fold_ident(_i.ident),
1889 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001890 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001891 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001892 }
1893}
David Tolnay8c81f622018-07-31 23:34:35 -07001894#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001895pub fn fold_item_existential<V: Fold + ?Sized>(
1896 _visitor: &mut V,
1897 _i: ItemExistential,
1898) -> ItemExistential {
1899 ItemExistential {
1900 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1901 vis: _visitor.fold_visibility(_i.vis),
1902 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001903 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001904 ident: _visitor.fold_ident(_i.ident),
1905 generics: _visitor.fold_generics(_i.generics),
1906 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1907 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1908 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1909 }
1910}
1911#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001912pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1913 _visitor: &mut V,
1914 _i: ItemExternCrate,
1915) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001916 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001917 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1918 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001919 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
1920 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001921 ident: _visitor.fold_ident(_i.ident),
1922 rename: (_i.rename).map(|it| {
1923 (
David Tolnay905ef2b2019-02-11 02:28:22 +01001924 Token![as](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001925 _visitor.fold_ident((it).1),
1926 )
1927 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04001928 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001929 }
1930}
David Tolnay8c81f622018-07-31 23:34:35 -07001931#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001932pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001933 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001934 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1935 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001936 constness: (_i.constness).map(|it| Token![const](tokens_helper(_visitor, &it.span))),
1937 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09001938 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001939 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
1940 ident: _visitor.fold_ident(_i.ident),
1941 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
1942 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001943 }
1944}
David Tolnay8c81f622018-07-31 23:34:35 -07001945#[cfg(feature = "full")]
1946pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
1947 _visitor: &mut V,
1948 _i: ItemForeignMod,
1949) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001950 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07001951 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1952 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04001953 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001954 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001955 }
1956}
David Tolnay8c81f622018-07-31 23:34:35 -07001957#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001958pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001959 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07001960 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001961 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001962 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay8d642ab2019-03-26 09:23:37 -03001963 impl_token: Token![impl](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001964 generics: _visitor.fold_generics(_i.generics),
1965 trait_: (_i.trait_).map(|it| {
1966 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001967 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001968 _visitor.fold_path((it).1),
David Tolnay905ef2b2019-02-11 02:28:22 +01001969 Token![for](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001970 )
1971 }),
1972 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001973 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001974 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001975 }
1976}
David Tolnay8c81f622018-07-31 23:34:35 -07001977#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001978pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08001979 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001980 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1981 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
1982 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001983 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001984 }
1985}
David Tolnay8c81f622018-07-31 23:34:35 -07001986#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001987pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08001988 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07001989 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1990 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001991 macro_token: Token![macro](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001992 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001993 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001994 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04001995 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001996 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08001997 }
1998}
David Tolnay8c81f622018-07-31 23:34:35 -07001999#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002000pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002001 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002002 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2003 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002004 mod_token: Token![mod](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002005 ident: _visitor.fold_ident(_i.ident),
2006 content: (_i.content).map(|it| {
2007 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002008 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002009 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2010 )
2011 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002012 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002013 }
2014}
David Tolnay8c81f622018-07-31 23:34:35 -07002015#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002016pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002017 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002018 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2019 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002020 static_token: Token![static](tokens_helper(_visitor, &_i.static_token.span)),
2021 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002022 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002023 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002024 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002025 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002026 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002027 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002028 }
2029}
David Tolnay8c81f622018-07-31 23:34:35 -07002030#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002031pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002032 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002033 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2034 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002035 struct_token: Token![struct](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002036 ident: _visitor.fold_ident(_i.ident),
2037 generics: _visitor.fold_generics(_i.generics),
2038 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002039 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002040 }
2041}
David Tolnay8c81f622018-07-31 23:34:35 -07002042#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002043pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002044 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002045 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2046 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002047 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002048 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01002049 trait_token: Token![trait](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002050 ident: _visitor.fold_ident(_i.ident),
2051 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002052 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002053 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002054 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002055 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002056 }
2057}
David Tolnay8c81f622018-07-31 23:34:35 -07002058#[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -07002059pub fn fold_item_trait_alias<V: Fold + ?Sized>(
2060 _visitor: &mut V,
2061 _i: ItemTraitAlias,
2062) -> ItemTraitAlias {
2063 ItemTraitAlias {
2064 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2065 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002066 trait_token: Token![trait](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07002067 ident: _visitor.fold_ident(_i.ident),
2068 generics: _visitor.fold_generics(_i.generics),
2069 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
2070 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2071 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2072 }
2073}
2074#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002075pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002076 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002077 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2078 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002079 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002080 ident: _visitor.fold_ident(_i.ident),
2081 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002082 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002083 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002084 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002085 }
2086}
David Tolnay8c81f622018-07-31 23:34:35 -07002087#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002088pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002089 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002090 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2091 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002092 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002093 ident: _visitor.fold_ident(_i.ident),
2094 generics: _visitor.fold_generics(_i.generics),
2095 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002096 }
2097}
David Tolnay8c81f622018-07-31 23:34:35 -07002098#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002099pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002100 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002101 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2102 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002103 use_token: Token![use](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002104 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002105 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002106 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002107 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002108 }
2109}
David Tolnay8c81f622018-07-31 23:34:35 -07002110#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002111pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002112 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002113}
David Tolnay8c81f622018-07-31 23:34:35 -07002114#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002115pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002116 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002117 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002118 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002119 }
2120}
Alex Crichton131308c2018-05-18 14:00:24 -07002121pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2122 Lifetime {
David Tolnay17f63892018-08-31 10:36:32 -07002123 apostrophe: _visitor.fold_span(_i.apostrophe),
David Tolnay8c81f622018-07-31 23:34:35 -07002124 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002125 }
2126}
David Tolnay440fe582019-02-15 20:23:14 -08002127#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002128pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002129 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002130 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2131 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002132 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002133 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002134 }
2135}
David Tolnay440fe582019-02-15 20:23:14 -08002136#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002137pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002138 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002139 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2140 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2141 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2142 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2143 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2144 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2145 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2146 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002147 }
2148}
David Tolnay440fe582019-02-15 20:23:14 -08002149#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002150pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002151 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002152 value: _i.value,
2153 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002154 }
2155}
David Tolnay440fe582019-02-15 20:23:14 -08002156#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay587abd02019-05-08 17:17:31 -07002157pub fn fold_lit_byte<V: Fold + ?Sized>(_visitor: &mut V, _i: LitByte) -> LitByte {
2158 let span = _visitor.fold_span(_i.span());
2159 let mut _i = _i;
2160 _i.set_span(span);
2161 _i
2162}
2163#[cfg(any(feature = "derive", feature = "full"))]
2164pub fn fold_lit_byte_str<V: Fold + ?Sized>(_visitor: &mut V, _i: LitByteStr) -> LitByteStr {
2165 let span = _visitor.fold_span(_i.span());
2166 let mut _i = _i;
2167 _i.set_span(span);
2168 _i
2169}
2170#[cfg(any(feature = "derive", feature = "full"))]
2171pub fn fold_lit_char<V: Fold + ?Sized>(_visitor: &mut V, _i: LitChar) -> LitChar {
2172 let span = _visitor.fold_span(_i.span());
2173 let mut _i = _i;
2174 _i.set_span(span);
2175 _i
2176}
2177#[cfg(any(feature = "derive", feature = "full"))]
2178pub fn fold_lit_float<V: Fold + ?Sized>(_visitor: &mut V, _i: LitFloat) -> LitFloat {
2179 let span = _visitor.fold_span(_i.span());
2180 let mut _i = _i;
2181 _i.set_span(span);
2182 _i
2183}
2184#[cfg(any(feature = "derive", feature = "full"))]
2185pub fn fold_lit_int<V: Fold + ?Sized>(_visitor: &mut V, _i: LitInt) -> LitInt {
2186 let span = _visitor.fold_span(_i.span());
2187 let mut _i = _i;
2188 _i.set_span(span);
2189 _i
2190}
2191#[cfg(any(feature = "derive", feature = "full"))]
2192pub fn fold_lit_str<V: Fold + ?Sized>(_visitor: &mut V, _i: LitStr) -> LitStr {
2193 let span = _visitor.fold_span(_i.span());
2194 let mut _i = _i;
2195 _i.set_span(span);
2196 _i
2197}
2198#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002199pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002200 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002201}
David Tolnay8c81f622018-07-31 23:34:35 -07002202#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002203pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002204 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002205 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002206 let_token: Token![let](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002207 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2208 ty: (_i.ty).map(|it| {
2209 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002210 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002211 Box::new(_visitor.fold_type(*(it).1)),
2212 )
2213 }),
2214 init: (_i.init).map(|it| {
2215 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002216 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002217 Box::new(_visitor.fold_expr(*(it).1)),
2218 )
2219 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002220 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002221 }
2222}
David Tolnay440fe582019-02-15 20:23:14 -08002223#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002224pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002225 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002226 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002227 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002228 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2229 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002230 }
2231}
David Tolnay440fe582019-02-15 20:23:14 -08002232#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002233pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2234 _visitor: &mut V,
2235 _i: MacroDelimiter,
2236) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002237 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002238 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002239 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002240 }
David Tolnay8c81f622018-07-31 23:34:35 -07002241 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002242 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002243 }
David Tolnay8c81f622018-07-31 23:34:35 -07002244 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002245 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002246 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002247 }
2248}
David Tolnay440fe582019-02-15 20:23:14 -08002249#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002250pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002251 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002252 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2253 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002254 }
2255}
David Tolnay440fe582019-02-15 20:23:14 -08002256#[cfg(any(feature = "derive", feature = "full"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002257pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002258 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002259 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2260 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2261 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002262 }
2263}
David Tolnay440fe582019-02-15 20:23:14 -08002264#[cfg(any(feature = "derive", feature = "full"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002265pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2266 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002267 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002268 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002269 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002270 }
2271}
David Tolnay440fe582019-02-15 20:23:14 -08002272#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002273pub fn fold_meta_name_value<V: Fold + ?Sized>(
2274 _visitor: &mut V,
2275 _i: MetaNameValue,
2276) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002277 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002278 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002279 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002280 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002281 }
2282}
David Tolnay8c81f622018-07-31 23:34:35 -07002283#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002284pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002285 MethodSig {
David Tolnay905ef2b2019-02-11 02:28:22 +01002286 constness: (_i.constness).map(|it| Token![const](tokens_helper(_visitor, &it.span))),
2287 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002288 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002289 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2290 ident: _visitor.fold_ident(_i.ident),
2291 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002292 }
2293}
David Tolnay8c81f622018-07-31 23:34:35 -07002294#[cfg(feature = "full")]
2295pub fn fold_method_turbofish<V: Fold + ?Sized>(
2296 _visitor: &mut V,
2297 _i: MethodTurbofish,
2298) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002299 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002300 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2301 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002302 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002303 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002304 }
2305}
David Tolnay440fe582019-02-15 20:23:14 -08002306#[cfg(any(feature = "derive", feature = "full"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002307pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002308 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002309 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2310 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002311 }
2312}
David Tolnay440fe582019-02-15 20:23:14 -08002313#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002314pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2315 _visitor: &mut V,
2316 _i: ParenthesizedGenericArguments,
2317) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002318 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002319 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002320 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2321 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002322 }
2323}
David Tolnay8c81f622018-07-31 23:34:35 -07002324#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002325pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002326 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002327 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2328 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2329 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2330 Pat::TupleStruct(_binding_0) => {
2331 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002332 }
David Tolnay8c81f622018-07-31 23:34:35 -07002333 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2334 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2335 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2336 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2337 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2338 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2339 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2340 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2341 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002342 }
2343}
David Tolnay8c81f622018-07-31 23:34:35 -07002344#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002345pub fn fold_pat_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002346 PatBox {
David Tolnay905ef2b2019-02-11 02:28:22 +01002347 box_token: Token![box](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002348 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002349 }
2350}
David Tolnay8c81f622018-07-31 23:34:35 -07002351#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002352pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002353 PatIdent {
David Tolnay905ef2b2019-02-11 02:28:22 +01002354 by_ref: (_i.by_ref).map(|it| Token![ref](tokens_helper(_visitor, &it.span))),
2355 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002356 ident: _visitor.fold_ident(_i.ident),
2357 subpat: (_i.subpat).map(|it| {
2358 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002359 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002360 Box::new(_visitor.fold_pat(*(it).1)),
2361 )
2362 }),
Nika Layzell27726662017-10-24 23:16:35 -04002363 }
2364}
David Tolnay8c81f622018-07-31 23:34:35 -07002365#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002366pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002367 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002368 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04002369 }
2370}
David Tolnay8c81f622018-07-31 23:34:35 -07002371#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002372pub fn fold_pat_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002373 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002374 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002375 }
2376}
David Tolnay8c81f622018-07-31 23:34:35 -07002377#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002378pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002379 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002380 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2381 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002382 }
2383}
David Tolnay8c81f622018-07-31 23:34:35 -07002384#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002385pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002386 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002387 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2388 limits: _visitor.fold_range_limits(_i.limits),
2389 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002390 }
2391}
David Tolnay8c81f622018-07-31 23:34:35 -07002392#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002393pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002394 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002395 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002396 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002397 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002398 }
2399}
David Tolnay8c81f622018-07-31 23:34:35 -07002400#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002401pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002402 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002403 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002404 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2405 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002406 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2407 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002408 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002409 }
2410}
David Tolnay8c81f622018-07-31 23:34:35 -07002411#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002412pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002413 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002414 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002415 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002416 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002417 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002418 }
2419}
David Tolnay8c81f622018-07-31 23:34:35 -07002420#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002421pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002422 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002423 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002424 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002425 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2426 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002427 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002428 }
2429}
David Tolnay8c81f622018-07-31 23:34:35 -07002430#[cfg(feature = "full")]
2431pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2432 _visitor: &mut V,
2433 _i: PatTupleStruct,
2434) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002435 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002436 path: _visitor.fold_path(_i.path),
2437 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002438 }
2439}
David Tolnay8c81f622018-07-31 23:34:35 -07002440#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002441pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002442 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002443}
David Tolnay8c81f622018-07-31 23:34:35 -07002444#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002445pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002446 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002447 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002448 }
2449}
David Tolnay440fe582019-02-15 20:23:14 -08002450#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002451pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002452 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002453 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002454 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002455 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002456 }
2457}
David Tolnay440fe582019-02-15 20:23:14 -08002458#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002459pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002460 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002461 PathArguments::None => PathArguments::None,
2462 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2463 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2464 ),
2465 PathArguments::Parenthesized(_binding_0) => {
2466 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002467 }
2468 }
2469}
David Tolnay440fe582019-02-15 20:23:14 -08002470#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002471pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002472 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002473 ident: _visitor.fold_ident(_i.ident),
2474 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002475 }
2476}
David Tolnay440fe582019-02-15 20:23:14 -08002477#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002478pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002479 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002480 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002481 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002482 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002483 }
2484}
David Tolnay440fe582019-02-15 20:23:14 -08002485#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002486pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2487 _visitor: &mut V,
2488 _i: PredicateLifetime,
2489) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002490 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002491 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay1b8e2852018-08-26 08:25:18 -04002492 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002493 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002494 }
2495}
David Tolnay440fe582019-02-15 20:23:14 -08002496#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002497pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002498 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002499 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2500 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002501 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002502 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002503 }
2504}
David Tolnay440fe582019-02-15 20:23:14 -08002505#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002506pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002507 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002508 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002509 ty: Box::new(_visitor.fold_type(*_i.ty)),
2510 position: _i.position,
David Tolnay905ef2b2019-02-11 02:28:22 +01002511 as_token: (_i.as_token).map(|it| Token![as](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002512 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002513 }
2514}
David Tolnay8c81f622018-07-31 23:34:35 -07002515#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002516pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002517 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002518 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002519 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002520 }
David Tolnay8c81f622018-07-31 23:34:35 -07002521 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002522 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002523 }
2524 }
2525}
David Tolnay440fe582019-02-15 20:23:14 -08002526#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002527pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002528 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002529 ReturnType::Default => ReturnType::Default,
2530 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002531 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002532 Box::new(_visitor.fold_type(*_binding_1)),
2533 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002534 }
2535}
David Tolnay8c81f622018-07-31 23:34:35 -07002536#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002537pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002538 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002539 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2540 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2541 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2542 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2543 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002544 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002545 ),
Nika Layzell27726662017-10-24 23:16:35 -04002546 }
2547}
David Tolnay440fe582019-02-15 20:23:14 -08002548#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002549pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002550 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002551 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002552 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2553 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2554 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002555 }
2556}
David Tolnay440fe582019-02-15 20:23:14 -08002557#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002558pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2559 _visitor: &mut V,
2560 _i: TraitBoundModifier,
2561) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002562 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002563 TraitBoundModifier::None => TraitBoundModifier::None,
2564 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002565 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002566 }
2567 }
2568}
David Tolnay8c81f622018-07-31 23:34:35 -07002569#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002570pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002571 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002572 TraitItem::Const(_binding_0) => {
2573 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002574 }
David Tolnay8c81f622018-07-31 23:34:35 -07002575 TraitItem::Method(_binding_0) => {
2576 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002577 }
David Tolnay8c81f622018-07-31 23:34:35 -07002578 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2579 TraitItem::Macro(_binding_0) => {
2580 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002581 }
David Tolnay8c81f622018-07-31 23:34:35 -07002582 TraitItem::Verbatim(_binding_0) => {
2583 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002584 }
Nika Layzell27726662017-10-24 23:16:35 -04002585 }
2586}
David Tolnay8c81f622018-07-31 23:34:35 -07002587#[cfg(feature = "full")]
2588pub fn fold_trait_item_const<V: Fold + ?Sized>(
2589 _visitor: &mut V,
2590 _i: TraitItemConst,
2591) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002592 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002593 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002594 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002595 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002596 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002597 ty: _visitor.fold_type(_i.ty),
2598 default: (_i.default).map(|it| {
2599 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002600 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002601 _visitor.fold_expr((it).1),
2602 )
2603 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002604 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002605 }
2606}
David Tolnay8c81f622018-07-31 23:34:35 -07002607#[cfg(feature = "full")]
2608pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2609 _visitor: &mut V,
2610 _i: TraitItemMacro,
2611) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002612 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002613 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2614 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002615 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002616 }
2617}
David Tolnay8c81f622018-07-31 23:34:35 -07002618#[cfg(feature = "full")]
2619pub fn fold_trait_item_method<V: Fold + ?Sized>(
2620 _visitor: &mut V,
2621 _i: TraitItemMethod,
2622) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002623 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002624 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2625 sig: _visitor.fold_method_sig(_i.sig),
2626 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002627 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002628 }
2629}
David Tolnay8c81f622018-07-31 23:34:35 -07002630#[cfg(feature = "full")]
2631pub fn fold_trait_item_type<V: Fold + ?Sized>(
2632 _visitor: &mut V,
2633 _i: TraitItemType,
2634) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002635 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002636 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002637 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002638 ident: _visitor.fold_ident(_i.ident),
2639 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002640 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002641 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2642 default: (_i.default).map(|it| {
2643 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002644 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002645 _visitor.fold_type((it).1),
2646 )
2647 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002648 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002649 }
2650}
David Tolnay8c81f622018-07-31 23:34:35 -07002651#[cfg(feature = "full")]
2652pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2653 _visitor: &mut V,
2654 _i: TraitItemVerbatim,
2655) -> TraitItemVerbatim {
2656 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002657}
David Tolnay440fe582019-02-15 20:23:14 -08002658#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002659pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002660 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002661 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2662 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2663 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2664 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2665 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2666 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2667 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2668 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2669 Type::TraitObject(_binding_0) => {
2670 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002671 }
David Tolnay8c81f622018-07-31 23:34:35 -07002672 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2673 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2674 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2675 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2676 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2677 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002678 }
2679}
David Tolnay440fe582019-02-15 20:23:14 -08002680#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002681pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002682 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002683 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002684 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002685 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002686 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002687 }
2688}
David Tolnay440fe582019-02-15 20:23:14 -08002689#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002690pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002691 TypeBareFn {
David Tolnay3779bb72018-08-26 18:46:07 -07002692 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002693 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002694 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002695 fn_token: Token![fn](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002696 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002697 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002698 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002699 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002700 }
2701}
David Tolnay440fe582019-02-15 20:23:14 -08002702#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002703pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002704 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002705 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002706 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002707 }
2708}
David Tolnay440fe582019-02-15 20:23:14 -08002709#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002710pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2711 _visitor: &mut V,
2712 _i: TypeImplTrait,
2713) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002714 TypeImplTrait {
David Tolnay8d642ab2019-03-26 09:23:37 -03002715 impl_token: Token![impl](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002716 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002717 }
2718}
David Tolnay440fe582019-02-15 20:23:14 -08002719#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002720pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002721 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002722 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002723 }
2724}
David Tolnay440fe582019-02-15 20:23:14 -08002725#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002726pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002727 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002728 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002729 }
2730}
David Tolnay440fe582019-02-15 20:23:14 -08002731#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002732pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002733 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002734 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002735 }
2736}
David Tolnay440fe582019-02-15 20:23:14 -08002737#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002738pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002739 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002740 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2741 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002742 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002743 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002744 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002745 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002746 }
2747}
David Tolnay440fe582019-02-15 20:23:14 -08002748#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002749pub fn fold_type_param_bound<V: Fold + ?Sized>(
2750 _visitor: &mut V,
2751 _i: TypeParamBound,
2752) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002753 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002754 TypeParamBound::Trait(_binding_0) => {
2755 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002756 }
David Tolnay8c81f622018-07-31 23:34:35 -07002757 TypeParamBound::Lifetime(_binding_0) => {
2758 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002759 }
2760 }
2761}
David Tolnay440fe582019-02-15 20:23:14 -08002762#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002763pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002764 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002765 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002766 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002767 }
2768}
David Tolnay440fe582019-02-15 20:23:14 -08002769#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002770pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002771 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002772 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2773 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002774 }
2775}
David Tolnay440fe582019-02-15 20:23:14 -08002776#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002777pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002778 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002779 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002780 const_token: (_i.const_token).map(|it| Token![const](tokens_helper(_visitor, &it.span))),
2781 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002782 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002783 }
2784}
David Tolnay440fe582019-02-15 20:23:14 -08002785#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002786pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002787 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002788 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002789 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002790 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002791 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002792 }
2793}
David Tolnay440fe582019-02-15 20:23:14 -08002794#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002795pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002796 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002797 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002798 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002799 }
2800}
David Tolnay440fe582019-02-15 20:23:14 -08002801#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002802pub fn fold_type_trait_object<V: Fold + ?Sized>(
2803 _visitor: &mut V,
2804 _i: TypeTraitObject,
2805) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002806 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002807 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002808 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002809 }
2810}
David Tolnay440fe582019-02-15 20:23:14 -08002811#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002812pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002813 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002814 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002815 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002816 }
2817}
David Tolnay440fe582019-02-15 20:23:14 -08002818#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002819pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002820 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002821}
David Tolnay440fe582019-02-15 20:23:14 -08002822#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002823pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002824 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002825 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002826 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002827 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002828 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2829 UnOp::Neg(_binding_0) => {
2830 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2831 }
Nika Layzell27726662017-10-24 23:16:35 -04002832 }
2833}
David Tolnay8c81f622018-07-31 23:34:35 -07002834#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002835pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002836 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002837 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002838 }
2839}
David Tolnay8c81f622018-07-31 23:34:35 -07002840#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002841pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2842 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002843 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002844 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002845 }
2846}
David Tolnay8c81f622018-07-31 23:34:35 -07002847#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002848pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2849 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002850 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002851 }
2852}
David Tolnay8c81f622018-07-31 23:34:35 -07002853#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002854pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002855 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002856 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002857 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002858 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002859 }
2860}
David Tolnay8c81f622018-07-31 23:34:35 -07002861#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002862pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2863 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002864 ident: _visitor.fold_ident(_i.ident),
David Tolnay905ef2b2019-02-11 02:28:22 +01002865 as_token: Token![as](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002866 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002867 }
2868}
David Tolnay8c81f622018-07-31 23:34:35 -07002869#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002870pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002871 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002872 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2873 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2874 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2875 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2876 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002877 }
2878}
David Tolnay440fe582019-02-15 20:23:14 -08002879#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002880pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002881 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002882 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2883 ident: _visitor.fold_ident(_i.ident),
2884 fields: _visitor.fold_fields(_i.fields),
2885 discriminant: (_i.discriminant).map(|it| {
2886 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002887 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002888 _visitor.fold_expr((it).1),
2889 )
2890 }),
Nika Layzell27726662017-10-24 23:16:35 -04002891 }
2892}
David Tolnay440fe582019-02-15 20:23:14 -08002893#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002894pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002895 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002896 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002897 }
2898}
David Tolnay440fe582019-02-15 20:23:14 -08002899#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002900pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002901 VisPublic {
David Tolnay905ef2b2019-02-11 02:28:22 +01002902 pub_token: Token![pub](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002903 }
2904}
David Tolnay440fe582019-02-15 20:23:14 -08002905#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002906pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002907 VisRestricted {
David Tolnay905ef2b2019-02-11 02:28:22 +01002908 pub_token: Token![pub](tokens_helper(_visitor, &_i.pub_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002909 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002910 in_token: (_i.in_token).map(|it| Token![in](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002911 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002912 }
2913}
David Tolnay440fe582019-02-15 20:23:14 -08002914#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002915pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002916 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002917 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2918 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2919 Visibility::Restricted(_binding_0) => {
2920 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002921 }
David Tolnay8c81f622018-07-31 23:34:35 -07002922 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04002923 }
2924}
David Tolnay440fe582019-02-15 20:23:14 -08002925#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002926pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002927 WhereClause {
David Tolnay905ef2b2019-02-11 02:28:22 +01002928 where_token: Token![where](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002929 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002930 }
2931}
David Tolnay440fe582019-02-15 20:23:14 -08002932#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002933pub fn fold_where_predicate<V: Fold + ?Sized>(
2934 _visitor: &mut V,
2935 _i: WherePredicate,
2936) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002937 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002938 WherePredicate::Type(_binding_0) => {
2939 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002940 }
David Tolnay8c81f622018-07-31 23:34:35 -07002941 WherePredicate::Lifetime(_binding_0) => {
2942 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002943 }
David Tolnay8c81f622018-07-31 23:34:35 -07002944 WherePredicate::Eq(_binding_0) => {
2945 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002946 }
2947 }
2948}
Carl Lerchecbf7cc12019-02-15 14:09:31 -08002949pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
2950 _i
2951}
2952pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
2953 let mut _i = _i;
2954 let span = _visitor.fold_span(_i.span());
2955 _i.set_span(span);
2956 _i
2957}