blob: 7181fb87548da5e8c6df9967134cd50e528cad9f [file] [log] [blame]
David Tolnaycab909c2019-05-09 13:22:39 -07001// This file is @generated by syn-internal-codegen.
2// It is not intended for manual editing.
Nika Layzell27726662017-10-24 23:16:35 -04003
Nika Layzell27726662017-10-24 23:16:35 -04004#![allow(unreachable_code)]
David Tolnay0a0d78c2018-01-05 15:24:01 -08005#[cfg(any(feature = "full", feature = "derive"))]
David Tolnayf60f4262017-12-28 19:17:58 -05006use gen::helper::fold::*;
David Tolnay8c81f622018-07-31 23:34:35 -07007use proc_macro2::Span;
8#[cfg(any(feature = "full", feature = "derive"))]
9use token::{Brace, Bracket, Group, Paren};
10use *;
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040011#[cfg(feature = "full")]
12macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070013 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070014 $e
15 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040016}
David Tolnay0a0d78c2018-01-05 15:24:01 -080017#[cfg(all(feature = "derive", not(feature = "full")))]
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040018macro_rules! full {
David Tolnay280202f2018-08-02 00:29:54 -070019 ($e:expr) => {
David Tolnay8c81f622018-07-31 23:34:35 -070020 unreachable!()
21 };
Nika Layzell4ab8d6e2017-10-26 09:45:49 -040022}
David Tolnay53160352019-02-07 23:36:17 +010023/// Syntax tree traversal to transform the nodes of an owned syntax tree.
24///
25/// See the [module documentation] for details.
26///
27/// [module documentation]: index.html
28///
29/// *This trait is available if Syn is built with the `"fold"` feature.*
David Tolnay4b4c4b62018-01-06 13:48:05 -080030pub trait Fold {
David Tolnay440fe582019-02-15 20:23:14 -080031 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070032 fn fold_abi(&mut self, i: Abi) -> Abi {
33 fold_abi(self, i)
34 }
David Tolnay440fe582019-02-15 20:23:14 -080035 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070036 fn fold_angle_bracketed_generic_arguments(
37 &mut self,
38 i: AngleBracketedGenericArguments,
39 ) -> AngleBracketedGenericArguments {
40 fold_angle_bracketed_generic_arguments(self, i)
41 }
42 #[cfg(feature = "full")]
43 fn fold_arg_captured(&mut self, i: ArgCaptured) -> ArgCaptured {
44 fold_arg_captured(self, i)
45 }
46 #[cfg(feature = "full")]
47 fn fold_arg_self(&mut self, i: ArgSelf) -> ArgSelf {
48 fold_arg_self(self, i)
49 }
50 #[cfg(feature = "full")]
51 fn fold_arg_self_ref(&mut self, i: ArgSelfRef) -> ArgSelfRef {
52 fold_arg_self_ref(self, i)
53 }
David Tolnay8c81f622018-07-31 23:34:35 -070054 #[cfg(feature = "full")]
55 fn fold_arm(&mut self, i: Arm) -> Arm {
56 fold_arm(self, i)
57 }
David Tolnay440fe582019-02-15 20:23:14 -080058 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070059 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
60 fold_attr_style(self, i)
61 }
David Tolnay440fe582019-02-15 20:23:14 -080062 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070063 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
64 fold_attribute(self, i)
65 }
David Tolnay440fe582019-02-15 20:23:14 -080066 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070067 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
68 fold_bare_fn_arg(self, i)
69 }
David Tolnay440fe582019-02-15 20:23:14 -080070 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070071 fn fold_bare_fn_arg_name(&mut self, i: BareFnArgName) -> BareFnArgName {
72 fold_bare_fn_arg_name(self, i)
73 }
David Tolnay440fe582019-02-15 20:23:14 -080074 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070075 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
76 fold_bin_op(self, i)
77 }
David Tolnay440fe582019-02-15 20:23:14 -080078 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070079 fn fold_binding(&mut self, i: Binding) -> Binding {
80 fold_binding(self, i)
81 }
David Tolnay8c81f622018-07-31 23:34:35 -070082 #[cfg(feature = "full")]
83 fn fold_block(&mut self, i: Block) -> Block {
84 fold_block(self, i)
85 }
David Tolnay440fe582019-02-15 20:23:14 -080086 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070087 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
88 fold_bound_lifetimes(self, i)
89 }
David Tolnay440fe582019-02-15 20:23:14 -080090 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -070091 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
92 fold_const_param(self, i)
93 }
David Tolnay440fe582019-02-15 20:23:14 -080094 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay9d0882a2018-09-01 19:49:14 -070095 fn fold_constraint(&mut self, i: Constraint) -> Constraint {
96 fold_constraint(self, i)
97 }
David Tolnay8c81f622018-07-31 23:34:35 -070098 #[cfg(feature = "derive")]
99 fn fold_data(&mut self, i: Data) -> Data {
100 fold_data(self, i)
101 }
102 #[cfg(feature = "derive")]
103 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
104 fold_data_enum(self, i)
105 }
106 #[cfg(feature = "derive")]
107 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
108 fold_data_struct(self, i)
109 }
110 #[cfg(feature = "derive")]
111 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
112 fold_data_union(self, i)
113 }
114 #[cfg(feature = "derive")]
115 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
116 fold_derive_input(self, i)
117 }
David Tolnay440fe582019-02-15 20:23:14 -0800118 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700119 fn fold_expr(&mut self, i: Expr) -> Expr {
120 fold_expr(self, i)
121 }
122 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700123 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
124 fold_expr_array(self, i)
125 }
126 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700127 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
128 fold_expr_assign(self, i)
129 }
130 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700131 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
132 fold_expr_assign_op(self, i)
133 }
David Tolnay02a9c6f2018-08-24 18:58:45 -0400134 #[cfg(feature = "full")]
David Tolnay02a9c6f2018-08-24 18:58:45 -0400135 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
136 fold_expr_async(self, i)
137 }
David Tolnay440fe582019-02-15 20:23:14 -0800138 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700139 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
140 fold_expr_binary(self, i)
141 }
142 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700143 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
144 fold_expr_block(self, i)
145 }
146 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700147 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
148 fold_expr_box(self, i)
149 }
150 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700151 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
152 fold_expr_break(self, i)
153 }
David Tolnay440fe582019-02-15 20:23:14 -0800154 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700155 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
156 fold_expr_call(self, i)
157 }
David Tolnay440fe582019-02-15 20:23:14 -0800158 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700159 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
160 fold_expr_cast(self, i)
161 }
162 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700163 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
164 fold_expr_closure(self, i)
165 }
166 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700167 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
168 fold_expr_continue(self, i)
169 }
David Tolnay440fe582019-02-15 20:23:14 -0800170 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700171 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
172 fold_expr_field(self, i)
173 }
174 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700175 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
176 fold_expr_for_loop(self, i)
177 }
178 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700179 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
180 fold_expr_group(self, i)
181 }
182 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700183 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
184 fold_expr_if(self, i)
185 }
186 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700187 fn fold_expr_in_place(&mut self, i: ExprInPlace) -> ExprInPlace {
188 fold_expr_in_place(self, i)
189 }
David Tolnay440fe582019-02-15 20:23:14 -0800190 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700191 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
192 fold_expr_index(self, i)
193 }
David Tolnay9c119122018-09-01 18:47:02 -0700194 #[cfg(feature = "full")]
David Tolnay9c119122018-09-01 18:47:02 -0700195 fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet {
196 fold_expr_let(self, i)
197 }
David Tolnay440fe582019-02-15 20:23:14 -0800198 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700199 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
200 fold_expr_lit(self, i)
201 }
202 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700203 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
204 fold_expr_loop(self, i)
205 }
206 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700207 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
208 fold_expr_macro(self, i)
209 }
210 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700211 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
212 fold_expr_match(self, i)
213 }
214 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700215 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
216 fold_expr_method_call(self, i)
217 }
David Tolnay440fe582019-02-15 20:23:14 -0800218 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700219 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
220 fold_expr_paren(self, i)
221 }
David Tolnay440fe582019-02-15 20:23:14 -0800222 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700223 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
224 fold_expr_path(self, i)
225 }
226 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700227 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
228 fold_expr_range(self, i)
229 }
230 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700231 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
232 fold_expr_reference(self, i)
233 }
234 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700235 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
236 fold_expr_repeat(self, i)
237 }
238 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700239 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
240 fold_expr_return(self, i)
241 }
242 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700243 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
244 fold_expr_struct(self, i)
245 }
246 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700247 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
248 fold_expr_try(self, i)
249 }
250 #[cfg(feature = "full")]
David Tolnayfb2dd4b2018-08-24 16:45:34 -0400251 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
252 fold_expr_try_block(self, i)
253 }
254 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700255 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
256 fold_expr_tuple(self, i)
257 }
258 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700259 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
260 fold_expr_type(self, i)
261 }
David Tolnay440fe582019-02-15 20:23:14 -0800262 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700263 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
264 fold_expr_unary(self, i)
265 }
266 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700267 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
268 fold_expr_unsafe(self, i)
269 }
David Tolnay440fe582019-02-15 20:23:14 -0800270 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700271 fn fold_expr_verbatim(&mut self, i: ExprVerbatim) -> ExprVerbatim {
272 fold_expr_verbatim(self, i)
273 }
274 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700275 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
276 fold_expr_while(self, i)
277 }
278 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700279 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
280 fold_expr_yield(self, i)
281 }
David Tolnay440fe582019-02-15 20:23:14 -0800282 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700283 fn fold_field(&mut self, i: Field) -> Field {
284 fold_field(self, i)
285 }
David Tolnay8c81f622018-07-31 23:34:35 -0700286 #[cfg(feature = "full")]
287 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
288 fold_field_pat(self, i)
289 }
David Tolnay8c81f622018-07-31 23:34:35 -0700290 #[cfg(feature = "full")]
291 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
292 fold_field_value(self, i)
293 }
David Tolnay440fe582019-02-15 20:23:14 -0800294 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700295 fn fold_fields(&mut self, i: Fields) -> Fields {
296 fold_fields(self, i)
297 }
David Tolnay440fe582019-02-15 20:23:14 -0800298 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700299 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
300 fold_fields_named(self, i)
301 }
David Tolnay440fe582019-02-15 20:23:14 -0800302 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700303 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
304 fold_fields_unnamed(self, i)
305 }
306 #[cfg(feature = "full")]
307 fn fold_file(&mut self, i: File) -> File {
308 fold_file(self, i)
309 }
310 #[cfg(feature = "full")]
311 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
312 fold_fn_arg(self, i)
313 }
314 #[cfg(feature = "full")]
315 fn fold_fn_decl(&mut self, i: FnDecl) -> FnDecl {
316 fold_fn_decl(self, i)
317 }
318 #[cfg(feature = "full")]
319 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
320 fold_foreign_item(self, i)
321 }
322 #[cfg(feature = "full")]
323 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
324 fold_foreign_item_fn(self, i)
325 }
326 #[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -0400327 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
328 fold_foreign_item_macro(self, i)
329 }
330 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700331 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
332 fold_foreign_item_static(self, i)
333 }
334 #[cfg(feature = "full")]
335 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
336 fold_foreign_item_type(self, i)
337 }
338 #[cfg(feature = "full")]
339 fn fold_foreign_item_verbatim(&mut self, i: ForeignItemVerbatim) -> ForeignItemVerbatim {
340 fold_foreign_item_verbatim(self, i)
341 }
David Tolnay440fe582019-02-15 20:23:14 -0800342 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700343 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
344 fold_generic_argument(self, i)
345 }
David Tolnay8c81f622018-07-31 23:34:35 -0700346 #[cfg(feature = "full")]
347 fn fold_generic_method_argument(&mut self, i: GenericMethodArgument) -> GenericMethodArgument {
348 fold_generic_method_argument(self, i)
349 }
David Tolnay440fe582019-02-15 20:23:14 -0800350 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700351 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
352 fold_generic_param(self, i)
353 }
David Tolnay440fe582019-02-15 20:23:14 -0800354 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700355 fn fold_generics(&mut self, i: Generics) -> Generics {
356 fold_generics(self, i)
357 }
David Tolnay8c81f622018-07-31 23:34:35 -0700358 #[cfg(feature = "full")]
359 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
360 fold_impl_item(self, i)
361 }
362 #[cfg(feature = "full")]
363 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
364 fold_impl_item_const(self, i)
365 }
366 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400367 fn fold_impl_item_existential(&mut self, i: ImplItemExistential) -> ImplItemExistential {
368 fold_impl_item_existential(self, i)
369 }
370 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700371 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
372 fold_impl_item_macro(self, i)
373 }
374 #[cfg(feature = "full")]
375 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
376 fold_impl_item_method(self, i)
377 }
378 #[cfg(feature = "full")]
379 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
380 fold_impl_item_type(self, i)
381 }
382 #[cfg(feature = "full")]
383 fn fold_impl_item_verbatim(&mut self, i: ImplItemVerbatim) -> ImplItemVerbatim {
384 fold_impl_item_verbatim(self, i)
385 }
David Tolnay440fe582019-02-15 20:23:14 -0800386 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700387 fn fold_index(&mut self, i: Index) -> Index {
388 fold_index(self, i)
389 }
390 #[cfg(feature = "full")]
391 fn fold_item(&mut self, i: Item) -> Item {
392 fold_item(self, i)
393 }
394 #[cfg(feature = "full")]
395 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
396 fold_item_const(self, i)
397 }
398 #[cfg(feature = "full")]
399 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
400 fold_item_enum(self, i)
401 }
402 #[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -0400403 fn fold_item_existential(&mut self, i: ItemExistential) -> ItemExistential {
404 fold_item_existential(self, i)
405 }
406 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700407 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
408 fold_item_extern_crate(self, i)
409 }
410 #[cfg(feature = "full")]
411 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
412 fold_item_fn(self, i)
413 }
414 #[cfg(feature = "full")]
415 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
416 fold_item_foreign_mod(self, i)
417 }
418 #[cfg(feature = "full")]
419 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
420 fold_item_impl(self, i)
421 }
422 #[cfg(feature = "full")]
423 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
424 fold_item_macro(self, i)
425 }
426 #[cfg(feature = "full")]
427 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
428 fold_item_macro2(self, i)
429 }
430 #[cfg(feature = "full")]
431 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
432 fold_item_mod(self, i)
433 }
434 #[cfg(feature = "full")]
435 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
436 fold_item_static(self, i)
437 }
438 #[cfg(feature = "full")]
439 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
440 fold_item_struct(self, i)
441 }
442 #[cfg(feature = "full")]
443 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
444 fold_item_trait(self, i)
445 }
446 #[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -0700447 fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias {
448 fold_item_trait_alias(self, i)
449 }
450 #[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -0700451 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
452 fold_item_type(self, i)
453 }
454 #[cfg(feature = "full")]
455 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
456 fold_item_union(self, i)
457 }
458 #[cfg(feature = "full")]
459 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
460 fold_item_use(self, i)
461 }
462 #[cfg(feature = "full")]
463 fn fold_item_verbatim(&mut self, i: ItemVerbatim) -> ItemVerbatim {
464 fold_item_verbatim(self, i)
465 }
David Tolnay8c81f622018-07-31 23:34:35 -0700466 #[cfg(feature = "full")]
467 fn fold_label(&mut self, i: Label) -> Label {
468 fold_label(self, i)
469 }
David Tolnay8c81f622018-07-31 23:34:35 -0700470 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
471 fold_lifetime(self, i)
472 }
David Tolnay440fe582019-02-15 20:23:14 -0800473 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700474 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
475 fold_lifetime_def(self, i)
476 }
David Tolnay440fe582019-02-15 20:23:14 -0800477 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700478 fn fold_lit(&mut self, i: Lit) -> Lit {
479 fold_lit(self, i)
480 }
David Tolnay440fe582019-02-15 20:23:14 -0800481 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700482 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
483 fold_lit_bool(self, i)
484 }
David Tolnay440fe582019-02-15 20:23:14 -0800485 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700486 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
487 fold_lit_byte(self, i)
488 }
David Tolnay440fe582019-02-15 20:23:14 -0800489 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700490 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
491 fold_lit_byte_str(self, i)
492 }
David Tolnay440fe582019-02-15 20:23:14 -0800493 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700494 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
495 fold_lit_char(self, i)
496 }
David Tolnay440fe582019-02-15 20:23:14 -0800497 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700498 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
499 fold_lit_float(self, i)
500 }
David Tolnay440fe582019-02-15 20:23:14 -0800501 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700502 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
503 fold_lit_int(self, i)
504 }
David Tolnay440fe582019-02-15 20:23:14 -0800505 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700506 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
507 fold_lit_str(self, i)
508 }
David Tolnay440fe582019-02-15 20:23:14 -0800509 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700510 fn fold_lit_verbatim(&mut self, i: LitVerbatim) -> LitVerbatim {
511 fold_lit_verbatim(self, i)
512 }
David Tolnay8c81f622018-07-31 23:34:35 -0700513 #[cfg(feature = "full")]
514 fn fold_local(&mut self, i: Local) -> Local {
515 fold_local(self, i)
516 }
David Tolnay440fe582019-02-15 20:23:14 -0800517 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700518 fn fold_macro(&mut self, i: Macro) -> Macro {
519 fold_macro(self, i)
520 }
David Tolnay440fe582019-02-15 20:23:14 -0800521 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700522 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
523 fold_macro_delimiter(self, i)
524 }
David Tolnay440fe582019-02-15 20:23:14 -0800525 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700526 fn fold_member(&mut self, i: Member) -> Member {
527 fold_member(self, i)
528 }
David Tolnay440fe582019-02-15 20:23:14 -0800529 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700530 fn fold_meta(&mut self, i: Meta) -> Meta {
531 fold_meta(self, i)
532 }
David Tolnay440fe582019-02-15 20:23:14 -0800533 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700534 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
535 fold_meta_list(self, i)
536 }
David Tolnay440fe582019-02-15 20:23:14 -0800537 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700538 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
539 fold_meta_name_value(self, i)
540 }
541 #[cfg(feature = "full")]
542 fn fold_method_sig(&mut self, i: MethodSig) -> MethodSig {
543 fold_method_sig(self, i)
544 }
David Tolnay8c81f622018-07-31 23:34:35 -0700545 #[cfg(feature = "full")]
546 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
547 fold_method_turbofish(self, i)
548 }
David Tolnay440fe582019-02-15 20:23:14 -0800549 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700550 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
551 fold_nested_meta(self, i)
552 }
David Tolnay440fe582019-02-15 20:23:14 -0800553 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700554 fn fold_parenthesized_generic_arguments(
555 &mut self,
556 i: ParenthesizedGenericArguments,
557 ) -> ParenthesizedGenericArguments {
558 fold_parenthesized_generic_arguments(self, i)
559 }
David Tolnay8c81f622018-07-31 23:34:35 -0700560 #[cfg(feature = "full")]
561 fn fold_pat(&mut self, i: Pat) -> Pat {
562 fold_pat(self, i)
563 }
David Tolnay8c81f622018-07-31 23:34:35 -0700564 #[cfg(feature = "full")]
565 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
566 fold_pat_box(self, i)
567 }
David Tolnay8c81f622018-07-31 23:34:35 -0700568 #[cfg(feature = "full")]
569 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
570 fold_pat_ident(self, i)
571 }
David Tolnay8c81f622018-07-31 23:34:35 -0700572 #[cfg(feature = "full")]
573 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
574 fold_pat_lit(self, i)
575 }
David Tolnay8c81f622018-07-31 23:34:35 -0700576 #[cfg(feature = "full")]
577 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
578 fold_pat_macro(self, i)
579 }
David Tolnay8c81f622018-07-31 23:34:35 -0700580 #[cfg(feature = "full")]
581 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
582 fold_pat_path(self, i)
583 }
David Tolnay8c81f622018-07-31 23:34:35 -0700584 #[cfg(feature = "full")]
585 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
586 fold_pat_range(self, i)
587 }
David Tolnay8c81f622018-07-31 23:34:35 -0700588 #[cfg(feature = "full")]
589 fn fold_pat_ref(&mut self, i: PatRef) -> PatRef {
590 fold_pat_ref(self, i)
591 }
David Tolnay8c81f622018-07-31 23:34:35 -0700592 #[cfg(feature = "full")]
593 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
594 fold_pat_slice(self, i)
595 }
David Tolnay8c81f622018-07-31 23:34:35 -0700596 #[cfg(feature = "full")]
597 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
598 fold_pat_struct(self, i)
599 }
David Tolnay8c81f622018-07-31 23:34:35 -0700600 #[cfg(feature = "full")]
601 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
602 fold_pat_tuple(self, i)
603 }
David Tolnay8c81f622018-07-31 23:34:35 -0700604 #[cfg(feature = "full")]
605 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
606 fold_pat_tuple_struct(self, i)
607 }
David Tolnay8c81f622018-07-31 23:34:35 -0700608 #[cfg(feature = "full")]
609 fn fold_pat_verbatim(&mut self, i: PatVerbatim) -> PatVerbatim {
610 fold_pat_verbatim(self, i)
611 }
David Tolnay8c81f622018-07-31 23:34:35 -0700612 #[cfg(feature = "full")]
613 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
614 fold_pat_wild(self, i)
615 }
David Tolnay440fe582019-02-15 20:23:14 -0800616 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700617 fn fold_path(&mut self, i: Path) -> Path {
618 fold_path(self, i)
619 }
David Tolnay440fe582019-02-15 20:23:14 -0800620 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700621 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
622 fold_path_arguments(self, i)
623 }
David Tolnay440fe582019-02-15 20:23:14 -0800624 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700625 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
626 fold_path_segment(self, i)
627 }
David Tolnay440fe582019-02-15 20:23:14 -0800628 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700629 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
630 fold_predicate_eq(self, i)
631 }
David Tolnay440fe582019-02-15 20:23:14 -0800632 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700633 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
634 fold_predicate_lifetime(self, i)
635 }
David Tolnay440fe582019-02-15 20:23:14 -0800636 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700637 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
638 fold_predicate_type(self, i)
639 }
David Tolnay440fe582019-02-15 20:23:14 -0800640 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700641 fn fold_qself(&mut self, i: QSelf) -> QSelf {
642 fold_qself(self, i)
643 }
David Tolnay8c81f622018-07-31 23:34:35 -0700644 #[cfg(feature = "full")]
645 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
646 fold_range_limits(self, i)
647 }
David Tolnay440fe582019-02-15 20:23:14 -0800648 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700649 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
650 fold_return_type(self, i)
651 }
David Tolnay8c81f622018-07-31 23:34:35 -0700652 #[cfg(feature = "full")]
653 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
654 fold_stmt(self, i)
655 }
David Tolnay440fe582019-02-15 20:23:14 -0800656 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700657 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
658 fold_trait_bound(self, i)
659 }
David Tolnay440fe582019-02-15 20:23:14 -0800660 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700661 fn fold_trait_bound_modifier(&mut self, i: TraitBoundModifier) -> TraitBoundModifier {
662 fold_trait_bound_modifier(self, i)
663 }
664 #[cfg(feature = "full")]
665 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
666 fold_trait_item(self, i)
667 }
668 #[cfg(feature = "full")]
669 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
670 fold_trait_item_const(self, i)
671 }
672 #[cfg(feature = "full")]
673 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
674 fold_trait_item_macro(self, i)
675 }
676 #[cfg(feature = "full")]
677 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
678 fold_trait_item_method(self, i)
679 }
680 #[cfg(feature = "full")]
681 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
682 fold_trait_item_type(self, i)
683 }
684 #[cfg(feature = "full")]
685 fn fold_trait_item_verbatim(&mut self, i: TraitItemVerbatim) -> TraitItemVerbatim {
686 fold_trait_item_verbatim(self, i)
687 }
David Tolnay440fe582019-02-15 20:23:14 -0800688 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700689 fn fold_type(&mut self, i: Type) -> Type {
690 fold_type(self, i)
691 }
David Tolnay440fe582019-02-15 20:23:14 -0800692 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700693 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
694 fold_type_array(self, i)
695 }
David Tolnay440fe582019-02-15 20:23:14 -0800696 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700697 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
698 fold_type_bare_fn(self, i)
699 }
David Tolnay440fe582019-02-15 20:23:14 -0800700 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700701 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
702 fold_type_group(self, i)
703 }
David Tolnay440fe582019-02-15 20:23:14 -0800704 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700705 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
706 fold_type_impl_trait(self, i)
707 }
David Tolnay440fe582019-02-15 20:23:14 -0800708 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700709 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
710 fold_type_infer(self, i)
711 }
David Tolnay440fe582019-02-15 20:23:14 -0800712 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700713 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
714 fold_type_macro(self, i)
715 }
David Tolnay440fe582019-02-15 20:23:14 -0800716 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700717 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
718 fold_type_never(self, i)
719 }
David Tolnay440fe582019-02-15 20:23:14 -0800720 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700721 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
722 fold_type_param(self, i)
723 }
David Tolnay440fe582019-02-15 20:23:14 -0800724 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700725 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
726 fold_type_param_bound(self, i)
727 }
David Tolnay440fe582019-02-15 20:23:14 -0800728 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700729 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
730 fold_type_paren(self, i)
731 }
David Tolnay440fe582019-02-15 20:23:14 -0800732 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700733 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
734 fold_type_path(self, i)
735 }
David Tolnay440fe582019-02-15 20:23:14 -0800736 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700737 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
738 fold_type_ptr(self, i)
739 }
David Tolnay440fe582019-02-15 20:23:14 -0800740 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700741 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
742 fold_type_reference(self, i)
743 }
David Tolnay440fe582019-02-15 20:23:14 -0800744 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700745 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
746 fold_type_slice(self, i)
747 }
David Tolnay440fe582019-02-15 20:23:14 -0800748 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700749 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
750 fold_type_trait_object(self, i)
751 }
David Tolnay440fe582019-02-15 20:23:14 -0800752 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700753 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
754 fold_type_tuple(self, i)
755 }
David Tolnay440fe582019-02-15 20:23:14 -0800756 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700757 fn fold_type_verbatim(&mut self, i: TypeVerbatim) -> TypeVerbatim {
758 fold_type_verbatim(self, i)
759 }
David Tolnay440fe582019-02-15 20:23:14 -0800760 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700761 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
762 fold_un_op(self, i)
763 }
764 #[cfg(feature = "full")]
765 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
766 fold_use_glob(self, i)
767 }
768 #[cfg(feature = "full")]
769 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
770 fold_use_group(self, i)
771 }
772 #[cfg(feature = "full")]
773 fn fold_use_name(&mut self, i: UseName) -> UseName {
774 fold_use_name(self, i)
775 }
776 #[cfg(feature = "full")]
777 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
778 fold_use_path(self, i)
779 }
780 #[cfg(feature = "full")]
781 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
782 fold_use_rename(self, i)
783 }
784 #[cfg(feature = "full")]
785 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
786 fold_use_tree(self, i)
787 }
David Tolnay440fe582019-02-15 20:23:14 -0800788 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700789 fn fold_variant(&mut self, i: Variant) -> Variant {
790 fold_variant(self, i)
791 }
David Tolnay440fe582019-02-15 20:23:14 -0800792 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700793 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
794 fold_vis_crate(self, i)
795 }
David Tolnay440fe582019-02-15 20:23:14 -0800796 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700797 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
798 fold_vis_public(self, i)
799 }
David Tolnay440fe582019-02-15 20:23:14 -0800800 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700801 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
802 fold_vis_restricted(self, i)
803 }
David Tolnay440fe582019-02-15 20:23:14 -0800804 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700805 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
806 fold_visibility(self, i)
807 }
David Tolnay440fe582019-02-15 20:23:14 -0800808 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700809 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
810 fold_where_clause(self, i)
811 }
David Tolnay440fe582019-02-15 20:23:14 -0800812 #[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700813 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
814 fold_where_predicate(self, i)
815 }
Carl Lerchecbf7cc12019-02-15 14:09:31 -0800816 fn fold_span(&mut self, i: Span) -> Span {
817 fold_span(self, i)
818 }
819 fn fold_ident(&mut self, i: Ident) -> Ident {
820 fold_ident(self, i)
821 }
Nika Layzell27726662017-10-24 23:16:35 -0400822}
David Tolnay440fe582019-02-15 20:23:14 -0800823#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800824pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
Nika Layzell27726662017-10-24 23:16:35 -0400825 Abi {
David Tolnay7ac699c2018-08-24 14:00:58 -0400826 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700827 name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
Nika Layzell27726662017-10-24 23:16:35 -0400828 }
829}
David Tolnay440fe582019-02-15 20:23:14 -0800830#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700831pub fn fold_angle_bracketed_generic_arguments<V: Fold + ?Sized>(
832 _visitor: &mut V,
833 _i: AngleBracketedGenericArguments,
834) -> AngleBracketedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -0500835 AngleBracketedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -0400836 colon2_token: (_i.colon2_token)
837 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
838 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700839 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400840 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -0400841 }
842}
David Tolnay8c81f622018-07-31 23:34:35 -0700843#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800844pub fn fold_arg_captured<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgCaptured) -> ArgCaptured {
Nika Layzell27726662017-10-24 23:16:35 -0400845 ArgCaptured {
David Tolnay8c81f622018-07-31 23:34:35 -0700846 pat: _visitor.fold_pat(_i.pat),
David Tolnay7ac699c2018-08-24 14:00:58 -0400847 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700848 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400849 }
850}
David Tolnay8c81f622018-07-31 23:34:35 -0700851#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800852pub fn fold_arg_self<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelf) -> ArgSelf {
Nika Layzell27726662017-10-24 23:16:35 -0400853 ArgSelf {
David Tolnay905ef2b2019-02-11 02:28:22 +0100854 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -0400855 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400856 }
857}
David Tolnay8c81f622018-07-31 23:34:35 -0700858#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800859pub fn fold_arg_self_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: ArgSelfRef) -> ArgSelfRef {
Nika Layzell27726662017-10-24 23:16:35 -0400860 ArgSelfRef {
David Tolnay7ac699c2018-08-24 14:00:58 -0400861 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700862 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +0100863 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -0400864 self_token: Token![self](tokens_helper(_visitor, &_i.self_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -0400865 }
866}
David Tolnay8c81f622018-07-31 23:34:35 -0700867#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800868pub fn fold_arm<V: Fold + ?Sized>(_visitor: &mut V, _i: Arm) -> Arm {
Nika Layzell27726662017-10-24 23:16:35 -0400869 Arm {
David Tolnay8c81f622018-07-31 23:34:35 -0700870 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400871 leading_vert: (_i.leading_vert).map(|it| Token ! [ | ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -0700872 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
873 guard: (_i.guard).map(|it| {
874 (
David Tolnay905ef2b2019-02-11 02:28:22 +0100875 Token![if](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700876 Box::new(_visitor.fold_expr(*(it).1)),
877 )
878 }),
David Tolnay7ac699c2018-08-24 14:00:58 -0400879 fat_arrow_token: Token ! [ => ](tokens_helper(_visitor, &_i.fat_arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700880 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay7ac699c2018-08-24 14:00:58 -0400881 comma: (_i.comma).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -0400882 }
883}
David Tolnay440fe582019-02-15 20:23:14 -0800884#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800885pub fn fold_attr_style<V: Fold + ?Sized>(_visitor: &mut V, _i: AttrStyle) -> AttrStyle {
Nika Layzell27726662017-10-24 23:16:35 -0400886 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700887 AttrStyle::Outer => AttrStyle::Outer,
888 AttrStyle::Inner(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400889 AttrStyle::Inner(Token![!](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400890 }
891 }
892}
David Tolnay440fe582019-02-15 20:23:14 -0800893#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800894pub fn fold_attribute<V: Fold + ?Sized>(_visitor: &mut V, _i: Attribute) -> Attribute {
Nika Layzell27726662017-10-24 23:16:35 -0400895 Attribute {
David Tolnay7ac699c2018-08-24 14:00:58 -0400896 pound_token: Token ! [ # ](tokens_helper(_visitor, &_i.pound_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700897 style: _visitor.fold_attr_style(_i.style),
David Tolnay7ac699c2018-08-24 14:00:58 -0400898 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -0700899 path: _visitor.fold_path(_i.path),
900 tts: _i.tts,
Nika Layzell27726662017-10-24 23:16:35 -0400901 }
902}
David Tolnay440fe582019-02-15 20:23:14 -0800903#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800904pub fn fold_bare_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: BareFnArg) -> BareFnArg {
Nika Layzell27726662017-10-24 23:16:35 -0400905 BareFnArg {
David Tolnay8c81f622018-07-31 23:34:35 -0700906 name: (_i.name).map(|it| {
907 (
908 _visitor.fold_bare_fn_arg_name((it).0),
David Tolnay7ac699c2018-08-24 14:00:58 -0400909 Token ! [ : ](tokens_helper(_visitor, &(it).1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -0700910 )
911 }),
912 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -0400913 }
914}
David Tolnay440fe582019-02-15 20:23:14 -0800915#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -0700916pub fn fold_bare_fn_arg_name<V: Fold + ?Sized>(
917 _visitor: &mut V,
918 _i: BareFnArgName,
919) -> BareFnArgName {
Nika Layzell27726662017-10-24 23:16:35 -0400920 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700921 BareFnArgName::Named(_binding_0) => BareFnArgName::Named(_visitor.fold_ident(_binding_0)),
922 BareFnArgName::Wild(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400923 BareFnArgName::Wild(Token![_](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400924 }
925 }
926}
David Tolnay440fe582019-02-15 20:23:14 -0800927#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -0800928pub fn fold_bin_op<V: Fold + ?Sized>(_visitor: &mut V, _i: BinOp) -> BinOp {
Nika Layzell27726662017-10-24 23:16:35 -0400929 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -0700930 BinOp::Add(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400931 BinOp::Add(Token ! [ + ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400932 }
David Tolnay8c81f622018-07-31 23:34:35 -0700933 BinOp::Sub(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400934 BinOp::Sub(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400935 }
David Tolnay8c81f622018-07-31 23:34:35 -0700936 BinOp::Mul(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400937 BinOp::Mul(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400938 }
David Tolnay8c81f622018-07-31 23:34:35 -0700939 BinOp::Div(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400940 BinOp::Div(Token ! [ / ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400941 }
David Tolnay8c81f622018-07-31 23:34:35 -0700942 BinOp::Rem(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400943 BinOp::Rem(Token ! [ % ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400944 }
David Tolnay8c81f622018-07-31 23:34:35 -0700945 BinOp::And(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400946 BinOp::And(Token ! [ && ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400947 }
David Tolnay8c81f622018-07-31 23:34:35 -0700948 BinOp::Or(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400949 BinOp::Or(Token ! [ || ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400950 }
David Tolnay8c81f622018-07-31 23:34:35 -0700951 BinOp::BitXor(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400952 BinOp::BitXor(Token ! [ ^ ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400953 }
David Tolnay8c81f622018-07-31 23:34:35 -0700954 BinOp::BitAnd(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400955 BinOp::BitAnd(Token ! [ & ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400956 }
David Tolnay8c81f622018-07-31 23:34:35 -0700957 BinOp::BitOr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400958 BinOp::BitOr(Token ! [ | ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400959 }
David Tolnay8c81f622018-07-31 23:34:35 -0700960 BinOp::Shl(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400961 BinOp::Shl(Token ! [ << ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400962 }
David Tolnay8c81f622018-07-31 23:34:35 -0700963 BinOp::Shr(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400964 BinOp::Shr(Token ! [ >> ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400965 }
David Tolnay8c81f622018-07-31 23:34:35 -0700966 BinOp::Eq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400967 BinOp::Eq(Token ! [ == ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400968 }
David Tolnay7ac699c2018-08-24 14:00:58 -0400969 BinOp::Lt(_binding_0) => {
970 BinOp::Lt(Token ! [ < ](tokens_helper(_visitor, &_binding_0.spans)))
971 }
David Tolnay8c81f622018-07-31 23:34:35 -0700972 BinOp::Le(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400973 BinOp::Le(Token ! [ <= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400974 }
David Tolnay8c81f622018-07-31 23:34:35 -0700975 BinOp::Ne(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400976 BinOp::Ne(Token ! [ != ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400977 }
David Tolnay8c81f622018-07-31 23:34:35 -0700978 BinOp::Ge(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400979 BinOp::Ge(Token ! [ >= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400980 }
David Tolnay7ac699c2018-08-24 14:00:58 -0400981 BinOp::Gt(_binding_0) => {
982 BinOp::Gt(Token ! [ > ](tokens_helper(_visitor, &_binding_0.spans)))
983 }
David Tolnay8c81f622018-07-31 23:34:35 -0700984 BinOp::AddEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400985 BinOp::AddEq(Token ! [ += ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400986 }
David Tolnay8c81f622018-07-31 23:34:35 -0700987 BinOp::SubEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400988 BinOp::SubEq(Token ! [ -= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400989 }
David Tolnay8c81f622018-07-31 23:34:35 -0700990 BinOp::MulEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400991 BinOp::MulEq(Token ! [ *= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400992 }
David Tolnay8c81f622018-07-31 23:34:35 -0700993 BinOp::DivEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400994 BinOp::DivEq(Token ! [ /= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400995 }
David Tolnay8c81f622018-07-31 23:34:35 -0700996 BinOp::RemEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -0400997 BinOp::RemEq(Token ! [ %= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -0400998 }
David Tolnay8c81f622018-07-31 23:34:35 -0700999 BinOp::BitXorEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001000 BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001001 }
David Tolnay8c81f622018-07-31 23:34:35 -07001002 BinOp::BitAndEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001003 BinOp::BitAndEq(Token ! [ &= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001004 }
David Tolnay8c81f622018-07-31 23:34:35 -07001005 BinOp::BitOrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001006 BinOp::BitOrEq(Token ! [ |= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001007 }
David Tolnay8c81f622018-07-31 23:34:35 -07001008 BinOp::ShlEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001009 BinOp::ShlEq(Token ! [ <<= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001010 }
David Tolnay8c81f622018-07-31 23:34:35 -07001011 BinOp::ShrEq(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04001012 BinOp::ShrEq(Token ! [ >>= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04001013 }
1014 }
1015}
David Tolnay440fe582019-02-15 20:23:14 -08001016#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001017pub fn fold_binding<V: Fold + ?Sized>(_visitor: &mut V, _i: Binding) -> Binding {
David Tolnay506e43a2017-12-29 11:34:36 -05001018 Binding {
David Tolnay8c81f622018-07-31 23:34:35 -07001019 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001020 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001021 ty: _visitor.fold_type(_i.ty),
David Tolnay506e43a2017-12-29 11:34:36 -05001022 }
1023}
David Tolnay8c81f622018-07-31 23:34:35 -07001024#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001025pub fn fold_block<V: Fold + ?Sized>(_visitor: &mut V, _i: Block) -> Block {
Nika Layzell27726662017-10-24 23:16:35 -04001026 Block {
David Tolnay7ac699c2018-08-24 14:00:58 -04001027 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001028 stmts: FoldHelper::lift(_i.stmts, |it| _visitor.fold_stmt(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001029 }
1030}
David Tolnay440fe582019-02-15 20:23:14 -08001031#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07001032pub fn fold_bound_lifetimes<V: Fold + ?Sized>(
1033 _visitor: &mut V,
1034 _i: BoundLifetimes,
1035) -> BoundLifetimes {
Nika Layzell27726662017-10-24 23:16:35 -04001036 BoundLifetimes {
David Tolnay905ef2b2019-02-11 02:28:22 +01001037 for_token: Token![for](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001038 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001039 lifetimes: FoldHelper::lift(_i.lifetimes, |it| _visitor.fold_lifetime_def(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001040 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001041 }
1042}
David Tolnay440fe582019-02-15 20:23:14 -08001043#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001044pub fn fold_const_param<V: Fold + ?Sized>(_visitor: &mut V, _i: ConstParam) -> ConstParam {
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001045 ConstParam {
David Tolnay8c81f622018-07-31 23:34:35 -07001046 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001047 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001048 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001049 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001050 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001051 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001052 default: (_i.default).map(|it| _visitor.fold_expr(it)),
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001053 }
1054}
David Tolnay440fe582019-02-15 20:23:14 -08001055#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay9d0882a2018-09-01 19:49:14 -07001056pub fn fold_constraint<V: Fold + ?Sized>(_visitor: &mut V, _i: Constraint) -> Constraint {
1057 Constraint {
1058 ident: _visitor.fold_ident(_i.ident),
1059 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
1060 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1061 }
1062}
David Tolnay8c81f622018-07-31 23:34:35 -07001063#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001064pub fn fold_data<V: Fold + ?Sized>(_visitor: &mut V, _i: Data) -> Data {
David Tolnaye3d41b72017-12-31 15:24:00 -05001065 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001066 Data::Struct(_binding_0) => Data::Struct(_visitor.fold_data_struct(_binding_0)),
1067 Data::Enum(_binding_0) => Data::Enum(_visitor.fold_data_enum(_binding_0)),
1068 Data::Union(_binding_0) => Data::Union(_visitor.fold_data_union(_binding_0)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001069 }
1070}
David Tolnay8c81f622018-07-31 23:34:35 -07001071#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001072pub fn fold_data_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: DataEnum) -> DataEnum {
David Tolnaye3d41b72017-12-31 15:24:00 -05001073 DataEnum {
David Tolnay905ef2b2019-02-11 02:28:22 +01001074 enum_token: Token![enum](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001075 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001076 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001077 }
1078}
David Tolnay8c81f622018-07-31 23:34:35 -07001079#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001080pub fn fold_data_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: DataStruct) -> DataStruct {
David Tolnaye3d41b72017-12-31 15:24:00 -05001081 DataStruct {
David Tolnay905ef2b2019-02-11 02:28:22 +01001082 struct_token: Token![struct](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001083 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04001084 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnaye3d41b72017-12-31 15:24:00 -05001085 }
1086}
David Tolnay8c81f622018-07-31 23:34:35 -07001087#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001088pub fn fold_data_union<V: Fold + ?Sized>(_visitor: &mut V, _i: DataUnion) -> DataUnion {
David Tolnaye3d41b72017-12-31 15:24:00 -05001089 DataUnion {
David Tolnay7ac699c2018-08-24 14:00:58 -04001090 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001091 fields: _visitor.fold_fields_named(_i.fields),
David Tolnaye3d41b72017-12-31 15:24:00 -05001092 }
1093}
David Tolnay8c81f622018-07-31 23:34:35 -07001094#[cfg(feature = "derive")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001095pub fn fold_derive_input<V: Fold + ?Sized>(_visitor: &mut V, _i: DeriveInput) -> DeriveInput {
Nika Layzell27726662017-10-24 23:16:35 -04001096 DeriveInput {
David Tolnay8c81f622018-07-31 23:34:35 -07001097 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1098 vis: _visitor.fold_visibility(_i.vis),
1099 ident: _visitor.fold_ident(_i.ident),
1100 generics: _visitor.fold_generics(_i.generics),
1101 data: _visitor.fold_data(_i.data),
Nika Layzell27726662017-10-24 23:16:35 -04001102 }
1103}
David Tolnay440fe582019-02-15 20:23:14 -08001104#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001105pub fn fold_expr<V: Fold + ?Sized>(_visitor: &mut V, _i: Expr) -> Expr {
Nika Layzell27726662017-10-24 23:16:35 -04001106 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001107 Expr::Box(_binding_0) => Expr::Box(full!(_visitor.fold_expr_box(_binding_0))),
1108 Expr::InPlace(_binding_0) => Expr::InPlace(full!(_visitor.fold_expr_in_place(_binding_0))),
1109 Expr::Array(_binding_0) => Expr::Array(full!(_visitor.fold_expr_array(_binding_0))),
1110 Expr::Call(_binding_0) => Expr::Call(_visitor.fold_expr_call(_binding_0)),
1111 Expr::MethodCall(_binding_0) => {
1112 Expr::MethodCall(full!(_visitor.fold_expr_method_call(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001113 }
David Tolnay8c81f622018-07-31 23:34:35 -07001114 Expr::Tuple(_binding_0) => Expr::Tuple(full!(_visitor.fold_expr_tuple(_binding_0))),
1115 Expr::Binary(_binding_0) => Expr::Binary(_visitor.fold_expr_binary(_binding_0)),
1116 Expr::Unary(_binding_0) => Expr::Unary(_visitor.fold_expr_unary(_binding_0)),
1117 Expr::Lit(_binding_0) => Expr::Lit(_visitor.fold_expr_lit(_binding_0)),
1118 Expr::Cast(_binding_0) => Expr::Cast(_visitor.fold_expr_cast(_binding_0)),
1119 Expr::Type(_binding_0) => Expr::Type(full!(_visitor.fold_expr_type(_binding_0))),
David Tolnay9c119122018-09-01 18:47:02 -07001120 Expr::Let(_binding_0) => Expr::Let(full!(_visitor.fold_expr_let(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001121 Expr::If(_binding_0) => Expr::If(full!(_visitor.fold_expr_if(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001122 Expr::While(_binding_0) => Expr::While(full!(_visitor.fold_expr_while(_binding_0))),
David Tolnay8c81f622018-07-31 23:34:35 -07001123 Expr::ForLoop(_binding_0) => Expr::ForLoop(full!(_visitor.fold_expr_for_loop(_binding_0))),
1124 Expr::Loop(_binding_0) => Expr::Loop(full!(_visitor.fold_expr_loop(_binding_0))),
1125 Expr::Match(_binding_0) => Expr::Match(full!(_visitor.fold_expr_match(_binding_0))),
1126 Expr::Closure(_binding_0) => Expr::Closure(full!(_visitor.fold_expr_closure(_binding_0))),
1127 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(_visitor.fold_expr_unsafe(_binding_0))),
1128 Expr::Block(_binding_0) => Expr::Block(full!(_visitor.fold_expr_block(_binding_0))),
1129 Expr::Assign(_binding_0) => Expr::Assign(full!(_visitor.fold_expr_assign(_binding_0))),
1130 Expr::AssignOp(_binding_0) => {
1131 Expr::AssignOp(full!(_visitor.fold_expr_assign_op(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001132 }
David Tolnay8c81f622018-07-31 23:34:35 -07001133 Expr::Field(_binding_0) => Expr::Field(_visitor.fold_expr_field(_binding_0)),
1134 Expr::Index(_binding_0) => Expr::Index(_visitor.fold_expr_index(_binding_0)),
1135 Expr::Range(_binding_0) => Expr::Range(full!(_visitor.fold_expr_range(_binding_0))),
1136 Expr::Path(_binding_0) => Expr::Path(_visitor.fold_expr_path(_binding_0)),
1137 Expr::Reference(_binding_0) => {
1138 Expr::Reference(full!(_visitor.fold_expr_reference(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001139 }
David Tolnay8c81f622018-07-31 23:34:35 -07001140 Expr::Break(_binding_0) => Expr::Break(full!(_visitor.fold_expr_break(_binding_0))),
1141 Expr::Continue(_binding_0) => {
1142 Expr::Continue(full!(_visitor.fold_expr_continue(_binding_0)))
Nika Layzell27726662017-10-24 23:16:35 -04001143 }
David Tolnay8c81f622018-07-31 23:34:35 -07001144 Expr::Return(_binding_0) => Expr::Return(full!(_visitor.fold_expr_return(_binding_0))),
1145 Expr::Macro(_binding_0) => Expr::Macro(full!(_visitor.fold_expr_macro(_binding_0))),
1146 Expr::Struct(_binding_0) => Expr::Struct(full!(_visitor.fold_expr_struct(_binding_0))),
1147 Expr::Repeat(_binding_0) => Expr::Repeat(full!(_visitor.fold_expr_repeat(_binding_0))),
1148 Expr::Paren(_binding_0) => Expr::Paren(_visitor.fold_expr_paren(_binding_0)),
1149 Expr::Group(_binding_0) => Expr::Group(full!(_visitor.fold_expr_group(_binding_0))),
1150 Expr::Try(_binding_0) => Expr::Try(full!(_visitor.fold_expr_try(_binding_0))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001151 Expr::Async(_binding_0) => Expr::Async(full!(_visitor.fold_expr_async(_binding_0))),
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001152 Expr::TryBlock(_binding_0) => {
1153 Expr::TryBlock(full!(_visitor.fold_expr_try_block(_binding_0)))
1154 }
David Tolnay8c81f622018-07-31 23:34:35 -07001155 Expr::Yield(_binding_0) => Expr::Yield(full!(_visitor.fold_expr_yield(_binding_0))),
1156 Expr::Verbatim(_binding_0) => Expr::Verbatim(_visitor.fold_expr_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001157 }
1158}
David Tolnay8c81f622018-07-31 23:34:35 -07001159#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001160pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
David Tolnay8c91b882017-12-28 23:04:32 -05001161 ExprArray {
David Tolnay8c81f622018-07-31 23:34:35 -07001162 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001163 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001164 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001165 }
1166}
David Tolnay8c81f622018-07-31 23:34:35 -07001167#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001168pub fn fold_expr_assign<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssign) -> ExprAssign {
David Tolnay8c91b882017-12-28 23:04:32 -05001169 ExprAssign {
David Tolnay8c81f622018-07-31 23:34:35 -07001170 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1171 left: Box::new(_visitor.fold_expr(*_i.left)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001172 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001173 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001174 }
1175}
David Tolnay8c81f622018-07-31 23:34:35 -07001176#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001177pub fn fold_expr_assign_op<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAssignOp) -> ExprAssignOp {
David Tolnay8c91b882017-12-28 23:04:32 -05001178 ExprAssignOp {
David Tolnay8c81f622018-07-31 23:34:35 -07001179 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1180 left: Box::new(_visitor.fold_expr(*_i.left)),
1181 op: _visitor.fold_bin_op(_i.op),
1182 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001183 }
1184}
David Tolnay02a9c6f2018-08-24 18:58:45 -04001185#[cfg(feature = "full")]
David Tolnay02a9c6f2018-08-24 18:58:45 -04001186pub fn fold_expr_async<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAsync) -> ExprAsync {
1187 ExprAsync {
1188 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1189 async_token: Token![async](tokens_helper(_visitor, &_i.async_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001190 capture: (_i.capture).map(|it| Token![move](tokens_helper(_visitor, &it.span))),
David Tolnay02a9c6f2018-08-24 18:58:45 -04001191 block: _visitor.fold_block(_i.block),
1192 }
1193}
David Tolnay440fe582019-02-15 20:23:14 -08001194#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001195pub fn fold_expr_binary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBinary) -> ExprBinary {
David Tolnay8c91b882017-12-28 23:04:32 -05001196 ExprBinary {
David Tolnay8c81f622018-07-31 23:34:35 -07001197 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1198 left: Box::new(_visitor.fold_expr(*_i.left)),
1199 op: _visitor.fold_bin_op(_i.op),
1200 right: Box::new(_visitor.fold_expr(*_i.right)),
David Tolnay8c91b882017-12-28 23:04:32 -05001201 }
1202}
David Tolnay8c81f622018-07-31 23:34:35 -07001203#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001204pub fn fold_expr_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBlock) -> ExprBlock {
David Tolnay8c91b882017-12-28 23:04:32 -05001205 ExprBlock {
David Tolnay8c81f622018-07-31 23:34:35 -07001206 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay1d8e9962018-08-24 19:04:20 -04001207 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay8c81f622018-07-31 23:34:35 -07001208 block: _visitor.fold_block(_i.block),
David Tolnay8c91b882017-12-28 23:04:32 -05001209 }
1210}
David Tolnay8c81f622018-07-31 23:34:35 -07001211#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001212pub fn fold_expr_box<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBox) -> ExprBox {
David Tolnay8c91b882017-12-28 23:04:32 -05001213 ExprBox {
David Tolnay8c81f622018-07-31 23:34:35 -07001214 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001215 box_token: Token![box](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001216 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001217 }
1218}
David Tolnay8c81f622018-07-31 23:34:35 -07001219#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001220pub fn fold_expr_break<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprBreak) -> ExprBreak {
David Tolnay8c91b882017-12-28 23:04:32 -05001221 ExprBreak {
David Tolnay8c81f622018-07-31 23:34:35 -07001222 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001223 break_token: Token![break](tokens_helper(_visitor, &_i.break_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001224 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
1225 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
David Tolnay8c91b882017-12-28 23:04:32 -05001226 }
1227}
David Tolnay440fe582019-02-15 20:23:14 -08001228#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001229pub fn fold_expr_call<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCall) -> ExprCall {
David Tolnay8c91b882017-12-28 23:04:32 -05001230 ExprCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001231 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1232 func: Box::new(_visitor.fold_expr(*_i.func)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001233 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001234 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001235 }
1236}
David Tolnay440fe582019-02-15 20:23:14 -08001237#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001238pub fn fold_expr_cast<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprCast) -> ExprCast {
David Tolnay8c91b882017-12-28 23:04:32 -05001239 ExprCast {
David Tolnay8c81f622018-07-31 23:34:35 -07001240 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1241 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001242 as_token: Token![as](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001243 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay8c91b882017-12-28 23:04:32 -05001244 }
1245}
David Tolnay8c81f622018-07-31 23:34:35 -07001246#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001247pub fn fold_expr_closure<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprClosure) -> ExprClosure {
David Tolnay8c91b882017-12-28 23:04:32 -05001248 ExprClosure {
David Tolnay8c81f622018-07-31 23:34:35 -07001249 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +09001250 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001251 movability: (_i.movability).map(|it| Token![static](tokens_helper(_visitor, &it.span))),
1252 capture: (_i.capture).map(|it| Token![move](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04001253 or1_token: Token ! [ | ](tokens_helper(_visitor, &_i.or1_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001254 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001255 or2_token: Token ! [ | ](tokens_helper(_visitor, &_i.or2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001256 output: _visitor.fold_return_type(_i.output),
1257 body: Box::new(_visitor.fold_expr(*_i.body)),
David Tolnay8c91b882017-12-28 23:04:32 -05001258 }
1259}
David Tolnay8c81f622018-07-31 23:34:35 -07001260#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001261pub fn fold_expr_continue<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprContinue) -> ExprContinue {
David Tolnay8c91b882017-12-28 23:04:32 -05001262 ExprContinue {
David Tolnay8c81f622018-07-31 23:34:35 -07001263 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001264 continue_token: Token![continue](tokens_helper(_visitor, &_i.continue_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001265 label: (_i.label).map(|it| _visitor.fold_lifetime(it)),
David Tolnay8c91b882017-12-28 23:04:32 -05001266 }
1267}
David Tolnay440fe582019-02-15 20:23:14 -08001268#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001269pub fn fold_expr_field<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprField) -> ExprField {
David Tolnay8c91b882017-12-28 23:04:32 -05001270 ExprField {
David Tolnay8c81f622018-07-31 23:34:35 -07001271 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1272 base: Box::new(_visitor.fold_expr(*_i.base)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001273 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001274 member: _visitor.fold_member(_i.member),
David Tolnay8c91b882017-12-28 23:04:32 -05001275 }
1276}
David Tolnay8c81f622018-07-31 23:34:35 -07001277#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001278pub fn fold_expr_for_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprForLoop) -> ExprForLoop {
David Tolnay8c91b882017-12-28 23:04:32 -05001279 ExprForLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001280 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1281 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001282 for_token: Token![for](tokens_helper(_visitor, &_i.for_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001283 pat: Box::new(_visitor.fold_pat(*_i.pat)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001284 in_token: Token![in](tokens_helper(_visitor, &_i.in_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001285 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1286 body: _visitor.fold_block(_i.body),
David Tolnay8c91b882017-12-28 23:04:32 -05001287 }
1288}
David Tolnay8c81f622018-07-31 23:34:35 -07001289#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001290pub fn fold_expr_group<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprGroup) -> ExprGroup {
David Tolnay8c91b882017-12-28 23:04:32 -05001291 ExprGroup {
David Tolnay8c81f622018-07-31 23:34:35 -07001292 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001293 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001294 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay8c91b882017-12-28 23:04:32 -05001295 }
1296}
David Tolnay8c81f622018-07-31 23:34:35 -07001297#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001298pub fn fold_expr_if<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIf) -> ExprIf {
David Tolnay8c91b882017-12-28 23:04:32 -05001299 ExprIf {
David Tolnay8c81f622018-07-31 23:34:35 -07001300 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001301 if_token: Token![if](tokens_helper(_visitor, &_i.if_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001302 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1303 then_branch: _visitor.fold_block(_i.then_branch),
1304 else_branch: (_i.else_branch).map(|it| {
1305 (
David Tolnay905ef2b2019-02-11 02:28:22 +01001306 Token![else](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001307 Box::new(_visitor.fold_expr(*(it).1)),
1308 )
1309 }),
David Tolnay8c91b882017-12-28 23:04:32 -05001310 }
1311}
David Tolnay8c81f622018-07-31 23:34:35 -07001312#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001313pub fn fold_expr_in_place<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprInPlace) -> ExprInPlace {
David Tolnay8c91b882017-12-28 23:04:32 -05001314 ExprInPlace {
David Tolnay8c81f622018-07-31 23:34:35 -07001315 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1316 place: Box::new(_visitor.fold_expr(*_i.place)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001317 arrow_token: Token ! [ <- ](tokens_helper(_visitor, &_i.arrow_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001318 value: Box::new(_visitor.fold_expr(*_i.value)),
David Tolnay8c91b882017-12-28 23:04:32 -05001319 }
1320}
David Tolnay440fe582019-02-15 20:23:14 -08001321#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001322pub fn fold_expr_index<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprIndex) -> ExprIndex {
David Tolnay8c91b882017-12-28 23:04:32 -05001323 ExprIndex {
David Tolnay8c81f622018-07-31 23:34:35 -07001324 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1325 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001326 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001327 index: Box::new(_visitor.fold_expr(*_i.index)),
David Tolnay8c91b882017-12-28 23:04:32 -05001328 }
1329}
David Tolnay9c119122018-09-01 18:47:02 -07001330#[cfg(feature = "full")]
David Tolnay9c119122018-09-01 18:47:02 -07001331pub fn fold_expr_let<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLet) -> ExprLet {
1332 ExprLet {
1333 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001334 let_token: Token![let](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay9c119122018-09-01 18:47:02 -07001335 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
1336 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
1337 expr: Box::new(_visitor.fold_expr(*_i.expr)),
1338 }
1339}
David Tolnay440fe582019-02-15 20:23:14 -08001340#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001341pub fn fold_expr_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLit) -> ExprLit {
David Tolnay8c91b882017-12-28 23:04:32 -05001342 ExprLit {
David Tolnay8c81f622018-07-31 23:34:35 -07001343 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1344 lit: _visitor.fold_lit(_i.lit),
David Tolnay8c91b882017-12-28 23:04:32 -05001345 }
1346}
David Tolnay8c81f622018-07-31 23:34:35 -07001347#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001348pub fn fold_expr_loop<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprLoop) -> ExprLoop {
Nika Layzell27726662017-10-24 23:16:35 -04001349 ExprLoop {
David Tolnay8c81f622018-07-31 23:34:35 -07001350 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1351 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001352 loop_token: Token![loop](tokens_helper(_visitor, &_i.loop_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001353 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001354 }
1355}
David Tolnay8c81f622018-07-31 23:34:35 -07001356#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001357pub fn fold_expr_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMacro) -> ExprMacro {
David Tolnay8c91b882017-12-28 23:04:32 -05001358 ExprMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001359 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1360 mac: _visitor.fold_macro(_i.mac),
David Tolnay8c91b882017-12-28 23:04:32 -05001361 }
1362}
David Tolnay8c81f622018-07-31 23:34:35 -07001363#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001364pub fn fold_expr_match<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprMatch) -> ExprMatch {
Nika Layzell27726662017-10-24 23:16:35 -04001365 ExprMatch {
David Tolnay8c81f622018-07-31 23:34:35 -07001366 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001367 match_token: Token![match](tokens_helper(_visitor, &_i.match_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001368 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001369 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001370 arms: FoldHelper::lift(_i.arms, |it| _visitor.fold_arm(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001371 }
1372}
David Tolnay8c81f622018-07-31 23:34:35 -07001373#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001374pub fn fold_expr_method_call<V: Fold + ?Sized>(
1375 _visitor: &mut V,
1376 _i: ExprMethodCall,
1377) -> ExprMethodCall {
Nika Layzell27726662017-10-24 23:16:35 -04001378 ExprMethodCall {
David Tolnay8c81f622018-07-31 23:34:35 -07001379 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1380 receiver: Box::new(_visitor.fold_expr(*_i.receiver)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001381 dot_token: Token ! [ . ](tokens_helper(_visitor, &_i.dot_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001382 method: _visitor.fold_ident(_i.method),
1383 turbofish: (_i.turbofish).map(|it| _visitor.fold_method_turbofish(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001384 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001385 args: FoldHelper::lift(_i.args, |it| _visitor.fold_expr(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001386 }
1387}
David Tolnay440fe582019-02-15 20:23:14 -08001388#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001389pub fn fold_expr_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprParen) -> ExprParen {
Nika Layzell27726662017-10-24 23:16:35 -04001390 ExprParen {
David Tolnay8c81f622018-07-31 23:34:35 -07001391 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001392 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001393 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001394 }
1395}
David Tolnay440fe582019-02-15 20:23:14 -08001396#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001397pub fn fold_expr_path<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprPath) -> ExprPath {
Nika Layzell27726662017-10-24 23:16:35 -04001398 ExprPath {
David Tolnay8c81f622018-07-31 23:34:35 -07001399 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1400 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
1401 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04001402 }
1403}
David Tolnay8c81f622018-07-31 23:34:35 -07001404#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001405pub fn fold_expr_range<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRange) -> ExprRange {
Nika Layzell27726662017-10-24 23:16:35 -04001406 ExprRange {
David Tolnay8c81f622018-07-31 23:34:35 -07001407 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1408 from: (_i.from).map(|it| Box::new(_visitor.fold_expr(*it))),
1409 limits: _visitor.fold_range_limits(_i.limits),
1410 to: (_i.to).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001411 }
1412}
David Tolnay8c81f622018-07-31 23:34:35 -07001413#[cfg(feature = "full")]
David Tolnay00674ba2018-03-31 18:14:11 +02001414pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
1415 ExprReference {
David Tolnay8c81f622018-07-31 23:34:35 -07001416 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001417 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001418 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001419 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay00674ba2018-03-31 18:14:11 +02001420 }
1421}
David Tolnay8c81f622018-07-31 23:34:35 -07001422#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001423pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
Nika Layzell27726662017-10-24 23:16:35 -04001424 ExprRepeat {
David Tolnay8c81f622018-07-31 23:34:35 -07001425 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001426 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001427 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001428 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001429 len: Box::new(_visitor.fold_expr(*_i.len)),
Nika Layzell27726662017-10-24 23:16:35 -04001430 }
1431}
David Tolnay8c81f622018-07-31 23:34:35 -07001432#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001433pub fn fold_expr_return<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReturn) -> ExprReturn {
David Tolnayc246cd32017-12-28 23:14:32 -05001434 ExprReturn {
David Tolnay8c81f622018-07-31 23:34:35 -07001435 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001436 return_token: Token![return](tokens_helper(_visitor, &_i.return_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001437 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001438 }
1439}
David Tolnay8c81f622018-07-31 23:34:35 -07001440#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001441pub fn fold_expr_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprStruct) -> ExprStruct {
Nika Layzell27726662017-10-24 23:16:35 -04001442 ExprStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07001443 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1444 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04001445 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001446 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_value(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001447 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001448 rest: (_i.rest).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001449 }
1450}
David Tolnay8c81f622018-07-31 23:34:35 -07001451#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001452pub fn fold_expr_try<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTry) -> ExprTry {
Nika Layzell27726662017-10-24 23:16:35 -04001453 ExprTry {
David Tolnay8c81f622018-07-31 23:34:35 -07001454 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1455 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001456 question_token: Token ! [ ? ](tokens_helper(_visitor, &_i.question_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001457 }
1458}
David Tolnay8c81f622018-07-31 23:34:35 -07001459#[cfg(feature = "full")]
David Tolnayfb2dd4b2018-08-24 16:45:34 -04001460pub fn fold_expr_try_block<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTryBlock) -> ExprTryBlock {
1461 ExprTryBlock {
1462 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1463 try_token: Token![try](tokens_helper(_visitor, &_i.try_token.span)),
1464 block: _visitor.fold_block(_i.block),
1465 }
1466}
1467#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001468pub fn fold_expr_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprTuple) -> ExprTuple {
David Tolnay05362582017-12-26 01:33:57 -05001469 ExprTuple {
David Tolnay8c81f622018-07-31 23:34:35 -07001470 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001471 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001472 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_expr(it)),
David Tolnay05362582017-12-26 01:33:57 -05001473 }
1474}
David Tolnay8c81f622018-07-31 23:34:35 -07001475#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001476pub fn fold_expr_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprType) -> ExprType {
Nika Layzell27726662017-10-24 23:16:35 -04001477 ExprType {
David Tolnay8c81f622018-07-31 23:34:35 -07001478 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1479 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001480 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001481 ty: Box::new(_visitor.fold_type(*_i.ty)),
Nika Layzell27726662017-10-24 23:16:35 -04001482 }
1483}
David Tolnay440fe582019-02-15 20:23:14 -08001484#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001485pub fn fold_expr_unary<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnary) -> ExprUnary {
Nika Layzell27726662017-10-24 23:16:35 -04001486 ExprUnary {
David Tolnay8c81f622018-07-31 23:34:35 -07001487 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1488 op: _visitor.fold_un_op(_i.op),
1489 expr: Box::new(_visitor.fold_expr(*_i.expr)),
Nika Layzell27726662017-10-24 23:16:35 -04001490 }
1491}
David Tolnay8c81f622018-07-31 23:34:35 -07001492#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001493pub fn fold_expr_unsafe<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprUnsafe) -> ExprUnsafe {
Nika Layzell640832a2017-12-04 13:37:09 -05001494 ExprUnsafe {
David Tolnay8c81f622018-07-31 23:34:35 -07001495 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001496 unsafe_token: Token![unsafe](tokens_helper(_visitor, &_i.unsafe_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001497 block: _visitor.fold_block(_i.block),
Nika Layzell640832a2017-12-04 13:37:09 -05001498 }
1499}
David Tolnay440fe582019-02-15 20:23:14 -08001500#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001501pub fn fold_expr_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprVerbatim) -> ExprVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07001502 ExprVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001503}
David Tolnay8c81f622018-07-31 23:34:35 -07001504#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001505pub fn fold_expr_while<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprWhile) -> ExprWhile {
Nika Layzell27726662017-10-24 23:16:35 -04001506 ExprWhile {
David Tolnay8c81f622018-07-31 23:34:35 -07001507 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1508 label: (_i.label).map(|it| _visitor.fold_label(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001509 while_token: Token![while](tokens_helper(_visitor, &_i.while_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001510 cond: Box::new(_visitor.fold_expr(*_i.cond)),
1511 body: _visitor.fold_block(_i.body),
Nika Layzell27726662017-10-24 23:16:35 -04001512 }
1513}
David Tolnay8c81f622018-07-31 23:34:35 -07001514#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001515pub fn fold_expr_yield<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprYield) -> ExprYield {
Nika Layzell27726662017-10-24 23:16:35 -04001516 ExprYield {
David Tolnay8c81f622018-07-31 23:34:35 -07001517 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001518 yield_token: Token![yield](tokens_helper(_visitor, &_i.yield_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001519 expr: (_i.expr).map(|it| Box::new(_visitor.fold_expr(*it))),
Nika Layzell27726662017-10-24 23:16:35 -04001520 }
1521}
David Tolnay440fe582019-02-15 20:23:14 -08001522#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001523pub fn fold_field<V: Fold + ?Sized>(_visitor: &mut V, _i: Field) -> Field {
Nika Layzell27726662017-10-24 23:16:35 -04001524 Field {
David Tolnay8c81f622018-07-31 23:34:35 -07001525 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1526 vis: _visitor.fold_visibility(_i.vis),
1527 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001528 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001529 ty: _visitor.fold_type(_i.ty),
Nika Layzell27726662017-10-24 23:16:35 -04001530 }
1531}
David Tolnay8c81f622018-07-31 23:34:35 -07001532#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001533pub fn fold_field_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldPat) -> FieldPat {
Nika Layzell27726662017-10-24 23:16:35 -04001534 FieldPat {
David Tolnay8c81f622018-07-31 23:34:35 -07001535 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1536 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001537 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001538 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04001539 }
1540}
David Tolnay8c81f622018-07-31 23:34:35 -07001541#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001542pub fn fold_field_value<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldValue) -> FieldValue {
Nika Layzell27726662017-10-24 23:16:35 -04001543 FieldValue {
David Tolnay8c81f622018-07-31 23:34:35 -07001544 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1545 member: _visitor.fold_member(_i.member),
David Tolnay7ac699c2018-08-24 14:00:58 -04001546 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001547 expr: _visitor.fold_expr(_i.expr),
Nika Layzell27726662017-10-24 23:16:35 -04001548 }
1549}
David Tolnay440fe582019-02-15 20:23:14 -08001550#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001551pub fn fold_fields<V: Fold + ?Sized>(_visitor: &mut V, _i: Fields) -> Fields {
David Tolnaye3d41b72017-12-31 15:24:00 -05001552 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001553 Fields::Named(_binding_0) => Fields::Named(_visitor.fold_fields_named(_binding_0)),
1554 Fields::Unnamed(_binding_0) => Fields::Unnamed(_visitor.fold_fields_unnamed(_binding_0)),
1555 Fields::Unit => Fields::Unit,
David Tolnaye3d41b72017-12-31 15:24:00 -05001556 }
1557}
David Tolnay440fe582019-02-15 20:23:14 -08001558#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001559pub fn fold_fields_named<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsNamed) -> FieldsNamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001560 FieldsNamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001561 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001562 named: FoldHelper::lift(_i.named, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001563 }
1564}
David Tolnay440fe582019-02-15 20:23:14 -08001565#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001566pub fn fold_fields_unnamed<V: Fold + ?Sized>(_visitor: &mut V, _i: FieldsUnnamed) -> FieldsUnnamed {
David Tolnaye3d41b72017-12-31 15:24:00 -05001567 FieldsUnnamed {
David Tolnay7ac699c2018-08-24 14:00:58 -04001568 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001569 unnamed: FoldHelper::lift(_i.unnamed, |it| _visitor.fold_field(it)),
David Tolnaye3d41b72017-12-31 15:24:00 -05001570 }
1571}
David Tolnay8c81f622018-07-31 23:34:35 -07001572#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001573pub fn fold_file<V: Fold + ?Sized>(_visitor: &mut V, _i: File) -> File {
Nika Layzell27726662017-10-24 23:16:35 -04001574 File {
David Tolnay8c81f622018-07-31 23:34:35 -07001575 shebang: _i.shebang,
1576 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1577 items: FoldHelper::lift(_i.items, |it| _visitor.fold_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001578 }
1579}
David Tolnay8c81f622018-07-31 23:34:35 -07001580#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001581pub fn fold_fn_arg<V: Fold + ?Sized>(_visitor: &mut V, _i: FnArg) -> FnArg {
Nika Layzell27726662017-10-24 23:16:35 -04001582 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001583 FnArg::SelfRef(_binding_0) => FnArg::SelfRef(_visitor.fold_arg_self_ref(_binding_0)),
1584 FnArg::SelfValue(_binding_0) => FnArg::SelfValue(_visitor.fold_arg_self(_binding_0)),
1585 FnArg::Captured(_binding_0) => FnArg::Captured(_visitor.fold_arg_captured(_binding_0)),
1586 FnArg::Inferred(_binding_0) => FnArg::Inferred(_visitor.fold_pat(_binding_0)),
1587 FnArg::Ignored(_binding_0) => FnArg::Ignored(_visitor.fold_type(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001588 }
1589}
David Tolnay8c81f622018-07-31 23:34:35 -07001590#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001591pub fn fold_fn_decl<V: Fold + ?Sized>(_visitor: &mut V, _i: FnDecl) -> FnDecl {
Nika Layzell27726662017-10-24 23:16:35 -04001592 FnDecl {
David Tolnay905ef2b2019-02-11 02:28:22 +01001593 fn_token: Token![fn](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001594 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001595 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001596 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001597 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001598 output: _visitor.fold_return_type(_i.output),
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_foreign_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ForeignItem) -> ForeignItem {
Nika Layzell27726662017-10-24 23:16:35 -04001603 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001604 ForeignItem::Fn(_binding_0) => ForeignItem::Fn(_visitor.fold_foreign_item_fn(_binding_0)),
1605 ForeignItem::Static(_binding_0) => {
1606 ForeignItem::Static(_visitor.fold_foreign_item_static(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001607 }
David Tolnay8c81f622018-07-31 23:34:35 -07001608 ForeignItem::Type(_binding_0) => {
1609 ForeignItem::Type(_visitor.fold_foreign_item_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001610 }
David Tolnay435c1782018-08-24 16:15:44 -04001611 ForeignItem::Macro(_binding_0) => {
1612 ForeignItem::Macro(_visitor.fold_foreign_item_macro(_binding_0))
1613 }
David Tolnay8c81f622018-07-31 23:34:35 -07001614 ForeignItem::Verbatim(_binding_0) => {
1615 ForeignItem::Verbatim(_visitor.fold_foreign_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001616 }
Nika Layzell27726662017-10-24 23:16:35 -04001617 }
1618}
David Tolnay8c81f622018-07-31 23:34:35 -07001619#[cfg(feature = "full")]
1620pub fn fold_foreign_item_fn<V: Fold + ?Sized>(
1621 _visitor: &mut V,
1622 _i: ForeignItemFn,
1623) -> ForeignItemFn {
David Tolnay8894f602017-11-11 12:11:04 -08001624 ForeignItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001625 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1626 vis: _visitor.fold_visibility(_i.vis),
1627 ident: _visitor.fold_ident(_i.ident),
1628 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001629 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8894f602017-11-11 12:11:04 -08001630 }
1631}
David Tolnay8c81f622018-07-31 23:34:35 -07001632#[cfg(feature = "full")]
David Tolnay435c1782018-08-24 16:15:44 -04001633pub fn fold_foreign_item_macro<V: Fold + ?Sized>(
1634 _visitor: &mut V,
1635 _i: ForeignItemMacro,
1636) -> ForeignItemMacro {
1637 ForeignItemMacro {
1638 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1639 mac: _visitor.fold_macro(_i.mac),
1640 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
1641 }
1642}
1643#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001644pub fn fold_foreign_item_static<V: Fold + ?Sized>(
1645 _visitor: &mut V,
1646 _i: ForeignItemStatic,
1647) -> ForeignItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04001648 ForeignItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07001649 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1650 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001651 static_token: Token![static](tokens_helper(_visitor, &_i.static_token.span)),
1652 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001653 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001654 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001655 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001656 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001657 }
1658}
David Tolnay8c81f622018-07-31 23:34:35 -07001659#[cfg(feature = "full")]
1660pub fn fold_foreign_item_type<V: Fold + ?Sized>(
1661 _visitor: &mut V,
1662 _i: ForeignItemType,
1663) -> ForeignItemType {
David Tolnay199bcbb2017-11-12 10:33:52 -08001664 ForeignItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001665 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1666 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001667 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001668 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001669 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay199bcbb2017-11-12 10:33:52 -08001670 }
1671}
David Tolnay8c81f622018-07-31 23:34:35 -07001672#[cfg(feature = "full")]
1673pub fn fold_foreign_item_verbatim<V: Fold + ?Sized>(
1674 _visitor: &mut V,
1675 _i: ForeignItemVerbatim,
1676) -> ForeignItemVerbatim {
1677 ForeignItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001678}
David Tolnay440fe582019-02-15 20:23:14 -08001679#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07001680pub fn fold_generic_argument<V: Fold + ?Sized>(
1681 _visitor: &mut V,
1682 _i: GenericArgument,
1683) -> GenericArgument {
Nika Layzell357885a2017-12-04 15:47:07 -05001684 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001685 GenericArgument::Lifetime(_binding_0) => {
1686 GenericArgument::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001687 }
David Tolnay8c81f622018-07-31 23:34:35 -07001688 GenericArgument::Type(_binding_0) => GenericArgument::Type(_visitor.fold_type(_binding_0)),
1689 GenericArgument::Binding(_binding_0) => {
1690 GenericArgument::Binding(_visitor.fold_binding(_binding_0))
Nika Layzell357885a2017-12-04 15:47:07 -05001691 }
David Tolnay9d0882a2018-09-01 19:49:14 -07001692 GenericArgument::Constraint(_binding_0) => {
1693 GenericArgument::Constraint(_visitor.fold_constraint(_binding_0))
1694 }
David Tolnay8c81f622018-07-31 23:34:35 -07001695 GenericArgument::Const(_binding_0) => {
1696 GenericArgument::Const(_visitor.fold_expr(_binding_0))
Nika Layzellc680e612017-12-04 19:07:20 -05001697 }
Nika Layzell357885a2017-12-04 15:47:07 -05001698 }
1699}
David Tolnay8c81f622018-07-31 23:34:35 -07001700#[cfg(feature = "full")]
1701pub fn fold_generic_method_argument<V: Fold + ?Sized>(
1702 _visitor: &mut V,
1703 _i: GenericMethodArgument,
1704) -> GenericMethodArgument {
David Tolnayd60cfec2017-12-29 00:21:38 -05001705 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001706 GenericMethodArgument::Type(_binding_0) => {
1707 GenericMethodArgument::Type(_visitor.fold_type(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001708 }
David Tolnay8c81f622018-07-31 23:34:35 -07001709 GenericMethodArgument::Const(_binding_0) => {
1710 GenericMethodArgument::Const(_visitor.fold_expr(_binding_0))
David Tolnayd60cfec2017-12-29 00:21:38 -05001711 }
1712 }
1713}
David Tolnay440fe582019-02-15 20:23:14 -08001714#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001715pub fn fold_generic_param<V: Fold + ?Sized>(_visitor: &mut V, _i: GenericParam) -> GenericParam {
David Tolnayc2f1aba2017-11-12 20:29:22 -08001716 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001717 GenericParam::Type(_binding_0) => GenericParam::Type(_visitor.fold_type_param(_binding_0)),
1718 GenericParam::Lifetime(_binding_0) => {
1719 GenericParam::Lifetime(_visitor.fold_lifetime_def(_binding_0))
David Tolnayc2f1aba2017-11-12 20:29:22 -08001720 }
David Tolnay8c81f622018-07-31 23:34:35 -07001721 GenericParam::Const(_binding_0) => {
1722 GenericParam::Const(_visitor.fold_const_param(_binding_0))
Nika Layzellf1fdc0b2017-12-04 19:58:32 -05001723 }
David Tolnayc2f1aba2017-11-12 20:29:22 -08001724 }
1725}
David Tolnay440fe582019-02-15 20:23:14 -08001726#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001727pub fn fold_generics<V: Fold + ?Sized>(_visitor: &mut V, _i: Generics) -> Generics {
Nika Layzell27726662017-10-24 23:16:35 -04001728 Generics {
David Tolnay7ac699c2018-08-24 14:00:58 -04001729 lt_token: (_i.lt_token).map(|it| Token ! [ < ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001730 params: FoldHelper::lift(_i.params, |it| _visitor.fold_generic_param(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001731 gt_token: (_i.gt_token).map(|it| Token ! [ > ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001732 where_clause: (_i.where_clause).map(|it| _visitor.fold_where_clause(it)),
Nika Layzell27726662017-10-24 23:16:35 -04001733 }
1734}
David Tolnay8c81f622018-07-31 23:34:35 -07001735#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001736pub fn fold_impl_item<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItem) -> ImplItem {
Nika Layzell27726662017-10-24 23:16:35 -04001737 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001738 ImplItem::Const(_binding_0) => ImplItem::Const(_visitor.fold_impl_item_const(_binding_0)),
1739 ImplItem::Method(_binding_0) => {
1740 ImplItem::Method(_visitor.fold_impl_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001741 }
David Tolnay8c81f622018-07-31 23:34:35 -07001742 ImplItem::Type(_binding_0) => ImplItem::Type(_visitor.fold_impl_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001743 ImplItem::Existential(_binding_0) => {
1744 ImplItem::Existential(_visitor.fold_impl_item_existential(_binding_0))
1745 }
David Tolnay8c81f622018-07-31 23:34:35 -07001746 ImplItem::Macro(_binding_0) => ImplItem::Macro(_visitor.fold_impl_item_macro(_binding_0)),
1747 ImplItem::Verbatim(_binding_0) => {
1748 ImplItem::Verbatim(_visitor.fold_impl_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05001749 }
Nika Layzell27726662017-10-24 23:16:35 -04001750 }
1751}
David Tolnay8c81f622018-07-31 23:34:35 -07001752#[cfg(feature = "full")]
1753pub fn fold_impl_item_const<V: Fold + ?Sized>(
1754 _visitor: &mut V,
1755 _i: ImplItemConst,
1756) -> ImplItemConst {
David Tolnay857628c2017-11-11 12:25:31 -08001757 ImplItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001758 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1759 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001760 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001761 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001762 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001763 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001764 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001765 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001766 expr: _visitor.fold_expr(_i.expr),
David Tolnay7ac699c2018-08-24 14:00:58 -04001767 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay857628c2017-11-11 12:25:31 -08001768 }
1769}
David Tolnay8c81f622018-07-31 23:34:35 -07001770#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001771pub fn fold_impl_item_existential<V: Fold + ?Sized>(
1772 _visitor: &mut V,
1773 _i: ImplItemExistential,
1774) -> ImplItemExistential {
1775 ImplItemExistential {
1776 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1777 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001778 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001779 ident: _visitor.fold_ident(_i.ident),
1780 generics: _visitor.fold_generics(_i.generics),
1781 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1782 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1783 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1784 }
1785}
1786#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001787pub fn fold_impl_item_macro<V: Fold + ?Sized>(
1788 _visitor: &mut V,
1789 _i: ImplItemMacro,
1790) -> ImplItemMacro {
David Tolnay857628c2017-11-11 12:25:31 -08001791 ImplItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001792 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1793 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001794 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnay857628c2017-11-11 12:25:31 -08001795 }
1796}
David Tolnay8c81f622018-07-31 23:34:35 -07001797#[cfg(feature = "full")]
1798pub fn fold_impl_item_method<V: Fold + ?Sized>(
1799 _visitor: &mut V,
1800 _i: ImplItemMethod,
1801) -> ImplItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04001802 ImplItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07001803 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1804 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001805 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001806 sig: _visitor.fold_method_sig(_i.sig),
1807 block: _visitor.fold_block(_i.block),
Nika Layzell27726662017-10-24 23:16:35 -04001808 }
1809}
David Tolnay8c81f622018-07-31 23:34:35 -07001810#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001811pub fn fold_impl_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ImplItemType) -> ImplItemType {
Nika Layzell27726662017-10-24 23:16:35 -04001812 ImplItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07001813 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1814 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001815 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001816 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001817 ident: _visitor.fold_ident(_i.ident),
1818 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001819 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001820 ty: _visitor.fold_type(_i.ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04001821 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04001822 }
1823}
David Tolnay8c81f622018-07-31 23:34:35 -07001824#[cfg(feature = "full")]
1825pub fn fold_impl_item_verbatim<V: Fold + ?Sized>(
1826 _visitor: &mut V,
1827 _i: ImplItemVerbatim,
1828) -> ImplItemVerbatim {
1829 ImplItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05001830}
David Tolnay440fe582019-02-15 20:23:14 -08001831#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001832pub fn fold_index<V: Fold + ?Sized>(_visitor: &mut V, _i: Index) -> Index {
David Tolnay85b69a42017-12-27 20:43:10 -05001833 Index {
David Tolnay8c81f622018-07-31 23:34:35 -07001834 index: _i.index,
1835 span: _visitor.fold_span(_i.span),
David Tolnay85b69a42017-12-27 20:43:10 -05001836 }
1837}
David Tolnay8c81f622018-07-31 23:34:35 -07001838#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001839pub fn fold_item<V: Fold + ?Sized>(_visitor: &mut V, _i: Item) -> Item {
Nika Layzell27726662017-10-24 23:16:35 -04001840 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07001841 Item::ExternCrate(_binding_0) => {
1842 Item::ExternCrate(_visitor.fold_item_extern_crate(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001843 }
David Tolnay8c81f622018-07-31 23:34:35 -07001844 Item::Use(_binding_0) => Item::Use(_visitor.fold_item_use(_binding_0)),
1845 Item::Static(_binding_0) => Item::Static(_visitor.fold_item_static(_binding_0)),
1846 Item::Const(_binding_0) => Item::Const(_visitor.fold_item_const(_binding_0)),
1847 Item::Fn(_binding_0) => Item::Fn(_visitor.fold_item_fn(_binding_0)),
1848 Item::Mod(_binding_0) => Item::Mod(_visitor.fold_item_mod(_binding_0)),
1849 Item::ForeignMod(_binding_0) => {
1850 Item::ForeignMod(_visitor.fold_item_foreign_mod(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04001851 }
David Tolnay8c81f622018-07-31 23:34:35 -07001852 Item::Type(_binding_0) => Item::Type(_visitor.fold_item_type(_binding_0)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001853 Item::Existential(_binding_0) => {
1854 Item::Existential(_visitor.fold_item_existential(_binding_0))
1855 }
David Tolnay8c81f622018-07-31 23:34:35 -07001856 Item::Struct(_binding_0) => Item::Struct(_visitor.fold_item_struct(_binding_0)),
1857 Item::Enum(_binding_0) => Item::Enum(_visitor.fold_item_enum(_binding_0)),
1858 Item::Union(_binding_0) => Item::Union(_visitor.fold_item_union(_binding_0)),
1859 Item::Trait(_binding_0) => Item::Trait(_visitor.fold_item_trait(_binding_0)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07001860 Item::TraitAlias(_binding_0) => {
1861 Item::TraitAlias(_visitor.fold_item_trait_alias(_binding_0))
1862 }
David Tolnay8c81f622018-07-31 23:34:35 -07001863 Item::Impl(_binding_0) => Item::Impl(_visitor.fold_item_impl(_binding_0)),
1864 Item::Macro(_binding_0) => Item::Macro(_visitor.fold_item_macro(_binding_0)),
1865 Item::Macro2(_binding_0) => Item::Macro2(_visitor.fold_item_macro2(_binding_0)),
1866 Item::Verbatim(_binding_0) => Item::Verbatim(_visitor.fold_item_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04001867 }
1868}
David Tolnay8c81f622018-07-31 23:34:35 -07001869#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001870pub fn fold_item_const<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemConst) -> ItemConst {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001871 ItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07001872 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1873 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001874 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001875 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001876 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001877 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001878 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07001879 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001880 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001881 }
1882}
David Tolnay8c81f622018-07-31 23:34:35 -07001883#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001884pub fn fold_item_enum<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemEnum) -> ItemEnum {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001885 ItemEnum {
David Tolnay8c81f622018-07-31 23:34:35 -07001886 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1887 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001888 enum_token: Token![enum](tokens_helper(_visitor, &_i.enum_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001889 ident: _visitor.fold_ident(_i.ident),
1890 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04001891 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001892 variants: FoldHelper::lift(_i.variants, |it| _visitor.fold_variant(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001893 }
1894}
David Tolnay8c81f622018-07-31 23:34:35 -07001895#[cfg(feature = "full")]
David Tolnaybb82ef02018-08-24 20:15:45 -04001896pub fn fold_item_existential<V: Fold + ?Sized>(
1897 _visitor: &mut V,
1898 _i: ItemExistential,
1899) -> ItemExistential {
1900 ItemExistential {
1901 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1902 vis: _visitor.fold_visibility(_i.vis),
1903 existential_token: Token![existential](tokens_helper(_visitor, &_i.existential_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01001904 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnaybb82ef02018-08-24 20:15:45 -04001905 ident: _visitor.fold_ident(_i.ident),
1906 generics: _visitor.fold_generics(_i.generics),
1907 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
1908 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
1909 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
1910 }
1911}
1912#[cfg(feature = "full")]
David Tolnay8c81f622018-07-31 23:34:35 -07001913pub fn fold_item_extern_crate<V: Fold + ?Sized>(
1914 _visitor: &mut V,
1915 _i: ItemExternCrate,
1916) -> ItemExternCrate {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001917 ItemExternCrate {
David Tolnay8c81f622018-07-31 23:34:35 -07001918 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1919 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04001920 extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
1921 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001922 ident: _visitor.fold_ident(_i.ident),
1923 rename: (_i.rename).map(|it| {
1924 (
David Tolnay905ef2b2019-02-11 02:28:22 +01001925 Token![as](tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001926 _visitor.fold_ident((it).1),
1927 )
1928 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04001929 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001930 }
1931}
David Tolnay8c81f622018-07-31 23:34:35 -07001932#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001933pub fn fold_item_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemFn) -> ItemFn {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001934 ItemFn {
David Tolnay8c81f622018-07-31 23:34:35 -07001935 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1936 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001937 constness: (_i.constness).map(|it| Token![const](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09001938 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
Felix Rabe12cb78e2019-06-08 23:03:49 +02001939 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07001940 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
1941 ident: _visitor.fold_ident(_i.ident),
1942 decl: Box::new(_visitor.fold_fn_decl(*_i.decl)),
1943 block: Box::new(_visitor.fold_block(*_i.block)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001944 }
1945}
David Tolnay8c81f622018-07-31 23:34:35 -07001946#[cfg(feature = "full")]
1947pub fn fold_item_foreign_mod<V: Fold + ?Sized>(
1948 _visitor: &mut V,
1949 _i: ItemForeignMod,
1950) -> ItemForeignMod {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001951 ItemForeignMod {
David Tolnay8c81f622018-07-31 23:34:35 -07001952 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1953 abi: _visitor.fold_abi(_i.abi),
David Tolnay7ac699c2018-08-24 14:00:58 -04001954 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001955 items: FoldHelper::lift(_i.items, |it| _visitor.fold_foreign_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001956 }
1957}
David Tolnay8c81f622018-07-31 23:34:35 -07001958#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001959pub fn fold_item_impl<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemImpl) -> ItemImpl {
David Tolnayc6b55bc2017-11-09 22:48:38 -08001960 ItemImpl {
David Tolnay8c81f622018-07-31 23:34:35 -07001961 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001962 defaultness: (_i.defaultness).map(|it| Token![default](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01001963 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay8d642ab2019-03-26 09:23:37 -03001964 impl_token: Token![impl](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001965 generics: _visitor.fold_generics(_i.generics),
1966 trait_: (_i.trait_).map(|it| {
1967 (
David Tolnay7ac699c2018-08-24 14:00:58 -04001968 ((it).0).map(|it| Token![!](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07001969 _visitor.fold_path((it).1),
David Tolnay905ef2b2019-02-11 02:28:22 +01001970 Token![for](tokens_helper(_visitor, &(it).2.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001971 )
1972 }),
1973 self_ty: Box::new(_visitor.fold_type(*_i.self_ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04001974 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001975 items: FoldHelper::lift(_i.items, |it| _visitor.fold_impl_item(it)),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001976 }
1977}
David Tolnay8c81f622018-07-31 23:34:35 -07001978#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001979pub fn fold_item_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro) -> ItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08001980 ItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07001981 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1982 ident: (_i.ident).map(|it| _visitor.fold_ident(it)),
1983 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04001984 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayc6b55bc2017-11-09 22:48:38 -08001985 }
1986}
David Tolnay8c81f622018-07-31 23:34:35 -07001987#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001988pub fn fold_item_macro2<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMacro2) -> ItemMacro2 {
David Tolnay500d8322017-12-18 00:32:51 -08001989 ItemMacro2 {
David Tolnay8c81f622018-07-31 23:34:35 -07001990 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
1991 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01001992 macro_token: Token![macro](tokens_helper(_visitor, &_i.macro_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001993 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04001994 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001995 args: _i.args,
David Tolnay7ac699c2018-08-24 14:00:58 -04001996 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07001997 body: _i.body,
David Tolnay500d8322017-12-18 00:32:51 -08001998 }
1999}
David Tolnay8c81f622018-07-31 23:34:35 -07002000#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002001pub fn fold_item_mod<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemMod) -> ItemMod {
Nika Layzell27726662017-10-24 23:16:35 -04002002 ItemMod {
David Tolnay8c81f622018-07-31 23:34:35 -07002003 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2004 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002005 mod_token: Token![mod](tokens_helper(_visitor, &_i.mod_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002006 ident: _visitor.fold_ident(_i.ident),
2007 content: (_i.content).map(|it| {
2008 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002009 Brace(tokens_helper(_visitor, &(it).0.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002010 FoldHelper::lift((it).1, |it| _visitor.fold_item(it)),
2011 )
2012 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002013 semi: (_i.semi).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002014 }
2015}
David Tolnay8c81f622018-07-31 23:34:35 -07002016#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002017pub fn fold_item_static<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStatic) -> ItemStatic {
Nika Layzell27726662017-10-24 23:16:35 -04002018 ItemStatic {
David Tolnay8c81f622018-07-31 23:34:35 -07002019 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2020 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002021 static_token: Token![static](tokens_helper(_visitor, &_i.static_token.span)),
2022 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002023 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002024 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002025 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002026 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002027 expr: Box::new(_visitor.fold_expr(*_i.expr)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002028 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002029 }
2030}
David Tolnay8c81f622018-07-31 23:34:35 -07002031#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002032pub fn fold_item_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemStruct) -> ItemStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002033 ItemStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002034 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2035 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002036 struct_token: Token![struct](tokens_helper(_visitor, &_i.struct_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002037 ident: _visitor.fold_ident(_i.ident),
2038 generics: _visitor.fold_generics(_i.generics),
2039 fields: _visitor.fold_fields(_i.fields),
David Tolnay7ac699c2018-08-24 14:00:58 -04002040 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002041 }
2042}
David Tolnay8c81f622018-07-31 23:34:35 -07002043#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002044pub fn fold_item_trait<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemTrait) -> ItemTrait {
Nika Layzell27726662017-10-24 23:16:35 -04002045 ItemTrait {
David Tolnay8c81f622018-07-31 23:34:35 -07002046 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2047 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002048 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002049 auto_token: (_i.auto_token).map(|it| Token![auto](tokens_helper(_visitor, &it.span))),
David Tolnay905ef2b2019-02-11 02:28:22 +01002050 trait_token: Token![trait](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002051 ident: _visitor.fold_ident(_i.ident),
2052 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002053 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002054 supertraits: FoldHelper::lift(_i.supertraits, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002055 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002056 items: FoldHelper::lift(_i.items, |it| _visitor.fold_trait_item(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002057 }
2058}
David Tolnay8c81f622018-07-31 23:34:35 -07002059#[cfg(feature = "full")]
David Tolnayc6b04dd2018-08-30 23:22:51 -07002060pub fn fold_item_trait_alias<V: Fold + ?Sized>(
2061 _visitor: &mut V,
2062 _i: ItemTraitAlias,
2063) -> ItemTraitAlias {
2064 ItemTraitAlias {
2065 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2066 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002067 trait_token: Token![trait](tokens_helper(_visitor, &_i.trait_token.span)),
David Tolnayc6b04dd2018-08-30 23:22:51 -07002068 ident: _visitor.fold_ident(_i.ident),
2069 generics: _visitor.fold_generics(_i.generics),
2070 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
2071 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2072 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
2073 }
2074}
2075#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002076pub fn fold_item_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemType) -> ItemType {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002077 ItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002078 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2079 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002080 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002081 ident: _visitor.fold_ident(_i.ident),
2082 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002083 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002084 ty: Box::new(_visitor.fold_type(*_i.ty)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002085 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002086 }
2087}
David Tolnay8c81f622018-07-31 23:34:35 -07002088#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002089pub fn fold_item_union<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUnion) -> ItemUnion {
Nika Layzell27726662017-10-24 23:16:35 -04002090 ItemUnion {
David Tolnay8c81f622018-07-31 23:34:35 -07002091 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2092 vis: _visitor.fold_visibility(_i.vis),
David Tolnay7ac699c2018-08-24 14:00:58 -04002093 union_token: Token![union](tokens_helper(_visitor, &_i.union_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002094 ident: _visitor.fold_ident(_i.ident),
2095 generics: _visitor.fold_generics(_i.generics),
2096 fields: _visitor.fold_fields_named(_i.fields),
Nika Layzell27726662017-10-24 23:16:35 -04002097 }
2098}
David Tolnay8c81f622018-07-31 23:34:35 -07002099#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002100pub fn fold_item_use<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemUse) -> ItemUse {
Nika Layzell27726662017-10-24 23:16:35 -04002101 ItemUse {
David Tolnay8c81f622018-07-31 23:34:35 -07002102 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2103 vis: _visitor.fold_visibility(_i.vis),
David Tolnay905ef2b2019-02-11 02:28:22 +01002104 use_token: Token![use](tokens_helper(_visitor, &_i.use_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002105 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002106 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002107 tree: _visitor.fold_use_tree(_i.tree),
David Tolnay7ac699c2018-08-24 14:00:58 -04002108 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002109 }
2110}
David Tolnay8c81f622018-07-31 23:34:35 -07002111#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002112pub fn fold_item_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: ItemVerbatim) -> ItemVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002113 ItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002114}
David Tolnay8c81f622018-07-31 23:34:35 -07002115#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002116pub fn fold_label<V: Fold + ?Sized>(_visitor: &mut V, _i: Label) -> Label {
David Tolnaybcd498f2017-12-29 12:02:33 -05002117 Label {
David Tolnay8c81f622018-07-31 23:34:35 -07002118 name: _visitor.fold_lifetime(_i.name),
David Tolnay7ac699c2018-08-24 14:00:58 -04002119 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnaybcd498f2017-12-29 12:02:33 -05002120 }
2121}
Alex Crichton131308c2018-05-18 14:00:24 -07002122pub fn fold_lifetime<V: Fold + ?Sized>(_visitor: &mut V, _i: Lifetime) -> Lifetime {
2123 Lifetime {
David Tolnay17f63892018-08-31 10:36:32 -07002124 apostrophe: _visitor.fold_span(_i.apostrophe),
David Tolnay8c81f622018-07-31 23:34:35 -07002125 ident: _visitor.fold_ident(_i.ident),
Alex Crichton131308c2018-05-18 14:00:24 -07002126 }
2127}
David Tolnay440fe582019-02-15 20:23:14 -08002128#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002129pub fn fold_lifetime_def<V: Fold + ?Sized>(_visitor: &mut V, _i: LifetimeDef) -> LifetimeDef {
Nika Layzell27726662017-10-24 23:16:35 -04002130 LifetimeDef {
David Tolnay8c81f622018-07-31 23:34:35 -07002131 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2132 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay7ac699c2018-08-24 14:00:58 -04002133 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002134 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnay4ba63a02017-12-28 15:53:05 -05002135 }
2136}
David Tolnay440fe582019-02-15 20:23:14 -08002137#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002138pub fn fold_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: Lit) -> Lit {
David Tolnay360efd22018-01-04 23:35:26 -08002139 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002140 Lit::Str(_binding_0) => Lit::Str(_visitor.fold_lit_str(_binding_0)),
2141 Lit::ByteStr(_binding_0) => Lit::ByteStr(_visitor.fold_lit_byte_str(_binding_0)),
2142 Lit::Byte(_binding_0) => Lit::Byte(_visitor.fold_lit_byte(_binding_0)),
2143 Lit::Char(_binding_0) => Lit::Char(_visitor.fold_lit_char(_binding_0)),
2144 Lit::Int(_binding_0) => Lit::Int(_visitor.fold_lit_int(_binding_0)),
2145 Lit::Float(_binding_0) => Lit::Float(_visitor.fold_lit_float(_binding_0)),
2146 Lit::Bool(_binding_0) => Lit::Bool(_visitor.fold_lit_bool(_binding_0)),
2147 Lit::Verbatim(_binding_0) => Lit::Verbatim(_visitor.fold_lit_verbatim(_binding_0)),
David Tolnay360efd22018-01-04 23:35:26 -08002148 }
2149}
David Tolnay440fe582019-02-15 20:23:14 -08002150#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002151pub fn fold_lit_bool<V: Fold + ?Sized>(_visitor: &mut V, _i: LitBool) -> LitBool {
David Tolnay360efd22018-01-04 23:35:26 -08002152 LitBool {
David Tolnay8c81f622018-07-31 23:34:35 -07002153 value: _i.value,
2154 span: _visitor.fold_span(_i.span),
Nika Layzell27726662017-10-24 23:16:35 -04002155 }
2156}
David Tolnay440fe582019-02-15 20:23:14 -08002157#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay587abd02019-05-08 17:17:31 -07002158pub fn fold_lit_byte<V: Fold + ?Sized>(_visitor: &mut V, _i: LitByte) -> LitByte {
2159 let span = _visitor.fold_span(_i.span());
2160 let mut _i = _i;
2161 _i.set_span(span);
2162 _i
2163}
2164#[cfg(any(feature = "derive", feature = "full"))]
2165pub fn fold_lit_byte_str<V: Fold + ?Sized>(_visitor: &mut V, _i: LitByteStr) -> LitByteStr {
2166 let span = _visitor.fold_span(_i.span());
2167 let mut _i = _i;
2168 _i.set_span(span);
2169 _i
2170}
2171#[cfg(any(feature = "derive", feature = "full"))]
2172pub fn fold_lit_char<V: Fold + ?Sized>(_visitor: &mut V, _i: LitChar) -> LitChar {
2173 let span = _visitor.fold_span(_i.span());
2174 let mut _i = _i;
2175 _i.set_span(span);
2176 _i
2177}
2178#[cfg(any(feature = "derive", feature = "full"))]
2179pub fn fold_lit_float<V: Fold + ?Sized>(_visitor: &mut V, _i: LitFloat) -> LitFloat {
2180 let span = _visitor.fold_span(_i.span());
2181 let mut _i = _i;
2182 _i.set_span(span);
2183 _i
2184}
2185#[cfg(any(feature = "derive", feature = "full"))]
2186pub fn fold_lit_int<V: Fold + ?Sized>(_visitor: &mut V, _i: LitInt) -> LitInt {
2187 let span = _visitor.fold_span(_i.span());
2188 let mut _i = _i;
2189 _i.set_span(span);
2190 _i
2191}
2192#[cfg(any(feature = "derive", feature = "full"))]
2193pub fn fold_lit_str<V: Fold + ?Sized>(_visitor: &mut V, _i: LitStr) -> LitStr {
2194 let span = _visitor.fold_span(_i.span());
2195 let mut _i = _i;
2196 _i.set_span(span);
2197 _i
2198}
2199#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002200pub fn fold_lit_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002201 LitVerbatim { token: _i.token }
David Tolnay360efd22018-01-04 23:35:26 -08002202}
David Tolnay8c81f622018-07-31 23:34:35 -07002203#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002204pub fn fold_local<V: Fold + ?Sized>(_visitor: &mut V, _i: Local) -> Local {
Nika Layzell27726662017-10-24 23:16:35 -04002205 Local {
David Tolnay8c81f622018-07-31 23:34:35 -07002206 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002207 let_token: Token![let](tokens_helper(_visitor, &_i.let_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002208 pats: FoldHelper::lift(_i.pats, |it| _visitor.fold_pat(it)),
2209 ty: (_i.ty).map(|it| {
2210 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002211 Token ! [ : ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002212 Box::new(_visitor.fold_type(*(it).1)),
2213 )
2214 }),
2215 init: (_i.init).map(|it| {
2216 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002217 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002218 Box::new(_visitor.fold_expr(*(it).1)),
2219 )
2220 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002221 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002222 }
2223}
David Tolnay440fe582019-02-15 20:23:14 -08002224#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002225pub fn fold_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: Macro) -> Macro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002226 Macro {
David Tolnay8c81f622018-07-31 23:34:35 -07002227 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002228 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002229 delimiter: _visitor.fold_macro_delimiter(_i.delimiter),
2230 tts: _i.tts,
David Tolnayab919512017-12-30 23:31:51 -05002231 }
2232}
David Tolnay440fe582019-02-15 20:23:14 -08002233#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002234pub fn fold_macro_delimiter<V: Fold + ?Sized>(
2235 _visitor: &mut V,
2236 _i: MacroDelimiter,
2237) -> MacroDelimiter {
David Tolnayab919512017-12-30 23:31:51 -05002238 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002239 MacroDelimiter::Paren(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002240 MacroDelimiter::Paren(Paren(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002241 }
David Tolnay8c81f622018-07-31 23:34:35 -07002242 MacroDelimiter::Brace(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002243 MacroDelimiter::Brace(Brace(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002244 }
David Tolnay8c81f622018-07-31 23:34:35 -07002245 MacroDelimiter::Bracket(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002246 MacroDelimiter::Bracket(Bracket(tokens_helper(_visitor, &_binding_0.span)))
David Tolnayab919512017-12-30 23:31:51 -05002247 }
David Tolnaydecf28d2017-11-11 11:56:45 -08002248 }
2249}
David Tolnay440fe582019-02-15 20:23:14 -08002250#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002251pub fn fold_member<V: Fold + ?Sized>(_visitor: &mut V, _i: Member) -> Member {
David Tolnay85b69a42017-12-27 20:43:10 -05002252 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002253 Member::Named(_binding_0) => Member::Named(_visitor.fold_ident(_binding_0)),
2254 Member::Unnamed(_binding_0) => Member::Unnamed(_visitor.fold_index(_binding_0)),
David Tolnay85b69a42017-12-27 20:43:10 -05002255 }
2256}
David Tolnay440fe582019-02-15 20:23:14 -08002257#[cfg(any(feature = "derive", feature = "full"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002258pub fn fold_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: Meta) -> Meta {
Nika Layzell27726662017-10-24 23:16:35 -04002259 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002260 Meta::Word(_binding_0) => Meta::Word(_visitor.fold_ident(_binding_0)),
2261 Meta::List(_binding_0) => Meta::List(_visitor.fold_meta_list(_binding_0)),
2262 Meta::NameValue(_binding_0) => Meta::NameValue(_visitor.fold_meta_name_value(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002263 }
2264}
David Tolnay440fe582019-02-15 20:23:14 -08002265#[cfg(any(feature = "derive", feature = "full"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002266pub fn fold_meta_list<V: Fold + ?Sized>(_visitor: &mut V, _i: MetaList) -> MetaList {
2267 MetaList {
David Tolnay8c81f622018-07-31 23:34:35 -07002268 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002269 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002270 nested: FoldHelper::lift(_i.nested, |it| _visitor.fold_nested_meta(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002271 }
2272}
David Tolnay440fe582019-02-15 20:23:14 -08002273#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002274pub fn fold_meta_name_value<V: Fold + ?Sized>(
2275 _visitor: &mut V,
2276 _i: MetaNameValue,
2277) -> MetaNameValue {
Nika Layzell27726662017-10-24 23:16:35 -04002278 MetaNameValue {
David Tolnay8c81f622018-07-31 23:34:35 -07002279 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002280 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002281 lit: _visitor.fold_lit(_i.lit),
Nika Layzell27726662017-10-24 23:16:35 -04002282 }
2283}
David Tolnay8c81f622018-07-31 23:34:35 -07002284#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002285pub fn fold_method_sig<V: Fold + ?Sized>(_visitor: &mut V, _i: MethodSig) -> MethodSig {
Nika Layzell27726662017-10-24 23:16:35 -04002286 MethodSig {
David Tolnay905ef2b2019-02-11 02:28:22 +01002287 constness: (_i.constness).map(|it| Token![const](tokens_helper(_visitor, &it.span))),
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09002288 asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))),
Felix Rabe12cb78e2019-06-08 23:03:49 +02002289 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002290 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
2291 ident: _visitor.fold_ident(_i.ident),
2292 decl: _visitor.fold_fn_decl(_i.decl),
Nika Layzell27726662017-10-24 23:16:35 -04002293 }
2294}
David Tolnay8c81f622018-07-31 23:34:35 -07002295#[cfg(feature = "full")]
2296pub fn fold_method_turbofish<V: Fold + ?Sized>(
2297 _visitor: &mut V,
2298 _i: MethodTurbofish,
2299) -> MethodTurbofish {
David Tolnayd60cfec2017-12-29 00:21:38 -05002300 MethodTurbofish {
David Tolnay7ac699c2018-08-24 14:00:58 -04002301 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
2302 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002303 args: FoldHelper::lift(_i.args, |it| _visitor.fold_generic_method_argument(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002304 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
David Tolnayd60cfec2017-12-29 00:21:38 -05002305 }
2306}
David Tolnay440fe582019-02-15 20:23:14 -08002307#[cfg(any(feature = "derive", feature = "full"))]
David Tolnayaaadd782018-01-06 22:58:13 -08002308pub fn fold_nested_meta<V: Fold + ?Sized>(_visitor: &mut V, _i: NestedMeta) -> NestedMeta {
Nika Layzell27726662017-10-24 23:16:35 -04002309 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002310 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(_visitor.fold_meta(_binding_0)),
2311 NestedMeta::Literal(_binding_0) => NestedMeta::Literal(_visitor.fold_lit(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002312 }
2313}
David Tolnay440fe582019-02-15 20:23:14 -08002314#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002315pub fn fold_parenthesized_generic_arguments<V: Fold + ?Sized>(
2316 _visitor: &mut V,
2317 _i: ParenthesizedGenericArguments,
2318) -> ParenthesizedGenericArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002319 ParenthesizedGenericArguments {
David Tolnay7ac699c2018-08-24 14:00:58 -04002320 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002321 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_type(it)),
2322 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002323 }
2324}
David Tolnay8c81f622018-07-31 23:34:35 -07002325#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002326pub fn fold_pat<V: Fold + ?Sized>(_visitor: &mut V, _i: Pat) -> Pat {
Nika Layzell27726662017-10-24 23:16:35 -04002327 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002328 Pat::Wild(_binding_0) => Pat::Wild(_visitor.fold_pat_wild(_binding_0)),
2329 Pat::Ident(_binding_0) => Pat::Ident(_visitor.fold_pat_ident(_binding_0)),
2330 Pat::Struct(_binding_0) => Pat::Struct(_visitor.fold_pat_struct(_binding_0)),
2331 Pat::TupleStruct(_binding_0) => {
2332 Pat::TupleStruct(_visitor.fold_pat_tuple_struct(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002333 }
David Tolnay8c81f622018-07-31 23:34:35 -07002334 Pat::Path(_binding_0) => Pat::Path(_visitor.fold_pat_path(_binding_0)),
2335 Pat::Tuple(_binding_0) => Pat::Tuple(_visitor.fold_pat_tuple(_binding_0)),
2336 Pat::Box(_binding_0) => Pat::Box(_visitor.fold_pat_box(_binding_0)),
2337 Pat::Ref(_binding_0) => Pat::Ref(_visitor.fold_pat_ref(_binding_0)),
2338 Pat::Lit(_binding_0) => Pat::Lit(_visitor.fold_pat_lit(_binding_0)),
2339 Pat::Range(_binding_0) => Pat::Range(_visitor.fold_pat_range(_binding_0)),
2340 Pat::Slice(_binding_0) => Pat::Slice(_visitor.fold_pat_slice(_binding_0)),
2341 Pat::Macro(_binding_0) => Pat::Macro(_visitor.fold_pat_macro(_binding_0)),
2342 Pat::Verbatim(_binding_0) => Pat::Verbatim(_visitor.fold_pat_verbatim(_binding_0)),
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_box<V: Fold + ?Sized>(_visitor: &mut V, _i: PatBox) -> PatBox {
Nika Layzell27726662017-10-24 23:16:35 -04002347 PatBox {
David Tolnay905ef2b2019-02-11 02:28:22 +01002348 box_token: Token![box](tokens_helper(_visitor, &_i.box_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002349 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002350 }
2351}
David Tolnay8c81f622018-07-31 23:34:35 -07002352#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002353pub fn fold_pat_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: PatIdent) -> PatIdent {
Nika Layzell27726662017-10-24 23:16:35 -04002354 PatIdent {
David Tolnay905ef2b2019-02-11 02:28:22 +01002355 by_ref: (_i.by_ref).map(|it| Token![ref](tokens_helper(_visitor, &it.span))),
2356 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002357 ident: _visitor.fold_ident(_i.ident),
2358 subpat: (_i.subpat).map(|it| {
2359 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002360 Token ! [ @ ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002361 Box::new(_visitor.fold_pat(*(it).1)),
2362 )
2363 }),
Nika Layzell27726662017-10-24 23:16:35 -04002364 }
2365}
David Tolnay8c81f622018-07-31 23:34:35 -07002366#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002367pub fn fold_pat_lit<V: Fold + ?Sized>(_visitor: &mut V, _i: PatLit) -> PatLit {
Nika Layzell27726662017-10-24 23:16:35 -04002368 PatLit {
David Tolnay8c81f622018-07-31 23:34:35 -07002369 expr: Box::new(_visitor.fold_expr(*_i.expr)),
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_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: PatMacro) -> PatMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002374 PatMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002375 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002376 }
2377}
David Tolnay8c81f622018-07-31 23:34:35 -07002378#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002379pub fn fold_pat_path<V: Fold + ?Sized>(_visitor: &mut V, _i: PatPath) -> PatPath {
Nika Layzell27726662017-10-24 23:16:35 -04002380 PatPath {
David Tolnay8c81f622018-07-31 23:34:35 -07002381 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2382 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002383 }
2384}
David Tolnay8c81f622018-07-31 23:34:35 -07002385#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002386pub fn fold_pat_range<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRange) -> PatRange {
Nika Layzell27726662017-10-24 23:16:35 -04002387 PatRange {
David Tolnay8c81f622018-07-31 23:34:35 -07002388 lo: Box::new(_visitor.fold_expr(*_i.lo)),
2389 limits: _visitor.fold_range_limits(_i.limits),
2390 hi: Box::new(_visitor.fold_expr(*_i.hi)),
Nika Layzell27726662017-10-24 23:16:35 -04002391 }
2392}
David Tolnay8c81f622018-07-31 23:34:35 -07002393#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002394pub fn fold_pat_ref<V: Fold + ?Sized>(_visitor: &mut V, _i: PatRef) -> PatRef {
Nika Layzell27726662017-10-24 23:16:35 -04002395 PatRef {
David Tolnay7ac699c2018-08-24 14:00:58 -04002396 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002397 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002398 pat: Box::new(_visitor.fold_pat(*_i.pat)),
Nika Layzell27726662017-10-24 23:16:35 -04002399 }
2400}
David Tolnay8c81f622018-07-31 23:34:35 -07002401#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002402pub fn fold_pat_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: PatSlice) -> PatSlice {
Nika Layzell27726662017-10-24 23:16:35 -04002403 PatSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002404 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002405 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
2406 middle: (_i.middle).map(|it| Box::new(_visitor.fold_pat(*it))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002407 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2408 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002409 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002410 }
2411}
David Tolnay8c81f622018-07-31 23:34:35 -07002412#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002413pub fn fold_pat_struct<V: Fold + ?Sized>(_visitor: &mut V, _i: PatStruct) -> PatStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002414 PatStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002415 path: _visitor.fold_path(_i.path),
David Tolnay7ac699c2018-08-24 14:00:58 -04002416 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002417 fields: FoldHelper::lift(_i.fields, |it| _visitor.fold_field_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002418 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
Nika Layzell27726662017-10-24 23:16:35 -04002419 }
2420}
David Tolnay8c81f622018-07-31 23:34:35 -07002421#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002422pub fn fold_pat_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: PatTuple) -> PatTuple {
Nika Layzell27726662017-10-24 23:16:35 -04002423 PatTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002424 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002425 front: FoldHelper::lift(_i.front, |it| _visitor.fold_pat(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002426 dot2_token: (_i.dot2_token).map(|it| Token![..](tokens_helper(_visitor, &it.spans))),
2427 comma_token: (_i.comma_token).map(|it| Token ! [ , ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002428 back: FoldHelper::lift(_i.back, |it| _visitor.fold_pat(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002429 }
2430}
David Tolnay8c81f622018-07-31 23:34:35 -07002431#[cfg(feature = "full")]
2432pub fn fold_pat_tuple_struct<V: Fold + ?Sized>(
2433 _visitor: &mut V,
2434 _i: PatTupleStruct,
2435) -> PatTupleStruct {
Nika Layzell27726662017-10-24 23:16:35 -04002436 PatTupleStruct {
David Tolnay8c81f622018-07-31 23:34:35 -07002437 path: _visitor.fold_path(_i.path),
2438 pat: _visitor.fold_pat_tuple(_i.pat),
Nika Layzell27726662017-10-24 23:16:35 -04002439 }
2440}
David Tolnay8c81f622018-07-31 23:34:35 -07002441#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002442pub fn fold_pat_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: PatVerbatim) -> PatVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002443 PatVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002444}
David Tolnay8c81f622018-07-31 23:34:35 -07002445#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002446pub fn fold_pat_wild<V: Fold + ?Sized>(_visitor: &mut V, _i: PatWild) -> PatWild {
Nika Layzell27726662017-10-24 23:16:35 -04002447 PatWild {
David Tolnay7ac699c2018-08-24 14:00:58 -04002448 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002449 }
2450}
David Tolnay440fe582019-02-15 20:23:14 -08002451#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002452pub fn fold_path<V: Fold + ?Sized>(_visitor: &mut V, _i: Path) -> Path {
Nika Layzell27726662017-10-24 23:16:35 -04002453 Path {
David Tolnay8c81f622018-07-31 23:34:35 -07002454 leading_colon: (_i.leading_colon)
David Tolnay7ac699c2018-08-24 14:00:58 -04002455 .map(|it| Token ! [ :: ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002456 segments: FoldHelper::lift(_i.segments, |it| _visitor.fold_path_segment(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002457 }
2458}
David Tolnay440fe582019-02-15 20:23:14 -08002459#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002460pub fn fold_path_arguments<V: Fold + ?Sized>(_visitor: &mut V, _i: PathArguments) -> PathArguments {
Nika Layzellc08227a2017-12-04 16:30:17 -05002461 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002462 PathArguments::None => PathArguments::None,
2463 PathArguments::AngleBracketed(_binding_0) => PathArguments::AngleBracketed(
2464 _visitor.fold_angle_bracketed_generic_arguments(_binding_0),
2465 ),
2466 PathArguments::Parenthesized(_binding_0) => {
2467 PathArguments::Parenthesized(_visitor.fold_parenthesized_generic_arguments(_binding_0))
Nika Layzellc08227a2017-12-04 16:30:17 -05002468 }
2469 }
2470}
David Tolnay440fe582019-02-15 20:23:14 -08002471#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002472pub fn fold_path_segment<V: Fold + ?Sized>(_visitor: &mut V, _i: PathSegment) -> PathSegment {
Nika Layzell27726662017-10-24 23:16:35 -04002473 PathSegment {
David Tolnay8c81f622018-07-31 23:34:35 -07002474 ident: _visitor.fold_ident(_i.ident),
2475 arguments: _visitor.fold_path_arguments(_i.arguments),
Nika Layzell27726662017-10-24 23:16:35 -04002476 }
2477}
David Tolnay440fe582019-02-15 20:23:14 -08002478#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002479pub fn fold_predicate_eq<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateEq) -> PredicateEq {
David Tolnayd4add852018-01-01 20:13:24 -08002480 PredicateEq {
David Tolnay8c81f622018-07-31 23:34:35 -07002481 lhs_ty: _visitor.fold_type(_i.lhs_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002482 eq_token: Token ! [ = ](tokens_helper(_visitor, &_i.eq_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002483 rhs_ty: _visitor.fold_type(_i.rhs_ty),
David Tolnayd4add852018-01-01 20:13:24 -08002484 }
2485}
David Tolnay440fe582019-02-15 20:23:14 -08002486#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002487pub fn fold_predicate_lifetime<V: Fold + ?Sized>(
2488 _visitor: &mut V,
2489 _i: PredicateLifetime,
2490) -> PredicateLifetime {
David Tolnayd4add852018-01-01 20:13:24 -08002491 PredicateLifetime {
David Tolnay8c81f622018-07-31 23:34:35 -07002492 lifetime: _visitor.fold_lifetime(_i.lifetime),
David Tolnay1b8e2852018-08-26 08:25:18 -04002493 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002494 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_lifetime(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002495 }
2496}
David Tolnay440fe582019-02-15 20:23:14 -08002497#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002498pub fn fold_predicate_type<V: Fold + ?Sized>(_visitor: &mut V, _i: PredicateType) -> PredicateType {
David Tolnayd4add852018-01-01 20:13:24 -08002499 PredicateType {
David Tolnay8c81f622018-07-31 23:34:35 -07002500 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2501 bounded_ty: _visitor.fold_type(_i.bounded_ty),
David Tolnay7ac699c2018-08-24 14:00:58 -04002502 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002503 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnayd4add852018-01-01 20:13:24 -08002504 }
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_qself<V: Fold + ?Sized>(_visitor: &mut V, _i: QSelf) -> QSelf {
Nika Layzell27726662017-10-24 23:16:35 -04002508 QSelf {
David Tolnay7ac699c2018-08-24 14:00:58 -04002509 lt_token: Token ! [ < ](tokens_helper(_visitor, &_i.lt_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002510 ty: Box::new(_visitor.fold_type(*_i.ty)),
2511 position: _i.position,
David Tolnay905ef2b2019-02-11 02:28:22 +01002512 as_token: (_i.as_token).map(|it| Token![as](tokens_helper(_visitor, &it.span))),
David Tolnay7ac699c2018-08-24 14:00:58 -04002513 gt_token: Token ! [ > ](tokens_helper(_visitor, &_i.gt_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002514 }
2515}
David Tolnay8c81f622018-07-31 23:34:35 -07002516#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002517pub fn fold_range_limits<V: Fold + ?Sized>(_visitor: &mut V, _i: RangeLimits) -> RangeLimits {
Nika Layzell27726662017-10-24 23:16:35 -04002518 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002519 RangeLimits::HalfOpen(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002520 RangeLimits::HalfOpen(Token![..](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002521 }
David Tolnay8c81f622018-07-31 23:34:35 -07002522 RangeLimits::Closed(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002523 RangeLimits::Closed(Token ! [ ..= ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002524 }
2525 }
2526}
David Tolnay440fe582019-02-15 20:23:14 -08002527#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002528pub fn fold_return_type<V: Fold + ?Sized>(_visitor: &mut V, _i: ReturnType) -> ReturnType {
David Tolnayf93b90d2017-11-11 19:21:26 -08002529 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002530 ReturnType::Default => ReturnType::Default,
2531 ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type(
David Tolnay7ac699c2018-08-24 14:00:58 -04002532 Token ! [ -> ](tokens_helper(_visitor, &_binding_0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002533 Box::new(_visitor.fold_type(*_binding_1)),
2534 ),
David Tolnayf93b90d2017-11-11 19:21:26 -08002535 }
2536}
David Tolnay8c81f622018-07-31 23:34:35 -07002537#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002538pub fn fold_stmt<V: Fold + ?Sized>(_visitor: &mut V, _i: Stmt) -> Stmt {
Nika Layzell27726662017-10-24 23:16:35 -04002539 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002540 Stmt::Local(_binding_0) => Stmt::Local(_visitor.fold_local(_binding_0)),
2541 Stmt::Item(_binding_0) => Stmt::Item(_visitor.fold_item(_binding_0)),
2542 Stmt::Expr(_binding_0) => Stmt::Expr(_visitor.fold_expr(_binding_0)),
2543 Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi(
2544 _visitor.fold_expr(_binding_0),
David Tolnay7ac699c2018-08-24 14:00:58 -04002545 Token ! [ ; ](tokens_helper(_visitor, &_binding_1.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002546 ),
Nika Layzell27726662017-10-24 23:16:35 -04002547 }
2548}
David Tolnay440fe582019-02-15 20:23:14 -08002549#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002550pub fn fold_trait_bound<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitBound) -> TraitBound {
David Tolnay40fb8ce2018-01-02 10:53:46 -08002551 TraitBound {
David Tolnay7ac699c2018-08-24 14:00:58 -04002552 paren_token: (_i.paren_token).map(|it| Paren(tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002553 modifier: _visitor.fold_trait_bound_modifier(_i.modifier),
2554 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
2555 path: _visitor.fold_path(_i.path),
David Tolnay40fb8ce2018-01-02 10:53:46 -08002556 }
2557}
David Tolnay440fe582019-02-15 20:23:14 -08002558#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002559pub fn fold_trait_bound_modifier<V: Fold + ?Sized>(
2560 _visitor: &mut V,
2561 _i: TraitBoundModifier,
2562) -> TraitBoundModifier {
Nika Layzell27726662017-10-24 23:16:35 -04002563 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002564 TraitBoundModifier::None => TraitBoundModifier::None,
2565 TraitBoundModifier::Maybe(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002566 TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002567 }
2568 }
2569}
David Tolnay8c81f622018-07-31 23:34:35 -07002570#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002571pub fn fold_trait_item<V: Fold + ?Sized>(_visitor: &mut V, _i: TraitItem) -> TraitItem {
Nika Layzell27726662017-10-24 23:16:35 -04002572 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002573 TraitItem::Const(_binding_0) => {
2574 TraitItem::Const(_visitor.fold_trait_item_const(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002575 }
David Tolnay8c81f622018-07-31 23:34:35 -07002576 TraitItem::Method(_binding_0) => {
2577 TraitItem::Method(_visitor.fold_trait_item_method(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002578 }
David Tolnay8c81f622018-07-31 23:34:35 -07002579 TraitItem::Type(_binding_0) => TraitItem::Type(_visitor.fold_trait_item_type(_binding_0)),
2580 TraitItem::Macro(_binding_0) => {
2581 TraitItem::Macro(_visitor.fold_trait_item_macro(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002582 }
David Tolnay8c81f622018-07-31 23:34:35 -07002583 TraitItem::Verbatim(_binding_0) => {
2584 TraitItem::Verbatim(_visitor.fold_trait_item_verbatim(_binding_0))
David Tolnay2ae520a2017-12-29 11:19:50 -05002585 }
Nika Layzell27726662017-10-24 23:16:35 -04002586 }
2587}
David Tolnay8c81f622018-07-31 23:34:35 -07002588#[cfg(feature = "full")]
2589pub fn fold_trait_item_const<V: Fold + ?Sized>(
2590 _visitor: &mut V,
2591 _i: TraitItemConst,
2592) -> TraitItemConst {
David Tolnayda705bd2017-11-10 21:58:05 -08002593 TraitItemConst {
David Tolnay8c81f622018-07-31 23:34:35 -07002594 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002595 const_token: Token![const](tokens_helper(_visitor, &_i.const_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002596 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002597 colon_token: Token ! [ : ](tokens_helper(_visitor, &_i.colon_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002598 ty: _visitor.fold_type(_i.ty),
2599 default: (_i.default).map(|it| {
2600 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002601 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002602 _visitor.fold_expr((it).1),
2603 )
2604 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002605 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnayda705bd2017-11-10 21:58:05 -08002606 }
2607}
David Tolnay8c81f622018-07-31 23:34:35 -07002608#[cfg(feature = "full")]
2609pub fn fold_trait_item_macro<V: Fold + ?Sized>(
2610 _visitor: &mut V,
2611 _i: TraitItemMacro,
2612) -> TraitItemMacro {
David Tolnaydecf28d2017-11-11 11:56:45 -08002613 TraitItemMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002614 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2615 mac: _visitor.fold_macro(_i.mac),
David Tolnay7ac699c2018-08-24 14:00:58 -04002616 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.spans))),
David Tolnayda705bd2017-11-10 21:58:05 -08002617 }
2618}
David Tolnay8c81f622018-07-31 23:34:35 -07002619#[cfg(feature = "full")]
2620pub fn fold_trait_item_method<V: Fold + ?Sized>(
2621 _visitor: &mut V,
2622 _i: TraitItemMethod,
2623) -> TraitItemMethod {
Nika Layzell27726662017-10-24 23:16:35 -04002624 TraitItemMethod {
David Tolnay8c81f622018-07-31 23:34:35 -07002625 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2626 sig: _visitor.fold_method_sig(_i.sig),
2627 default: (_i.default).map(|it| _visitor.fold_block(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002628 semi_token: (_i.semi_token).map(|it| Token ! [ ; ](tokens_helper(_visitor, &it.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_type<V: Fold + ?Sized>(
2633 _visitor: &mut V,
2634 _i: TraitItemType,
2635) -> TraitItemType {
Nika Layzell27726662017-10-24 23:16:35 -04002636 TraitItemType {
David Tolnay8c81f622018-07-31 23:34:35 -07002637 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002638 type_token: Token![type](tokens_helper(_visitor, &_i.type_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002639 ident: _visitor.fold_ident(_i.ident),
2640 generics: _visitor.fold_generics(_i.generics),
David Tolnay7ac699c2018-08-24 14:00:58 -04002641 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002642 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
2643 default: (_i.default).map(|it| {
2644 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002645 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002646 _visitor.fold_type((it).1),
2647 )
2648 }),
David Tolnay7ac699c2018-08-24 14:00:58 -04002649 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002650 }
2651}
David Tolnay8c81f622018-07-31 23:34:35 -07002652#[cfg(feature = "full")]
2653pub fn fold_trait_item_verbatim<V: Fold + ?Sized>(
2654 _visitor: &mut V,
2655 _i: TraitItemVerbatim,
2656) -> TraitItemVerbatim {
2657 TraitItemVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002658}
David Tolnay440fe582019-02-15 20:23:14 -08002659#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002660pub fn fold_type<V: Fold + ?Sized>(_visitor: &mut V, _i: Type) -> Type {
Nika Layzell27726662017-10-24 23:16:35 -04002661 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002662 Type::Slice(_binding_0) => Type::Slice(_visitor.fold_type_slice(_binding_0)),
2663 Type::Array(_binding_0) => Type::Array(_visitor.fold_type_array(_binding_0)),
2664 Type::Ptr(_binding_0) => Type::Ptr(_visitor.fold_type_ptr(_binding_0)),
2665 Type::Reference(_binding_0) => Type::Reference(_visitor.fold_type_reference(_binding_0)),
2666 Type::BareFn(_binding_0) => Type::BareFn(_visitor.fold_type_bare_fn(_binding_0)),
2667 Type::Never(_binding_0) => Type::Never(_visitor.fold_type_never(_binding_0)),
2668 Type::Tuple(_binding_0) => Type::Tuple(_visitor.fold_type_tuple(_binding_0)),
2669 Type::Path(_binding_0) => Type::Path(_visitor.fold_type_path(_binding_0)),
2670 Type::TraitObject(_binding_0) => {
2671 Type::TraitObject(_visitor.fold_type_trait_object(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002672 }
David Tolnay8c81f622018-07-31 23:34:35 -07002673 Type::ImplTrait(_binding_0) => Type::ImplTrait(_visitor.fold_type_impl_trait(_binding_0)),
2674 Type::Paren(_binding_0) => Type::Paren(_visitor.fold_type_paren(_binding_0)),
2675 Type::Group(_binding_0) => Type::Group(_visitor.fold_type_group(_binding_0)),
2676 Type::Infer(_binding_0) => Type::Infer(_visitor.fold_type_infer(_binding_0)),
2677 Type::Macro(_binding_0) => Type::Macro(_visitor.fold_type_macro(_binding_0)),
2678 Type::Verbatim(_binding_0) => Type::Verbatim(_visitor.fold_type_verbatim(_binding_0)),
Nika Layzell27726662017-10-24 23:16:35 -04002679 }
2680}
David Tolnay440fe582019-02-15 20:23:14 -08002681#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002682pub fn fold_type_array<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002683 TypeArray {
David Tolnay7ac699c2018-08-24 14:00:58 -04002684 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002685 elem: Box::new(_visitor.fold_type(*_i.elem)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002686 semi_token: Token ! [ ; ](tokens_helper(_visitor, &_i.semi_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002687 len: _visitor.fold_expr(_i.len),
Nika Layzell27726662017-10-24 23:16:35 -04002688 }
2689}
David Tolnay440fe582019-02-15 20:23:14 -08002690#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002691pub fn fold_type_bare_fn<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeBareFn) -> TypeBareFn {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002692 TypeBareFn {
David Tolnay3779bb72018-08-26 18:46:07 -07002693 lifetimes: (_i.lifetimes).map(|it| _visitor.fold_bound_lifetimes(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002694 unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002695 abi: (_i.abi).map(|it| _visitor.fold_abi(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002696 fn_token: Token![fn](tokens_helper(_visitor, &_i.fn_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002697 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002698 inputs: FoldHelper::lift(_i.inputs, |it| _visitor.fold_bare_fn_arg(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002699 variadic: (_i.variadic).map(|it| Token ! [ ... ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002700 output: _visitor.fold_return_type(_i.output),
Nika Layzell27726662017-10-24 23:16:35 -04002701 }
2702}
David Tolnay440fe582019-02-15 20:23:14 -08002703#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002704pub fn fold_type_group<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002705 TypeGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002706 group_token: Group(tokens_helper(_visitor, &_i.group_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002707 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002708 }
2709}
David Tolnay440fe582019-02-15 20:23:14 -08002710#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002711pub fn fold_type_impl_trait<V: Fold + ?Sized>(
2712 _visitor: &mut V,
2713 _i: TypeImplTrait,
2714) -> TypeImplTrait {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002715 TypeImplTrait {
David Tolnay8d642ab2019-03-26 09:23:37 -03002716 impl_token: Token![impl](tokens_helper(_visitor, &_i.impl_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002717 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002718 }
2719}
David Tolnay440fe582019-02-15 20:23:14 -08002720#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002721pub fn fold_type_infer<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeInfer) -> TypeInfer {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002722 TypeInfer {
David Tolnay7ac699c2018-08-24 14:00:58 -04002723 underscore_token: Token![_](tokens_helper(_visitor, &_i.underscore_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002724 }
2725}
David Tolnay440fe582019-02-15 20:23:14 -08002726#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002727pub fn fold_type_macro<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeMacro) -> TypeMacro {
David Tolnay323279a2017-12-29 11:26:32 -05002728 TypeMacro {
David Tolnay8c81f622018-07-31 23:34:35 -07002729 mac: _visitor.fold_macro(_i.mac),
David Tolnay323279a2017-12-29 11:26:32 -05002730 }
2731}
David Tolnay440fe582019-02-15 20:23:14 -08002732#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002733pub fn fold_type_never<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeNever) -> TypeNever {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002734 TypeNever {
David Tolnay7ac699c2018-08-24 14:00:58 -04002735 bang_token: Token![!](tokens_helper(_visitor, &_i.bang_token.spans)),
Nika Layzell27726662017-10-24 23:16:35 -04002736 }
2737}
David Tolnay440fe582019-02-15 20:23:14 -08002738#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002739pub fn fold_type_param<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParam) -> TypeParam {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002740 TypeParam {
David Tolnay8c81f622018-07-31 23:34:35 -07002741 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2742 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002743 colon_token: (_i.colon_token).map(|it| Token ! [ : ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002744 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002745 eq_token: (_i.eq_token).map(|it| Token ! [ = ](tokens_helper(_visitor, &it.spans))),
David Tolnay8c81f622018-07-31 23:34:35 -07002746 default: (_i.default).map(|it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002747 }
2748}
David Tolnay440fe582019-02-15 20:23:14 -08002749#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002750pub fn fold_type_param_bound<V: Fold + ?Sized>(
2751 _visitor: &mut V,
2752 _i: TypeParamBound,
2753) -> TypeParamBound {
Nika Layzell27726662017-10-24 23:16:35 -04002754 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002755 TypeParamBound::Trait(_binding_0) => {
2756 TypeParamBound::Trait(_visitor.fold_trait_bound(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002757 }
David Tolnay8c81f622018-07-31 23:34:35 -07002758 TypeParamBound::Lifetime(_binding_0) => {
2759 TypeParamBound::Lifetime(_visitor.fold_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002760 }
2761 }
2762}
David Tolnay440fe582019-02-15 20:23:14 -08002763#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002764pub fn fold_type_paren<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002765 TypeParen {
David Tolnay7ac699c2018-08-24 14:00:58 -04002766 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002767 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002768 }
2769}
David Tolnay440fe582019-02-15 20:23:14 -08002770#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002771pub fn fold_type_path<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePath) -> TypePath {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002772 TypePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002773 qself: (_i.qself).map(|it| _visitor.fold_qself(it)),
2774 path: _visitor.fold_path(_i.path),
Nika Layzell27726662017-10-24 23:16:35 -04002775 }
2776}
David Tolnay440fe582019-02-15 20:23:14 -08002777#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002778pub fn fold_type_ptr<V: Fold + ?Sized>(_visitor: &mut V, _i: TypePtr) -> TypePtr {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002779 TypePtr {
David Tolnay7ac699c2018-08-24 14:00:58 -04002780 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002781 const_token: (_i.const_token).map(|it| Token![const](tokens_helper(_visitor, &it.span))),
2782 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002783 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002784 }
2785}
David Tolnay440fe582019-02-15 20:23:14 -08002786#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002787pub fn fold_type_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeReference) -> TypeReference {
David Tolnay0a89b4d2017-11-13 00:55:45 -08002788 TypeReference {
David Tolnay7ac699c2018-08-24 14:00:58 -04002789 and_token: Token ! [ & ](tokens_helper(_visitor, &_i.and_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002790 lifetime: (_i.lifetime).map(|it| _visitor.fold_lifetime(it)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002791 mutability: (_i.mutability).map(|it| Token![mut](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002792 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002793 }
2794}
David Tolnay440fe582019-02-15 20:23:14 -08002795#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002796pub fn fold_type_slice<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002797 TypeSlice {
David Tolnay7ac699c2018-08-24 14:00:58 -04002798 bracket_token: Bracket(tokens_helper(_visitor, &_i.bracket_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002799 elem: Box::new(_visitor.fold_type(*_i.elem)),
Nika Layzell27726662017-10-24 23:16:35 -04002800 }
2801}
David Tolnay440fe582019-02-15 20:23:14 -08002802#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002803pub fn fold_type_trait_object<V: Fold + ?Sized>(
2804 _visitor: &mut V,
2805 _i: TypeTraitObject,
2806) -> TypeTraitObject {
David Tolnayfd6bf5c2017-11-12 09:41:14 -08002807 TypeTraitObject {
David Tolnay7ac699c2018-08-24 14:00:58 -04002808 dyn_token: (_i.dyn_token).map(|it| Token![dyn](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002809 bounds: FoldHelper::lift(_i.bounds, |it| _visitor.fold_type_param_bound(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002810 }
2811}
David Tolnay440fe582019-02-15 20:23:14 -08002812#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002813pub fn fold_type_tuple<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
David Tolnay05362582017-12-26 01:33:57 -05002814 TypeTuple {
David Tolnay7ac699c2018-08-24 14:00:58 -04002815 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002816 elems: FoldHelper::lift(_i.elems, |it| _visitor.fold_type(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002817 }
2818}
David Tolnay440fe582019-02-15 20:23:14 -08002819#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002820pub fn fold_type_verbatim<V: Fold + ?Sized>(_visitor: &mut V, _i: TypeVerbatim) -> TypeVerbatim {
David Tolnay8c81f622018-07-31 23:34:35 -07002821 TypeVerbatim { tts: _i.tts }
David Tolnay2ae520a2017-12-29 11:19:50 -05002822}
David Tolnay440fe582019-02-15 20:23:14 -08002823#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002824pub fn fold_un_op<V: Fold + ?Sized>(_visitor: &mut V, _i: UnOp) -> UnOp {
Nika Layzell27726662017-10-24 23:16:35 -04002825 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002826 UnOp::Deref(_binding_0) => {
David Tolnay7ac699c2018-08-24 14:00:58 -04002827 UnOp::Deref(Token ! [ * ](tokens_helper(_visitor, &_binding_0.spans)))
Nika Layzell27726662017-10-24 23:16:35 -04002828 }
David Tolnay7ac699c2018-08-24 14:00:58 -04002829 UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(_visitor, &_binding_0.spans))),
2830 UnOp::Neg(_binding_0) => {
2831 UnOp::Neg(Token ! [ - ](tokens_helper(_visitor, &_binding_0.spans)))
2832 }
Nika Layzell27726662017-10-24 23:16:35 -04002833 }
2834}
David Tolnay8c81f622018-07-31 23:34:35 -07002835#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002836pub fn fold_use_glob<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGlob) -> UseGlob {
David Tolnay5f332a92017-12-26 00:42:45 -05002837 UseGlob {
David Tolnay7ac699c2018-08-24 14:00:58 -04002838 star_token: Token ! [ * ](tokens_helper(_visitor, &_i.star_token.spans)),
David Tolnay5f332a92017-12-26 00:42:45 -05002839 }
2840}
David Tolnay8c81f622018-07-31 23:34:35 -07002841#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002842pub fn fold_use_group<V: Fold + ?Sized>(_visitor: &mut V, _i: UseGroup) -> UseGroup {
2843 UseGroup {
David Tolnay7ac699c2018-08-24 14:00:58 -04002844 brace_token: Brace(tokens_helper(_visitor, &_i.brace_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002845 items: FoldHelper::lift(_i.items, |it| _visitor.fold_use_tree(it)),
David Tolnay5f332a92017-12-26 00:42:45 -05002846 }
2847}
David Tolnay8c81f622018-07-31 23:34:35 -07002848#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002849pub fn fold_use_name<V: Fold + ?Sized>(_visitor: &mut V, _i: UseName) -> UseName {
2850 UseName {
David Tolnay8c81f622018-07-31 23:34:35 -07002851 ident: _visitor.fold_ident(_i.ident),
David Tolnayd97a7d22018-03-31 19:17:01 +02002852 }
2853}
David Tolnay8c81f622018-07-31 23:34:35 -07002854#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002855pub fn fold_use_path<V: Fold + ?Sized>(_visitor: &mut V, _i: UsePath) -> UsePath {
David Tolnay5f332a92017-12-26 00:42:45 -05002856 UsePath {
David Tolnay8c81f622018-07-31 23:34:35 -07002857 ident: _visitor.fold_ident(_i.ident),
David Tolnay7ac699c2018-08-24 14:00:58 -04002858 colon2_token: Token ! [ :: ](tokens_helper(_visitor, &_i.colon2_token.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002859 tree: Box::new(_visitor.fold_use_tree(*_i.tree)),
David Tolnayd97a7d22018-03-31 19:17:01 +02002860 }
2861}
David Tolnay8c81f622018-07-31 23:34:35 -07002862#[cfg(feature = "full")]
David Tolnayd97a7d22018-03-31 19:17:01 +02002863pub fn fold_use_rename<V: Fold + ?Sized>(_visitor: &mut V, _i: UseRename) -> UseRename {
2864 UseRename {
David Tolnay8c81f622018-07-31 23:34:35 -07002865 ident: _visitor.fold_ident(_i.ident),
David Tolnay905ef2b2019-02-11 02:28:22 +01002866 as_token: Token![as](tokens_helper(_visitor, &_i.as_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002867 rename: _visitor.fold_ident(_i.rename),
David Tolnay5f332a92017-12-26 00:42:45 -05002868 }
2869}
David Tolnay8c81f622018-07-31 23:34:35 -07002870#[cfg(feature = "full")]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002871pub fn fold_use_tree<V: Fold + ?Sized>(_visitor: &mut V, _i: UseTree) -> UseTree {
David Tolnay5f332a92017-12-26 00:42:45 -05002872 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002873 UseTree::Path(_binding_0) => UseTree::Path(_visitor.fold_use_path(_binding_0)),
2874 UseTree::Name(_binding_0) => UseTree::Name(_visitor.fold_use_name(_binding_0)),
2875 UseTree::Rename(_binding_0) => UseTree::Rename(_visitor.fold_use_rename(_binding_0)),
2876 UseTree::Glob(_binding_0) => UseTree::Glob(_visitor.fold_use_glob(_binding_0)),
2877 UseTree::Group(_binding_0) => UseTree::Group(_visitor.fold_use_group(_binding_0)),
David Tolnay5f332a92017-12-26 00:42:45 -05002878 }
2879}
David Tolnay440fe582019-02-15 20:23:14 -08002880#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002881pub fn fold_variant<V: Fold + ?Sized>(_visitor: &mut V, _i: Variant) -> Variant {
Nika Layzell27726662017-10-24 23:16:35 -04002882 Variant {
David Tolnay8c81f622018-07-31 23:34:35 -07002883 attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)),
2884 ident: _visitor.fold_ident(_i.ident),
2885 fields: _visitor.fold_fields(_i.fields),
2886 discriminant: (_i.discriminant).map(|it| {
2887 (
David Tolnay7ac699c2018-08-24 14:00:58 -04002888 Token ! [ = ](tokens_helper(_visitor, &(it).0.spans)),
David Tolnay8c81f622018-07-31 23:34:35 -07002889 _visitor.fold_expr((it).1),
2890 )
2891 }),
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_vis_crate<V: Fold + ?Sized>(_visitor: &mut V, _i: VisCrate) -> VisCrate {
Nika Layzell27726662017-10-24 23:16:35 -04002896 VisCrate {
David Tolnay7ac699c2018-08-24 14:00:58 -04002897 crate_token: Token![crate](tokens_helper(_visitor, &_i.crate_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002898 }
2899}
David Tolnay440fe582019-02-15 20:23:14 -08002900#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002901pub fn fold_vis_public<V: Fold + ?Sized>(_visitor: &mut V, _i: VisPublic) -> VisPublic {
Nika Layzell27726662017-10-24 23:16:35 -04002902 VisPublic {
David Tolnay905ef2b2019-02-11 02:28:22 +01002903 pub_token: Token![pub](tokens_helper(_visitor, &_i.pub_token.span)),
Nika Layzell27726662017-10-24 23:16:35 -04002904 }
2905}
David Tolnay440fe582019-02-15 20:23:14 -08002906#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002907pub fn fold_vis_restricted<V: Fold + ?Sized>(_visitor: &mut V, _i: VisRestricted) -> VisRestricted {
Nika Layzell27726662017-10-24 23:16:35 -04002908 VisRestricted {
David Tolnay905ef2b2019-02-11 02:28:22 +01002909 pub_token: Token![pub](tokens_helper(_visitor, &_i.pub_token.span)),
David Tolnay7ac699c2018-08-24 14:00:58 -04002910 paren_token: Paren(tokens_helper(_visitor, &_i.paren_token.span)),
David Tolnay905ef2b2019-02-11 02:28:22 +01002911 in_token: (_i.in_token).map(|it| Token![in](tokens_helper(_visitor, &it.span))),
David Tolnay8c81f622018-07-31 23:34:35 -07002912 path: Box::new(_visitor.fold_path(*_i.path)),
Nika Layzell27726662017-10-24 23:16:35 -04002913 }
2914}
David Tolnay440fe582019-02-15 20:23:14 -08002915#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002916pub fn fold_visibility<V: Fold + ?Sized>(_visitor: &mut V, _i: Visibility) -> Visibility {
Nika Layzell27726662017-10-24 23:16:35 -04002917 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002918 Visibility::Public(_binding_0) => Visibility::Public(_visitor.fold_vis_public(_binding_0)),
2919 Visibility::Crate(_binding_0) => Visibility::Crate(_visitor.fold_vis_crate(_binding_0)),
2920 Visibility::Restricted(_binding_0) => {
2921 Visibility::Restricted(_visitor.fold_vis_restricted(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002922 }
David Tolnay8c81f622018-07-31 23:34:35 -07002923 Visibility::Inherited => Visibility::Inherited,
Nika Layzell27726662017-10-24 23:16:35 -04002924 }
2925}
David Tolnay440fe582019-02-15 20:23:14 -08002926#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay4b4c4b62018-01-06 13:48:05 -08002927pub fn fold_where_clause<V: Fold + ?Sized>(_visitor: &mut V, _i: WhereClause) -> WhereClause {
Nika Layzell27726662017-10-24 23:16:35 -04002928 WhereClause {
David Tolnay905ef2b2019-02-11 02:28:22 +01002929 where_token: Token![where](tokens_helper(_visitor, &_i.where_token.span)),
David Tolnay8c81f622018-07-31 23:34:35 -07002930 predicates: FoldHelper::lift(_i.predicates, |it| _visitor.fold_where_predicate(it)),
Nika Layzell27726662017-10-24 23:16:35 -04002931 }
2932}
David Tolnay440fe582019-02-15 20:23:14 -08002933#[cfg(any(feature = "derive", feature = "full"))]
David Tolnay8c81f622018-07-31 23:34:35 -07002934pub fn fold_where_predicate<V: Fold + ?Sized>(
2935 _visitor: &mut V,
2936 _i: WherePredicate,
2937) -> WherePredicate {
Nika Layzell27726662017-10-24 23:16:35 -04002938 match _i {
David Tolnay8c81f622018-07-31 23:34:35 -07002939 WherePredicate::Type(_binding_0) => {
2940 WherePredicate::Type(_visitor.fold_predicate_type(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002941 }
David Tolnay8c81f622018-07-31 23:34:35 -07002942 WherePredicate::Lifetime(_binding_0) => {
2943 WherePredicate::Lifetime(_visitor.fold_predicate_lifetime(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002944 }
David Tolnay8c81f622018-07-31 23:34:35 -07002945 WherePredicate::Eq(_binding_0) => {
2946 WherePredicate::Eq(_visitor.fold_predicate_eq(_binding_0))
Nika Layzell27726662017-10-24 23:16:35 -04002947 }
2948 }
2949}
Carl Lerchecbf7cc12019-02-15 14:09:31 -08002950pub fn fold_span<V: Fold + ?Sized>(_visitor: &mut V, _i: Span) -> Span {
2951 _i
2952}
2953pub fn fold_ident<V: Fold + ?Sized>(_visitor: &mut V, _i: Ident) -> Ident {
2954 let mut _i = _i;
2955 let span = _visitor.fold_span(_i.span());
2956 _i.set_span(span);
2957 _i
2958}