blob: c8a0d6912df8295eff9d294c02592393d6db14c4 [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 Tolnayd3f32142018-05-20 20:21:12 -0700822#[cfg(any(feature = "full", feature = "derive"))]
David Tolnay360efd22018-01-04 23:35:26 -0800823macro_rules! fold_span_only {
David Tolnay280202f2018-08-02 00:29:54 -0700824 ($f:ident : $t:ident) => {
David Tolnay4b4c4b62018-01-06 13:48:05 -0800825 pub fn $f<V: Fold + ?Sized>(_visitor: &mut V, mut _i: $t) -> $t {
Alex Crichton9a4dca22018-03-28 06:32:19 -0700826 let span = _visitor.fold_span(_i.span());
827 _i.set_span(span);
David Tolnay360efd22018-01-04 23:35:26 -0800828 _i
829 }
David Tolnay8c81f622018-07-31 23:34:35 -0700830 };
David Tolnayd0adf522017-12-29 01:30:07 -0500831}
David Tolnay360efd22018-01-04 23:35:26 -0800832#[cfg(any(feature = "full", feature = "derive"))]
833fold_span_only!(fold_lit_byte: LitByte);
834#[cfg(any(feature = "full", feature = "derive"))]
835fold_span_only!(fold_lit_byte_str: LitByteStr);
836#[cfg(any(feature = "full", feature = "derive"))]
837fold_span_only!(fold_lit_char: LitChar);
838#[cfg(any(feature = "full", feature = "derive"))]
839fold_span_only!(fold_lit_float: LitFloat);
840#[cfg(any(feature = "full", feature = "derive"))]
841fold_span_only!(fold_lit_int: LitInt);
842#[cfg(any(feature = "full", feature = "derive"))]
843fold_span_only!(fold_lit_str: LitStr);
David Tolnay440fe582019-02-15 20:23:14 -0800844#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800845pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400846 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400847 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700848 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400849 }
850}
David Tolnay440fe582019-02-15 20:23:14 -0800851#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700852pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
853 _visitor: &mut V,
854 _i: AngleBracketedGenericArguments,
855) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500856 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400857 colon2_token: (_i.colon2_token)
858 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
859 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700860 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400861 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400862 }
863}
David Tolnay8c81f622018-07-31 23:34:35 -0700864#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800865pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400866 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700867 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400868 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700869 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400870 }
871}
David Tolnay8c81f622018-07-31 23:34:35 -0700872#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800873pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400874 ArgSelf {
David Tolnay905ef2b2019-02-11 02:28:22 +0100875 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -0400876 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400877 }
878}
David Tolnay8c81f622018-07-31 23:34:35 -0700879#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800880pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400881 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400882 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700883 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +0100884 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -0400885 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400886 }
887}
David Tolnay8c81f622018-07-31 23:34:35 -0700888#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800889pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400890 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700891 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400892 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700893 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
894 guard: (_i.guard).map(|it| {
895 (
David Tolnay905ef2b2019-02-11 02:28:22 +0100896 Token![if](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700897 Box::new(_visitor.fold_expr(*(it).1)),
898 )
899 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400900 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700901 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400902 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400903 }
904}
David Tolnay440fe582019-02-15 20:23:14 -0800905#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800906pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400907 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700908 AttrStyle::Outer => AttrStyle::Outer,
909 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400910 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400911 }
912 }
913}
David Tolnay440fe582019-02-15 20:23:14 -0800914#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800915pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400916 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400917 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700918 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400919 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700920 path: _visitor.fold_path(_i.path),
921 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400922 }
923}
David Tolnay440fe582019-02-15 20:23:14 -0800924#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800925pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400926 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700927 name: (_i.name).map(|it| {
928 (
929 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400930 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700931 )
932 }),
933 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400934 }
935}
David Tolnay440fe582019-02-15 20:23:14 -0800936#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700937pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
938 _visitor: &mut V,
939 _i: BareFnArgName,
940) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400941 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700942 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
943 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400944 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400945 }
946 }
947}
David Tolnay440fe582019-02-15 20:23:14 -0800948#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800949pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -0400950 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700951 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400952 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400953 }
David Tolnay8c81f622018-07-31 23:34:35 -0700954 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400955 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400956 }
David Tolnay8c81f622018-07-31 23:34:35 -0700957 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400958 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400959 }
David Tolnay8c81f622018-07-31 23:34:35 -0700960 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400961 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400962 }
David Tolnay8c81f622018-07-31 23:34:35 -0700963 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400964 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400965 }
David Tolnay8c81f622018-07-31 23:34:35 -0700966 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400967 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400968 }
David Tolnay8c81f622018-07-31 23:34:35 -0700969 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400970 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400971 }
David Tolnay8c81f622018-07-31 23:34:35 -0700972 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400973 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400974 }
David Tolnay8c81f622018-07-31 23:34:35 -0700975 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400976 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400977 }
David Tolnay8c81f622018-07-31 23:34:35 -0700978 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400979 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400980 }
David Tolnay8c81f622018-07-31 23:34:35 -0700981 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400982 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400983 }
David Tolnay8c81f622018-07-31 23:34:35 -0700984 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400985 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400986 }
David Tolnay8c81f622018-07-31 23:34:35 -0700987 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400988 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400989 }
David Tolnay7ac699c2018-08-24 14:00:58 -0400990 BinOp::Lt(_binding_0) => {
991 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
992 }
David Tolnay8c81f622018-07-31 23:34:35 -0700993 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400994 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400995 }
David Tolnay8c81f622018-07-31 23:34:35 -0700996 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400997 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400998 }
David Tolnay8c81f622018-07-31 23:34:35 -0700999 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001000 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001001 }
David Tolnay7ac699c2018-08-24 14:00:58 -04001002 BinOp::Gt(_binding_0) => {
1003 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
1004 }
David Tolnay8c81f622018-07-31 23:34:35 -07001005 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001006 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001007 }
David Tolnay8c81f622018-07-31 23:34:35 -07001008 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001009 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001010 }
David Tolnay8c81f622018-07-31 23:34:35 -07001011 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001012 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001013 }
David Tolnay8c81f622018-07-31 23:34:35 -07001014 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001015 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001016 }
David Tolnay8c81f622018-07-31 23:34:35 -07001017 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001018 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001019 }
David Tolnay8c81f622018-07-31 23:34:35 -07001020 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001021 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001022 }
David Tolnay8c81f622018-07-31 23:34:35 -07001023 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001024 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001025 }
David Tolnay8c81f622018-07-31 23:34:35 -07001026 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001027 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001028 }
David Tolnay8c81f622018-07-31 23:34:35 -07001029 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001030 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001031 }
David Tolnay8c81f622018-07-31 23:34:35 -07001032 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001033 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001034 }
1035 }
1036}
David Tolnay440fe582019-02-15 20:23:14 -08001037#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001038pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001039 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001040 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001041 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001042 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001043 }
1044}
David Tolnay8c81f622018-07-31 23:34:35 -07001045#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001046pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001047 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001048 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001049 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001050 }
1051}
David Tolnay440fe582019-02-15 20:23:14 -08001052#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07001053pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1054 _visitor: &mut V,
1055 _i: BoundLifetimes,
1056) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001057 BoundLifetimes {
David Tolnay905ef2b2019-02-11 02:28:22 +01001058 for_token: Token![for](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001059 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001060 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001061 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001062 }
1063}
David Tolnay440fe582019-02-15 20:23:14 -08001064#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001065pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001066 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001067 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001068 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001069 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001070 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001071 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001072 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001073 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001074 }
1075}
David Tolnay440fe582019-02-15 20:23:14 -08001076#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay9d0882a2018-09-01 19:49:14 -07001077pub fn fold_constraint<V: Fold + ?Sized>(_visitor: &mut V, _i: Constraint) -> Constraint {
1078 Constraint {
1079 ident: _visitor.fold_ident(_i.ident),
1080 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
1081 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1082 }
1083}
David Tolnay8c81f622018-07-31 23:34:35 -07001084#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001085pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001086 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001087 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1088 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1089 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001090 }
1091}
David Tolnay8c81f622018-07-31 23:34:35 -07001092#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001093pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001094 DataEnum {
David Tolnay905ef2b2019-02-11 02:28:22 +01001095 enum_token: Token![enum](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001096 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001097 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001098 }
1099}
David Tolnay8c81f622018-07-31 23:34:35 -07001100#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001101pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001102 DataStruct {
David Tolnay905ef2b2019-02-11 02:28:22 +01001103 struct_token: Token![struct](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001104 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001105 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001106 }
1107}
David Tolnay8c81f622018-07-31 23:34:35 -07001108#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001109pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001110 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001111 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001112 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001113 }
1114}
David Tolnay8c81f622018-07-31 23:34:35 -07001115#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001116pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001117 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001118 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1119 vis: _visitor.fold_visibility(_i.vis),
1120 ident: _visitor.fold_ident(_i.ident),
1121 generics: _visitor.fold_generics(_i.generics),
1122 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001123 }
1124}
David Tolnay440fe582019-02-15 20:23:14 -08001125#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001126pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001127 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001128 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1129 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1130 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1131 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1132 Expr::MethodCall(_binding_0) => {
1133 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001134 }
David Tolnay8c81f622018-07-31 23:34:35 -07001135 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1136 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1137 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1138 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1139 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1140 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
David Tolnay9c119122018-09-01 18:47:02 -07001141 Expr::Let(_binding_0) => Expr::Let(full!(_visitor.fold_expr_let(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001142 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001143 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001144 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1145 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1146 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1147 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1148 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1149 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1150 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1151 Expr::AssignOp(_binding_0) => {
1152 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001153 }
David Tolnay8c81f622018-07-31 23:34:35 -07001154 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1155 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1156 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1157 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1158 Expr::Reference(_binding_0) => {
1159 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001160 }
David Tolnay8c81f622018-07-31 23:34:35 -07001161 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1162 Expr::Continue(_binding_0) => {
1163 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001164 }
David Tolnay8c81f622018-07-31 23:34:35 -07001165 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1166 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1167 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1168 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1169 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1170 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1171 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001172 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001173 Expr::TryBlock(_binding_0) => {
1174 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1175 }
David Tolnay8c81f622018-07-31 23:34:35 -07001176 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1177 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001178 }
1179}
David Tolnay8c81f622018-07-31 23:34:35 -07001180#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001181pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001182 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001183 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001184 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001185 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001186 }
1187}
David Tolnay8c81f622018-07-31 23:34:35 -07001188#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001189pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001190 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001191 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1192 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001193 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001194 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001195 }
1196}
David Tolnay8c81f622018-07-31 23:34:35 -07001197#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001198pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001199 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001200 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1201 left: Box::new(_visitor.fold_expr(*_i.left)),
1202 op: _visitor.fold_bin_op(_i.op),
1203 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001204 }
1205}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001206#[cfg(feature = "full")]
David Tolnay02a9c6f2018-08-24 18:58:45 -04001207pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1208 ExprAsync {
1209 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1210 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001211 capture: (_i.capture).map(|it| Token![move](tokens_helper(_visitor, &it.span))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001212 block: _visitor.fold_block(_i.block),
1213 }
1214}
David Tolnay440fe582019-02-15 20:23:14 -08001215#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001216pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001217 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001218 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1219 left: Box::new(_visitor.fold_expr(*_i.left)),
1220 op: _visitor.fold_bin_op(_i.op),
1221 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001222 }
1223}
David Tolnay8c81f622018-07-31 23:34:35 -07001224#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001225pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001226 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001227 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001228 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001229 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001230 }
1231}
David Tolnay8c81f622018-07-31 23:34:35 -07001232#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001233pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001234 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001235 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001236 box_token: Token![box](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001237 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001238 }
1239}
David Tolnay8c81f622018-07-31 23:34:35 -07001240#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001241pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001242 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001243 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001244 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001245 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1246 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001247 }
1248}
David Tolnay440fe582019-02-15 20:23:14 -08001249#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001250pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001251 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001252 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1253 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001254 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001255 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001256 }
1257}
David Tolnay440fe582019-02-15 20:23:14 -08001258#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001259pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001260 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001261 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1262 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001263 as_token: Token![as](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001264 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001265 }
1266}
David Tolnay8c81f622018-07-31 23:34:35 -07001267#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001268pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001269 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001270 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001271 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001272 movability: (_i.movability).map(|it| Token![static](tokens_helper(_visitor, &it.span))),
1273 capture: (_i.capture).map(|it| Token![move](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001274 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001275 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001276 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001277 output: _visitor.fold_return_type(_i.output),
1278 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001279 }
1280}
David Tolnay8c81f622018-07-31 23:34:35 -07001281#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001282pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001283 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001284 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001285 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001286 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001287 }
1288}
David Tolnay440fe582019-02-15 20:23:14 -08001289#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001290pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001291 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001292 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1293 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001294 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001295 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001296 }
1297}
David Tolnay8c81f622018-07-31 23:34:35 -07001298#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001299pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001300 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001301 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1302 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001303 for_token: Token![for](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001304 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001305 in_token: Token![in](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001306 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1307 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001308 }
1309}
David Tolnay8c81f622018-07-31 23:34:35 -07001310#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001311pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001312 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001313 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001314 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001315 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001316 }
1317}
David Tolnay8c81f622018-07-31 23:34:35 -07001318#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001319pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001320 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001321 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001322 if_token: Token![if](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001323 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1324 then_branch: _visitor.fold_block(_i.then_branch),
1325 else_branch: (_i.else_branch).map(|it| {
1326 (
David Tolnay905ef2b2019-02-11 02:28:22 +01001327 Token![else](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001328 Box::new(_visitor.fold_expr(*(it).1)),
1329 )
1330 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001331 }
1332}
David Tolnay8c81f622018-07-31 23:34:35 -07001333#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001334pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001335 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001336 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1337 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001338 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001339 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001340 }
1341}
David Tolnay440fe582019-02-15 20:23:14 -08001342#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001343pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001344 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001345 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1346 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001347 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001348 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001349 }
1350}
David Tolnay9c119122018-09-01 18:47:02 -07001351#[cfg(feature = "full")]
David Tolnay9c119122018-09-01 18:47:02 -07001352pub fn fold_expr_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLet) -> ExprLet {
1353 ExprLet {
1354 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001355 let_token: Token![let](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay9c119122018-09-01 18:47:02 -07001356 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
1357 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
1358 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1359 }
1360}
David Tolnay440fe582019-02-15 20:23:14 -08001361#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001362pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001363 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001364 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1365 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001366 }
1367}
David Tolnay8c81f622018-07-31 23:34:35 -07001368#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001369pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001370 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001371 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1372 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001373 loop_token: Token![loop](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001374 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001375 }
1376}
David Tolnay8c81f622018-07-31 23:34:35 -07001377#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001378pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001379 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001380 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1381 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001382 }
1383}
David Tolnay8c81f622018-07-31 23:34:35 -07001384#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001385pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001386 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001387 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001388 match_token: Token![match](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001389 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001390 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001391 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001392 }
1393}
David Tolnay8c81f622018-07-31 23:34:35 -07001394#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001395pub fn fold_expr_method_call<V: Fold + ?Sized>(
1396 _visitor: &mut V,
1397 _i: ExprMethodCall,
1398) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001399 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001400 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1401 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001402 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001403 method: _visitor.fold_ident(_i.method),
1404 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001405 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001406 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001407 }
1408}
David Tolnay440fe582019-02-15 20:23:14 -08001409#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001410pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001411 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001412 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001413 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001414 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001415 }
1416}
David Tolnay440fe582019-02-15 20:23:14 -08001417#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001418pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001419 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001420 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1421 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1422 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001423 }
1424}
David Tolnay8c81f622018-07-31 23:34:35 -07001425#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001426pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001427 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001428 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1429 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1430 limits: _visitor.fold_range_limits(_i.limits),
1431 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001432 }
1433}
David Tolnay8c81f622018-07-31 23:34:35 -07001434#[cfg(feature = "full")]
David Tolnay00674ba2018-03-31 18:14:11 +02001435pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1436 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001437 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001438 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001439 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001440 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001441 }
1442}
David Tolnay8c81f622018-07-31 23:34:35 -07001443#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001444pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001445 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001446 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001447 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001448 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001449 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001450 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001451 }
1452}
David Tolnay8c81f622018-07-31 23:34:35 -07001453#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001454pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001455 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001456 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001457 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001458 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001459 }
1460}
David Tolnay8c81f622018-07-31 23:34:35 -07001461#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001462pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001463 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001464 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1465 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001466 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001467 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001468 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001469 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001470 }
1471}
David Tolnay8c81f622018-07-31 23:34:35 -07001472#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001473pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001474 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001475 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1476 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001477 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001478 }
1479}
David Tolnay8c81f622018-07-31 23:34:35 -07001480#[cfg(feature = "full")]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001481pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1482 ExprTryBlock {
1483 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1484 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1485 block: _visitor.fold_block(_i.block),
1486 }
1487}
1488#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001489pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001490 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001491 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001492 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001493 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001494 }
1495}
David Tolnay8c81f622018-07-31 23:34:35 -07001496#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001497pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001498 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001499 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1500 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001501 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001502 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001503 }
1504}
David Tolnay440fe582019-02-15 20:23:14 -08001505#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001506pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001507 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001508 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1509 op: _visitor.fold_un_op(_i.op),
1510 expr: Box::new(_visitor.fold_expr(*_i.expr)),
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_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001515 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001516 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001517 unsafe_token: Token![unsafe](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001518 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001519 }
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_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001523 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001524}
David Tolnay8c81f622018-07-31 23:34:35 -07001525#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001526pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001527 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001528 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1529 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001530 while_token: Token![while](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001531 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1532 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001533 }
1534}
David Tolnay8c81f622018-07-31 23:34:35 -07001535#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001536pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001537 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001538 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001539 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001540 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001541 }
1542}
David Tolnay440fe582019-02-15 20:23:14 -08001543#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001544pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001545 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001546 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1547 vis: _visitor.fold_visibility(_i.vis),
1548 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001549 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001550 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001551 }
1552}
David Tolnay8c81f622018-07-31 23:34:35 -07001553#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001554pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001555 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001556 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1557 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001558 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001559 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001560 }
1561}
David Tolnay8c81f622018-07-31 23:34:35 -07001562#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001563pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001564 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001565 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1566 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001567 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001568 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001569 }
1570}
David Tolnay440fe582019-02-15 20:23:14 -08001571#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001572pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001573 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001574 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1575 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1576 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001577 }
1578}
David Tolnay440fe582019-02-15 20:23:14 -08001579#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001580pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001581 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001582 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001583 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001584 }
1585}
David Tolnay440fe582019-02-15 20:23:14 -08001586#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001587pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001588 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001589 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001590 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001591 }
1592}
David Tolnay8c81f622018-07-31 23:34:35 -07001593#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001594pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001595 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001596 shebang: _i.shebang,
1597 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1598 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001599 }
1600}
David Tolnay8c81f622018-07-31 23:34:35 -07001601#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001602pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001603 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001604 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1605 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1606 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1607 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1608 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001609 }
1610}
David Tolnay8c81f622018-07-31 23:34:35 -07001611#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001612pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001613 FnDecl {
David Tolnay905ef2b2019-02-11 02:28:22 +01001614 fn_token: Token![fn](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001615 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001616 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001617 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001618 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001619 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04001620 }
1621}
David Tolnay8c81f622018-07-31 23:34:35 -07001622#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001623pub fn fold_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001624 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001625 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1626 ForeignItem::Static(_binding_0) => {
1627 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001628 }
David Tolnay8c81f622018-07-31 23:34:35 -07001629 ForeignItem::Type(_binding_0) => {
1630 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001631 }
David Tolnay435c1782018-08-24 16:15:44 -04001632 ForeignItem::Macro(_binding_0) => {
1633 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1634 }
David Tolnay8c81f622018-07-31 23:34:35 -07001635 ForeignItem::Verbatim(_binding_0) => {
1636 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001637 }
Nika Layzell27726662017-10-24 23:16:35 -04001638 }
1639}
David Tolnay8c81f622018-07-31 23:34:35 -07001640#[cfg(feature = "full")]
1641pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1642 _visitor: &mut V,
1643 _i: ForeignItemFn,
1644) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001645 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001646 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1647 vis: _visitor.fold_visibility(_i.vis),
1648 ident: _visitor.fold_ident(_i.ident),
1649 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001650 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001651 }
1652}
David Tolnay8c81f622018-07-31 23:34:35 -07001653#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001654pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1655 _visitor: &mut V,
1656 _i: ForeignItemMacro,
1657) -> ForeignItemMacro {
1658 ForeignItemMacro {
1659 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1660 mac: _visitor.fold_macro(_i.mac),
1661 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1662 }
1663}
1664#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001665pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1666 _visitor: &mut V,
1667 _i: ForeignItemStatic,
1668) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001669 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001670 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1671 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001672 static_token: Token![static](tokens_helper(_visitor, &_i.static_token.span)),
1673 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001674 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001675 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001676 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001677 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001678 }
1679}
David Tolnay8c81f622018-07-31 23:34:35 -07001680#[cfg(feature = "full")]
1681pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1682 _visitor: &mut V,
1683 _i: ForeignItemType,
1684) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001685 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001686 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1687 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001688 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001689 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001690 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001691 }
1692}
David Tolnay8c81f622018-07-31 23:34:35 -07001693#[cfg(feature = "full")]
1694pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1695 _visitor: &mut V,
1696 _i: ForeignItemVerbatim,
1697) -> ForeignItemVerbatim {
1698 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001699}
David Tolnay440fe582019-02-15 20:23:14 -08001700#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07001701pub fn fold_generic_argument<V: Fold + ?Sized>(
1702 _visitor: &mut V,
1703 _i: GenericArgument,
1704) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001705 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001706 GenericArgument::Lifetime(_binding_0) => {
1707 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001708 }
David Tolnay8c81f622018-07-31 23:34:35 -07001709 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1710 GenericArgument::Binding(_binding_0) => {
1711 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001712 }
David Tolnay9d0882a2018-09-01 19:49:14 -07001713 GenericArgument::Constraint(_binding_0) => {
1714 GenericArgument::Constraint(_visitor.fold_constraint(_binding_0))
1715 }
David Tolnay8c81f622018-07-31 23:34:35 -07001716 GenericArgument::Const(_binding_0) => {
1717 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001718 }
Nika Layzell357885a2017-12-04 15:47:07 -05001719 }
1720}
David Tolnay8c81f622018-07-31 23:34:35 -07001721#[cfg(feature = "full")]
1722pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1723 _visitor: &mut V,
1724 _i: GenericMethodArgument,
1725) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001726 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001727 GenericMethodArgument::Type(_binding_0) => {
1728 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001729 }
David Tolnay8c81f622018-07-31 23:34:35 -07001730 GenericMethodArgument::Const(_binding_0) => {
1731 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001732 }
1733 }
1734}
David Tolnay440fe582019-02-15 20:23:14 -08001735#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001736pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001737 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001738 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1739 GenericParam::Lifetime(_binding_0) => {
1740 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001741 }
David Tolnay8c81f622018-07-31 23:34:35 -07001742 GenericParam::Const(_binding_0) => {
1743 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001744 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001745 }
1746}
David Tolnay440fe582019-02-15 20:23:14 -08001747#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001748pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001749 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001750 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001751 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001752 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001753 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001754 }
1755}
David Tolnay8c81f622018-07-31 23:34:35 -07001756#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001757pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001758 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001759 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1760 ImplItem::Method(_binding_0) => {
1761 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001762 }
David Tolnay8c81f622018-07-31 23:34:35 -07001763 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001764 ImplItem::Existential(_binding_0) => {
1765 ImplItem::Existential(_visitor.fold_impl_item_existential(_binding_0))
1766 }
David Tolnay8c81f622018-07-31 23:34:35 -07001767 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1768 ImplItem::Verbatim(_binding_0) => {
1769 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001770 }
Nika Layzell27726662017-10-24 23:16:35 -04001771 }
1772}
David Tolnay8c81f622018-07-31 23:34:35 -07001773#[cfg(feature = "full")]
1774pub fn fold_impl_item_const<V: Fold + ?Sized>(
1775 _visitor: &mut V,
1776 _i: ImplItemConst,
1777) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001778 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001779 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1780 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001781 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001782 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001783 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001784 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001785 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001786 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001787 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001788 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001789 }
1790}
David Tolnay8c81f622018-07-31 23:34:35 -07001791#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001792pub fn fold_impl_item_existential<V: Fold + ?Sized>(
1793 _visitor: &mut V,
1794 _i: ImplItemExistential,
1795) -> ImplItemExistential {
1796 ImplItemExistential {
1797 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1798 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001799 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001800 ident: _visitor.fold_ident(_i.ident),
1801 generics: _visitor.fold_generics(_i.generics),
1802 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1803 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1804 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1805 }
1806}
1807#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001808pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1809 _visitor: &mut V,
1810 _i: ImplItemMacro,
1811) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001812 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001813 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1814 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001815 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001816 }
1817}
David Tolnay8c81f622018-07-31 23:34:35 -07001818#[cfg(feature = "full")]
1819pub fn fold_impl_item_method<V: Fold + ?Sized>(
1820 _visitor: &mut V,
1821 _i: ImplItemMethod,
1822) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001823 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001824 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1825 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001826 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001827 sig: _visitor.fold_method_sig(_i.sig),
1828 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001829 }
1830}
David Tolnay8c81f622018-07-31 23:34:35 -07001831#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001832pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001833 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001834 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1835 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001836 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001837 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001838 ident: _visitor.fold_ident(_i.ident),
1839 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001840 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001841 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001842 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001843 }
1844}
David Tolnay8c81f622018-07-31 23:34:35 -07001845#[cfg(feature = "full")]
1846pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1847 _visitor: &mut V,
1848 _i: ImplItemVerbatim,
1849) -> ImplItemVerbatim {
1850 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001851}
David Tolnay440fe582019-02-15 20:23:14 -08001852#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001853pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001854 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001855 index: _i.index,
1856 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001857 }
1858}
David Tolnay8c81f622018-07-31 23:34:35 -07001859#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001860pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001861 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001862 Item::ExternCrate(_binding_0) => {
1863 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001864 }
David Tolnay8c81f622018-07-31 23:34:35 -07001865 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1866 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1867 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1868 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1869 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1870 Item::ForeignMod(_binding_0) => {
1871 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001872 }
David Tolnay8c81f622018-07-31 23:34:35 -07001873 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001874 Item::Existential(_binding_0) => {
1875 Item::Existential(_visitor.fold_item_existential(_binding_0))
1876 }
David Tolnay8c81f622018-07-31 23:34:35 -07001877 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1878 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1879 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1880 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07001881 Item::TraitAlias(_binding_0) => {
1882 Item::TraitAlias(_visitor.fold_item_trait_alias(_binding_0))
1883 }
David Tolnay8c81f622018-07-31 23:34:35 -07001884 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1885 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1886 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1887 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001888 }
1889}
David Tolnay8c81f622018-07-31 23:34:35 -07001890#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001891pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001892 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001893 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1894 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001895 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001896 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001897 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001898 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001899 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001900 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001901 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001902 }
1903}
David Tolnay8c81f622018-07-31 23:34:35 -07001904#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001905pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001906 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001907 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1908 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001909 enum_token: Token![enum](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001910 ident: _visitor.fold_ident(_i.ident),
1911 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001912 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001913 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001914 }
1915}
David Tolnay8c81f622018-07-31 23:34:35 -07001916#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001917pub fn fold_item_existential<V: Fold + ?Sized>(
1918 _visitor: &mut V,
1919 _i: ItemExistential,
1920) -> ItemExistential {
1921 ItemExistential {
1922 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1923 vis: _visitor.fold_visibility(_i.vis),
1924 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001925 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001926 ident: _visitor.fold_ident(_i.ident),
1927 generics: _visitor.fold_generics(_i.generics),
1928 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1929 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1930 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1931 }
1932}
1933#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001934pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1935 _visitor: &mut V,
1936 _i: ItemExternCrate,
1937) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001938 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001939 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1940 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001941 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
1942 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001943 ident: _visitor.fold_ident(_i.ident),
1944 rename: (_i.rename).map(|it| {
1945 (
David Tolnay905ef2b2019-02-11 02:28:22 +01001946 Token![as](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001947 _visitor.fold_ident((it).1),
1948 )
1949 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04001950 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001951 }
1952}
David Tolnay8c81f622018-07-31 23:34:35 -07001953#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001954pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001955 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001956 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1957 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001958 constness: (_i.constness).map(|it| Token![const](tokens_helper(_visitor, &it.span))),
1959 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09001960 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001961 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
1962 ident: _visitor.fold_ident(_i.ident),
1963 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
1964 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001965 }
1966}
David Tolnay8c81f622018-07-31 23:34:35 -07001967#[cfg(feature = "full")]
1968pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
1969 _visitor: &mut V,
1970 _i: ItemForeignMod,
1971) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001972 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07001973 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1974 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04001975 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001976 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001977 }
1978}
David Tolnay8c81f622018-07-31 23:34:35 -07001979#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001980pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001981 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07001982 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001983 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001984 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay8d642ab2019-03-26 09:23:37 -03001985 impl_token: Token![impl](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001986 generics: _visitor.fold_generics(_i.generics),
1987 trait_: (_i.trait_).map(|it| {
1988 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001989 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001990 _visitor.fold_path((it).1),
David Tolnay905ef2b2019-02-11 02:28:22 +01001991 Token![for](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001992 )
1993 }),
1994 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001995 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001996 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001997 }
1998}
David Tolnay8c81f622018-07-31 23:34:35 -07001999#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002000pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002001 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002002 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2003 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
2004 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002005 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08002006 }
2007}
David Tolnay8c81f622018-07-31 23:34:35 -07002008#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002009pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08002010 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07002011 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2012 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002013 macro_token: Token![macro](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002014 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002015 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002016 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04002017 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002018 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08002019 }
2020}
David Tolnay8c81f622018-07-31 23:34:35 -07002021#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002022pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002023 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002024 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2025 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002026 mod_token: Token![mod](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002027 ident: _visitor.fold_ident(_i.ident),
2028 content: (_i.content).map(|it| {
2029 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002030 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002031 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2032 )
2033 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002034 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002035 }
2036}
David Tolnay8c81f622018-07-31 23:34:35 -07002037#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002038pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002039 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002040 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2041 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002042 static_token: Token![static](tokens_helper(_visitor, &_i.static_token.span)),
2043 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002044 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002045 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002046 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002047 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002048 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002049 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002050 }
2051}
David Tolnay8c81f622018-07-31 23:34:35 -07002052#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002053pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002054 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002055 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2056 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002057 struct_token: Token![struct](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002058 ident: _visitor.fold_ident(_i.ident),
2059 generics: _visitor.fold_generics(_i.generics),
2060 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002061 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002062 }
2063}
David Tolnay8c81f622018-07-31 23:34:35 -07002064#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002065pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002066 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002067 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2068 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002069 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002070 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01002071 trait_token: Token![trait](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002072 ident: _visitor.fold_ident(_i.ident),
2073 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002074 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002075 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002076 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002077 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002078 }
2079}
David Tolnay8c81f622018-07-31 23:34:35 -07002080#[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -07002081pub fn fold_item_trait_alias<V: Fold + ?Sized>(
2082 _visitor: &mut V,
2083 _i: ItemTraitAlias,
2084) -> ItemTraitAlias {
2085 ItemTraitAlias {
2086 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2087 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002088 trait_token: Token![trait](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07002089 ident: _visitor.fold_ident(_i.ident),
2090 generics: _visitor.fold_generics(_i.generics),
2091 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
2092 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2093 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2094 }
2095}
2096#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002097pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002098 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002099 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2100 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002101 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002102 ident: _visitor.fold_ident(_i.ident),
2103 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002104 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002105 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002106 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002107 }
2108}
David Tolnay8c81f622018-07-31 23:34:35 -07002109#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002110pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002111 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002112 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2113 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002114 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002115 ident: _visitor.fold_ident(_i.ident),
2116 generics: _visitor.fold_generics(_i.generics),
2117 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002118 }
2119}
David Tolnay8c81f622018-07-31 23:34:35 -07002120#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002121pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002122 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002123 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2124 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002125 use_token: Token![use](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002126 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002127 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002128 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002129 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002130 }
2131}
David Tolnay8c81f622018-07-31 23:34:35 -07002132#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002133pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002134 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002135}
David Tolnay8c81f622018-07-31 23:34:35 -07002136#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002137pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002138 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002139 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002140 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002141 }
2142}
Alex Crichton131308c2018-05-18 14:00:24 -07002143pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2144 Lifetime {
David Tolnay17f63892018-08-31 10:36:32 -07002145 apostrophe: _visitor.fold_span(_i.apostrophe),
David Tolnay8c81f622018-07-31 23:34:35 -07002146 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002147 }
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_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002151 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002152 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2153 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002154 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002155 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002156 }
2157}
David Tolnay440fe582019-02-15 20:23:14 -08002158#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002159pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002160 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002161 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2162 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2163 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2164 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2165 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2166 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2167 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2168 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002169 }
2170}
David Tolnay440fe582019-02-15 20:23:14 -08002171#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002172pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002173 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002174 value: _i.value,
2175 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002176 }
2177}
David Tolnay440fe582019-02-15 20:23:14 -08002178#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002179pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002180 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002181}
David Tolnay8c81f622018-07-31 23:34:35 -07002182#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002183pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002184 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002185 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002186 let_token: Token![let](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002187 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2188 ty: (_i.ty).map(|it| {
2189 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002190 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002191 Box::new(_visitor.fold_type(*(it).1)),
2192 )
2193 }),
2194 init: (_i.init).map(|it| {
2195 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002196 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002197 Box::new(_visitor.fold_expr(*(it).1)),
2198 )
2199 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002200 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002201 }
2202}
David Tolnay440fe582019-02-15 20:23:14 -08002203#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002204pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002205 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002206 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002207 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002208 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2209 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002210 }
2211}
David Tolnay440fe582019-02-15 20:23:14 -08002212#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002213pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2214 _visitor: &mut V,
2215 _i: MacroDelimiter,
2216) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002217 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002218 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002219 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002220 }
David Tolnay8c81f622018-07-31 23:34:35 -07002221 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002222 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002223 }
David Tolnay8c81f622018-07-31 23:34:35 -07002224 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002225 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002226 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002227 }
2228}
David Tolnay440fe582019-02-15 20:23:14 -08002229#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002230pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002231 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002232 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2233 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002234 }
2235}
David Tolnay440fe582019-02-15 20:23:14 -08002236#[cfg(any(feature = "derive", feature = "full"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002237pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002238 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002239 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2240 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2241 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002242 }
2243}
David Tolnay440fe582019-02-15 20:23:14 -08002244#[cfg(any(feature = "derive", feature = "full"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002245pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2246 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002247 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002248 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002249 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002250 }
2251}
David Tolnay440fe582019-02-15 20:23:14 -08002252#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002253pub fn fold_meta_name_value<V: Fold + ?Sized>(
2254 _visitor: &mut V,
2255 _i: MetaNameValue,
2256) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002257 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002258 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002259 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002260 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002261 }
2262}
David Tolnay8c81f622018-07-31 23:34:35 -07002263#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002264pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002265 MethodSig {
David Tolnay905ef2b2019-02-11 02:28:22 +01002266 constness: (_i.constness).map(|it| Token![const](tokens_helper(_visitor, &it.span))),
2267 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002268 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002269 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2270 ident: _visitor.fold_ident(_i.ident),
2271 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002272 }
2273}
David Tolnay8c81f622018-07-31 23:34:35 -07002274#[cfg(feature = "full")]
2275pub fn fold_method_turbofish<V: Fold + ?Sized>(
2276 _visitor: &mut V,
2277 _i: MethodTurbofish,
2278) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002279 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002280 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2281 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002282 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002283 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002284 }
2285}
David Tolnay440fe582019-02-15 20:23:14 -08002286#[cfg(any(feature = "derive", feature = "full"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002287pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002288 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002289 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2290 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002291 }
2292}
David Tolnay440fe582019-02-15 20:23:14 -08002293#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002294pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2295 _visitor: &mut V,
2296 _i: ParenthesizedGenericArguments,
2297) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002298 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002299 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002300 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2301 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002302 }
2303}
David Tolnay8c81f622018-07-31 23:34:35 -07002304#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002305pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002306 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002307 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2308 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2309 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2310 Pat::TupleStruct(_binding_0) => {
2311 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002312 }
David Tolnay8c81f622018-07-31 23:34:35 -07002313 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2314 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2315 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2316 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2317 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2318 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2319 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2320 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2321 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
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_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002326 PatBox {
David Tolnay905ef2b2019-02-11 02:28:22 +01002327 box_token: Token![box](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002328 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002329 }
2330}
David Tolnay8c81f622018-07-31 23:34:35 -07002331#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002332pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002333 PatIdent {
David Tolnay905ef2b2019-02-11 02:28:22 +01002334 by_ref: (_i.by_ref).map(|it| Token![ref](tokens_helper(_visitor, &it.span))),
2335 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002336 ident: _visitor.fold_ident(_i.ident),
2337 subpat: (_i.subpat).map(|it| {
2338 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002339 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002340 Box::new(_visitor.fold_pat(*(it).1)),
2341 )
2342 }),
Nika Layzell27726662017-10-24 23:16:35 -04002343 }
2344}
David Tolnay8c81f622018-07-31 23:34:35 -07002345#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002346pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002347 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002348 expr: Box::new(_visitor.fold_expr(*_i.expr)),
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_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002353 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002354 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002355 }
2356}
David Tolnay8c81f622018-07-31 23:34:35 -07002357#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002358pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002359 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002360 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2361 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002362 }
2363}
David Tolnay8c81f622018-07-31 23:34:35 -07002364#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002365pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002366 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002367 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2368 limits: _visitor.fold_range_limits(_i.limits),
2369 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002370 }
2371}
David Tolnay8c81f622018-07-31 23:34:35 -07002372#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002373pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002374 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002375 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002376 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002377 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002378 }
2379}
David Tolnay8c81f622018-07-31 23:34:35 -07002380#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002381pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002382 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002383 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002384 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2385 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002386 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2387 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002388 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002389 }
2390}
David Tolnay8c81f622018-07-31 23:34:35 -07002391#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002392pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002393 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002394 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002395 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002396 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002397 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
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_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002402 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002403 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002404 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002405 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2406 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002407 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002408 }
2409}
David Tolnay8c81f622018-07-31 23:34:35 -07002410#[cfg(feature = "full")]
2411pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2412 _visitor: &mut V,
2413 _i: PatTupleStruct,
2414) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002415 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002416 path: _visitor.fold_path(_i.path),
2417 pat: _visitor.fold_pat_tuple(_i.pat),
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_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002422 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002423}
David Tolnay8c81f622018-07-31 23:34:35 -07002424#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002425pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002426 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002427 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002428 }
2429}
David Tolnay440fe582019-02-15 20:23:14 -08002430#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002431pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002432 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002433 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002434 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002435 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002436 }
2437}
David Tolnay440fe582019-02-15 20:23:14 -08002438#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002439pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002440 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002441 PathArguments::None => PathArguments::None,
2442 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2443 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2444 ),
2445 PathArguments::Parenthesized(_binding_0) => {
2446 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002447 }
2448 }
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_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002452 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002453 ident: _visitor.fold_ident(_i.ident),
2454 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002455 }
2456}
David Tolnay440fe582019-02-15 20:23:14 -08002457#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002458pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002459 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002460 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002461 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002462 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002463 }
2464}
David Tolnay440fe582019-02-15 20:23:14 -08002465#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002466pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2467 _visitor: &mut V,
2468 _i: PredicateLifetime,
2469) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002470 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002471 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay1b8e2852018-08-26 08:25:18 -04002472 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002473 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002474 }
2475}
David Tolnay440fe582019-02-15 20:23:14 -08002476#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002477pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002478 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002479 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2480 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002481 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002482 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002483 }
2484}
David Tolnay440fe582019-02-15 20:23:14 -08002485#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002486pub fn fold_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002487 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002488 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002489 ty: Box::new(_visitor.fold_type(*_i.ty)),
2490 position: _i.position,
David Tolnay905ef2b2019-02-11 02:28:22 +01002491 as_token: (_i.as_token).map(|it| Token![as](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002492 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002493 }
2494}
David Tolnay8c81f622018-07-31 23:34:35 -07002495#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002496pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002497 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002498 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002499 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002500 }
David Tolnay8c81f622018-07-31 23:34:35 -07002501 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002502 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002503 }
2504 }
2505}
David Tolnay440fe582019-02-15 20:23:14 -08002506#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002507pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002508 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002509 ReturnType::Default => ReturnType::Default,
2510 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002511 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002512 Box::new(_visitor.fold_type(*_binding_1)),
2513 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002514 }
2515}
David Tolnay8c81f622018-07-31 23:34:35 -07002516#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002517pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002518 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002519 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2520 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2521 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2522 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2523 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002524 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002525 ),
Nika Layzell27726662017-10-24 23:16:35 -04002526 }
2527}
David Tolnay440fe582019-02-15 20:23:14 -08002528#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002529pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002530 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002531 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002532 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2533 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2534 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002535 }
2536}
David Tolnay440fe582019-02-15 20:23:14 -08002537#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002538pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2539 _visitor: &mut V,
2540 _i: TraitBoundModifier,
2541) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002542 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002543 TraitBoundModifier::None => TraitBoundModifier::None,
2544 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002545 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002546 }
2547 }
2548}
David Tolnay8c81f622018-07-31 23:34:35 -07002549#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002550pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002551 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002552 TraitItem::Const(_binding_0) => {
2553 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002554 }
David Tolnay8c81f622018-07-31 23:34:35 -07002555 TraitItem::Method(_binding_0) => {
2556 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002557 }
David Tolnay8c81f622018-07-31 23:34:35 -07002558 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2559 TraitItem::Macro(_binding_0) => {
2560 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002561 }
David Tolnay8c81f622018-07-31 23:34:35 -07002562 TraitItem::Verbatim(_binding_0) => {
2563 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002564 }
Nika Layzell27726662017-10-24 23:16:35 -04002565 }
2566}
David Tolnay8c81f622018-07-31 23:34:35 -07002567#[cfg(feature = "full")]
2568pub fn fold_trait_item_const<V: Fold + ?Sized>(
2569 _visitor: &mut V,
2570 _i: TraitItemConst,
2571) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002572 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002573 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002574 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002575 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002576 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002577 ty: _visitor.fold_type(_i.ty),
2578 default: (_i.default).map(|it| {
2579 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002580 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002581 _visitor.fold_expr((it).1),
2582 )
2583 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002584 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002585 }
2586}
David Tolnay8c81f622018-07-31 23:34:35 -07002587#[cfg(feature = "full")]
2588pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2589 _visitor: &mut V,
2590 _i: TraitItemMacro,
2591) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002592 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002593 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2594 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002595 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002596 }
2597}
David Tolnay8c81f622018-07-31 23:34:35 -07002598#[cfg(feature = "full")]
2599pub fn fold_trait_item_method<V: Fold + ?Sized>(
2600 _visitor: &mut V,
2601 _i: TraitItemMethod,
2602) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002603 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002604 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2605 sig: _visitor.fold_method_sig(_i.sig),
2606 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002607 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002608 }
2609}
David Tolnay8c81f622018-07-31 23:34:35 -07002610#[cfg(feature = "full")]
2611pub fn fold_trait_item_type<V: Fold + ?Sized>(
2612 _visitor: &mut V,
2613 _i: TraitItemType,
2614) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002615 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002616 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002617 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002618 ident: _visitor.fold_ident(_i.ident),
2619 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002620 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002621 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2622 default: (_i.default).map(|it| {
2623 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002624 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002625 _visitor.fold_type((it).1),
2626 )
2627 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002628 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002629 }
2630}
David Tolnay8c81f622018-07-31 23:34:35 -07002631#[cfg(feature = "full")]
2632pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2633 _visitor: &mut V,
2634 _i: TraitItemVerbatim,
2635) -> TraitItemVerbatim {
2636 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002637}
David Tolnay440fe582019-02-15 20:23:14 -08002638#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002639pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002640 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002641 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2642 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2643 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2644 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2645 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2646 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2647 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2648 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2649 Type::TraitObject(_binding_0) => {
2650 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002651 }
David Tolnay8c81f622018-07-31 23:34:35 -07002652 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2653 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2654 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2655 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2656 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2657 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002658 }
2659}
David Tolnay440fe582019-02-15 20:23:14 -08002660#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002661pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002662 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002663 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002664 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002665 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002666 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002667 }
2668}
David Tolnay440fe582019-02-15 20:23:14 -08002669#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002670pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002671 TypeBareFn {
David Tolnay3779bb72018-08-26 18:46:07 -07002672 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002673 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002674 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002675 fn_token: Token![fn](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002676 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002677 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002678 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002679 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002680 }
2681}
David Tolnay440fe582019-02-15 20:23:14 -08002682#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002683pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002684 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002685 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002686 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002687 }
2688}
David Tolnay440fe582019-02-15 20:23:14 -08002689#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002690pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2691 _visitor: &mut V,
2692 _i: TypeImplTrait,
2693) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002694 TypeImplTrait {
David Tolnay8d642ab2019-03-26 09:23:37 -03002695 impl_token: Token![impl](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002696 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002697 }
2698}
David Tolnay440fe582019-02-15 20:23:14 -08002699#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002700pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002701 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002702 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002703 }
2704}
David Tolnay440fe582019-02-15 20:23:14 -08002705#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002706pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002707 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002708 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002709 }
2710}
David Tolnay440fe582019-02-15 20:23:14 -08002711#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002712pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002713 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002714 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002715 }
2716}
David Tolnay440fe582019-02-15 20:23:14 -08002717#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002718pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002719 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002720 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2721 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002722 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002723 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002724 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002725 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002726 }
2727}
David Tolnay440fe582019-02-15 20:23:14 -08002728#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002729pub fn fold_type_param_bound<V: Fold + ?Sized>(
2730 _visitor: &mut V,
2731 _i: TypeParamBound,
2732) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002733 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002734 TypeParamBound::Trait(_binding_0) => {
2735 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002736 }
David Tolnay8c81f622018-07-31 23:34:35 -07002737 TypeParamBound::Lifetime(_binding_0) => {
2738 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002739 }
2740 }
2741}
David Tolnay440fe582019-02-15 20:23:14 -08002742#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002743pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002744 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002745 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002746 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002747 }
2748}
David Tolnay440fe582019-02-15 20:23:14 -08002749#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002750pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002751 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002752 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2753 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002754 }
2755}
David Tolnay440fe582019-02-15 20:23:14 -08002756#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002757pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002758 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002759 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002760 const_token: (_i.const_token).map(|it| Token![const](tokens_helper(_visitor, &it.span))),
2761 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002762 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002763 }
2764}
David Tolnay440fe582019-02-15 20:23:14 -08002765#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002766pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002767 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002768 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002769 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002770 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002771 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002772 }
2773}
David Tolnay440fe582019-02-15 20:23:14 -08002774#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002775pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002776 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002777 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002778 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002779 }
2780}
David Tolnay440fe582019-02-15 20:23:14 -08002781#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002782pub fn fold_type_trait_object<V: Fold + ?Sized>(
2783 _visitor: &mut V,
2784 _i: TypeTraitObject,
2785) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002786 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002787 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002788 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002789 }
2790}
David Tolnay440fe582019-02-15 20:23:14 -08002791#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002792pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002793 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002794 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002795 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002796 }
2797}
David Tolnay440fe582019-02-15 20:23:14 -08002798#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002799pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002800 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002801}
David Tolnay440fe582019-02-15 20:23:14 -08002802#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002803pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002804 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002805 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002806 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002807 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002808 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2809 UnOp::Neg(_binding_0) => {
2810 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2811 }
Nika Layzell27726662017-10-24 23:16:35 -04002812 }
2813}
David Tolnay8c81f622018-07-31 23:34:35 -07002814#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002815pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002816 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002817 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002818 }
2819}
David Tolnay8c81f622018-07-31 23:34:35 -07002820#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002821pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2822 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002823 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002824 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002825 }
2826}
David Tolnay8c81f622018-07-31 23:34:35 -07002827#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002828pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2829 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002830 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002831 }
2832}
David Tolnay8c81f622018-07-31 23:34:35 -07002833#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002834pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002835 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002836 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002837 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002838 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002839 }
2840}
David Tolnay8c81f622018-07-31 23:34:35 -07002841#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002842pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2843 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002844 ident: _visitor.fold_ident(_i.ident),
David Tolnay905ef2b2019-02-11 02:28:22 +01002845 as_token: Token![as](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002846 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002847 }
2848}
David Tolnay8c81f622018-07-31 23:34:35 -07002849#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002850pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002851 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002852 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2853 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2854 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2855 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2856 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002857 }
2858}
David Tolnay440fe582019-02-15 20:23:14 -08002859#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002860pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002861 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002862 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2863 ident: _visitor.fold_ident(_i.ident),
2864 fields: _visitor.fold_fields(_i.fields),
2865 discriminant: (_i.discriminant).map(|it| {
2866 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002867 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002868 _visitor.fold_expr((it).1),
2869 )
2870 }),
Nika Layzell27726662017-10-24 23:16:35 -04002871 }
2872}
David Tolnay440fe582019-02-15 20:23:14 -08002873#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002874pub fn fold_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002875 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002876 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002877 }
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_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002881 VisPublic {
David Tolnay905ef2b2019-02-11 02:28:22 +01002882 pub_token: Token![pub](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002883 }
2884}
David Tolnay440fe582019-02-15 20:23:14 -08002885#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002886pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002887 VisRestricted {
David Tolnay905ef2b2019-02-11 02:28:22 +01002888 pub_token: Token![pub](tokens_helper(_visitor, &_i.pub_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002889 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002890 in_token: (_i.in_token).map(|it| Token![in](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002891 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002892 }
2893}
David Tolnay440fe582019-02-15 20:23:14 -08002894#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002895pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002896 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002897 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2898 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2899 Visibility::Restricted(_binding_0) => {
2900 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002901 }
David Tolnay8c81f622018-07-31 23:34:35 -07002902 Visibility::Inherited => Visibility::Inherited,
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_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002907 WhereClause {
David Tolnay905ef2b2019-02-11 02:28:22 +01002908 where_token: Token![where](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002909 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002910 }
2911}
David Tolnay440fe582019-02-15 20:23:14 -08002912#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002913pub fn fold_where_predicate<V: Fold + ?Sized>(
2914 _visitor: &mut V,
2915 _i: WherePredicate,
2916) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002917 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002918 WherePredicate::Type(_binding_0) => {
2919 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002920 }
David Tolnay8c81f622018-07-31 23:34:35 -07002921 WherePredicate::Lifetime(_binding_0) => {
2922 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002923 }
David Tolnay8c81f622018-07-31 23:34:35 -07002924 WherePredicate::Eq(_binding_0) => {
2925 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002926 }
2927 }
2928}
Carl Lerchecbf7cc12019-02-15 14:09:31 -08002929pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
2930 _i
2931}
2932pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
2933 let mut _i = _i;
2934 let span = _visitor.fold_span(_i.span());
2935 _i.set_span(span);
2936 _i
2937}