Debian Codegraph @

.cargo/vendor/syn/src/gen/fold.rs

raw
1 // This file is @generated by syn-internal-codegen.
2 // It is not intended for manual editing.
3
4 #![allow(unreachable_code, unused_variables)]
5 #![allow(
6 clippy::match_wildcard_for_single_variants,
7 clippy::needless_match,
8 clippy::needless_pass_by_ref_mut,
9 )]
10 #[cfg(feature = "full")]
11 macro_rules! full {
12 ($e:expr) => {
13 $e
14 };
15 }
16 #[cfg(all(feature = "derive", not(feature = "full")))]
17 macro_rules! full {
18 ($e:expr) => {
19 unreachable!()
20 };
21 }
22 /// Syntax tree traversal to transform the nodes of an owned syntax tree.
23 ///
24 /// See the [module documentation] for details.
25 ///
26 /// [module documentation]: self
27 pub trait Fold {
28 #[cfg(any(feature = "derive", feature = "full"))]
29 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
30 fn fold_abi(&mut self, i: crate::Abi) -> crate::Abi {
31 fold_abi(self, i)
32 }
33 #[cfg(any(feature = "derive", feature = "full"))]
34 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
35 fn fold_angle_bracketed_generic_arguments(
36 &mut self,
37 i: crate::AngleBracketedGenericArguments,
38 ) -> crate::AngleBracketedGenericArguments {
39 fold_angle_bracketed_generic_arguments(self, i)
40 }
41 #[cfg(feature = "full")]
42 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
43 fn fold_arm(&mut self, i: crate::Arm) -> crate::Arm {
44 fold_arm(self, i)
45 }
46 #[cfg(any(feature = "derive", feature = "full"))]
47 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
48 fn fold_assoc_const(&mut self, i: crate::AssocConst) -> crate::AssocConst {
49 fold_assoc_const(self, i)
50 }
51 #[cfg(any(feature = "derive", feature = "full"))]
52 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
53 fn fold_assoc_type(&mut self, i: crate::AssocType) -> crate::AssocType {
54 fold_assoc_type(self, i)
55 }
56 #[cfg(any(feature = "derive", feature = "full"))]
57 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
58 fn fold_attr_style(&mut self, i: crate::AttrStyle) -> crate::AttrStyle {
59 fold_attr_style(self, i)
60 }
61 #[cfg(any(feature = "derive", feature = "full"))]
62 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
63 fn fold_attribute(&mut self, i: crate::Attribute) -> crate::Attribute {
64 fold_attribute(self, i)
65 }
66 #[cfg(any(feature = "derive", feature = "full"))]
67 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
68 fn fold_attributes(&mut self, i: Vec<crate::Attribute>) -> Vec<crate::Attribute> {
69 fold_vec(i, self, Self::fold_attribute)
70 }
71 #[cfg(any(feature = "derive", feature = "full"))]
72 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
73 fn fold_bare_fn_arg(&mut self, i: crate::BareFnArg) -> crate::BareFnArg {
74 fold_bare_fn_arg(self, i)
75 }
76 #[cfg(any(feature = "derive", feature = "full"))]
77 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
78 fn fold_bare_variadic(&mut self, i: crate::BareVariadic) -> crate::BareVariadic {
79 fold_bare_variadic(self, i)
80 }
81 #[cfg(any(feature = "derive", feature = "full"))]
82 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
83 fn fold_bin_op(&mut self, i: crate::BinOp) -> crate::BinOp {
84 fold_bin_op(self, i)
85 }
86 #[cfg(feature = "full")]
87 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
88 fn fold_block(&mut self, i: crate::Block) -> crate::Block {
89 fold_block(self, i)
90 }
91 #[cfg(any(feature = "derive", feature = "full"))]
92 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
93 fn fold_bound_lifetimes(
94 &mut self,
95 i: crate::BoundLifetimes,
96 ) -> crate::BoundLifetimes {
97 fold_bound_lifetimes(self, i)
98 }
99 #[cfg(feature = "full")]
100 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
101 fn fold_captured_param(&mut self, i: crate::CapturedParam) -> crate::CapturedParam {
102 fold_captured_param(self, i)
103 }
104 #[cfg(any(feature = "derive", feature = "full"))]
105 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
106 fn fold_const_param(&mut self, i: crate::ConstParam) -> crate::ConstParam {
107 fold_const_param(self, i)
108 }
109 #[cfg(any(feature = "derive", feature = "full"))]
110 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
111 fn fold_constraint(&mut self, i: crate::Constraint) -> crate::Constraint {
112 fold_constraint(self, i)
113 }
114 #[cfg(feature = "derive")]
115 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
116 fn fold_data(&mut self, i: crate::Data) -> crate::Data {
117 fold_data(self, i)
118 }
119 #[cfg(feature = "derive")]
120 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
121 fn fold_data_enum(&mut self, i: crate::DataEnum) -> crate::DataEnum {
122 fold_data_enum(self, i)
123 }
124 #[cfg(feature = "derive")]
125 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
126 fn fold_data_struct(&mut self, i: crate::DataStruct) -> crate::DataStruct {
127 fold_data_struct(self, i)
128 }
129 #[cfg(feature = "derive")]
130 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
131 fn fold_data_union(&mut self, i: crate::DataUnion) -> crate::DataUnion {
132 fold_data_union(self, i)
133 }
134 #[cfg(feature = "derive")]
135 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
136 fn fold_derive_input(&mut self, i: crate::DeriveInput) -> crate::DeriveInput {
137 fold_derive_input(self, i)
138 }
139 #[cfg(any(feature = "derive", feature = "full"))]
140 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
141 fn fold_expr(&mut self, i: crate::Expr) -> crate::Expr {
142 fold_expr(self, i)
143 }
144 #[cfg(feature = "full")]
145 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
146 fn fold_expr_array(&mut self, i: crate::ExprArray) -> crate::ExprArray {
147 fold_expr_array(self, i)
148 }
149 #[cfg(feature = "full")]
150 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
151 fn fold_expr_assign(&mut self, i: crate::ExprAssign) -> crate::ExprAssign {
152 fold_expr_assign(self, i)
153 }
154 #[cfg(feature = "full")]
155 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
156 fn fold_expr_async(&mut self, i: crate::ExprAsync) -> crate::ExprAsync {
157 fold_expr_async(self, i)
158 }
159 #[cfg(feature = "full")]
160 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
161 fn fold_expr_await(&mut self, i: crate::ExprAwait) -> crate::ExprAwait {
162 fold_expr_await(self, i)
163 }
164 #[cfg(any(feature = "derive", feature = "full"))]
165 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
166 fn fold_expr_binary(&mut self, i: crate::ExprBinary) -> crate::ExprBinary {
167 fold_expr_binary(self, i)
168 }
169 #[cfg(feature = "full")]
170 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
171 fn fold_expr_block(&mut self, i: crate::ExprBlock) -> crate::ExprBlock {
172 fold_expr_block(self, i)
173 }
174 #[cfg(feature = "full")]
175 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
176 fn fold_expr_break(&mut self, i: crate::ExprBreak) -> crate::ExprBreak {
177 fold_expr_break(self, i)
178 }
179 #[cfg(any(feature = "derive", feature = "full"))]
180 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
181 fn fold_expr_call(&mut self, i: crate::ExprCall) -> crate::ExprCall {
182 fold_expr_call(self, i)
183 }
184 #[cfg(any(feature = "derive", feature = "full"))]
185 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
186 fn fold_expr_cast(&mut self, i: crate::ExprCast) -> crate::ExprCast {
187 fold_expr_cast(self, i)
188 }
189 #[cfg(feature = "full")]
190 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
191 fn fold_expr_closure(&mut self, i: crate::ExprClosure) -> crate::ExprClosure {
192 fold_expr_closure(self, i)
193 }
194 #[cfg(feature = "full")]
195 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
196 fn fold_expr_const(&mut self, i: crate::ExprConst) -> crate::ExprConst {
197 fold_expr_const(self, i)
198 }
199 #[cfg(feature = "full")]
200 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
201 fn fold_expr_continue(&mut self, i: crate::ExprContinue) -> crate::ExprContinue {
202 fold_expr_continue(self, i)
203 }
204 #[cfg(any(feature = "derive", feature = "full"))]
205 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
206 fn fold_expr_field(&mut self, i: crate::ExprField) -> crate::ExprField {
207 fold_expr_field(self, i)
208 }
209 #[cfg(feature = "full")]
210 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
211 fn fold_expr_for_loop(&mut self, i: crate::ExprForLoop) -> crate::ExprForLoop {
212 fold_expr_for_loop(self, i)
213 }
214 #[cfg(any(feature = "derive", feature = "full"))]
215 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
216 fn fold_expr_group(&mut self, i: crate::ExprGroup) -> crate::ExprGroup {
217 fold_expr_group(self, i)
218 }
219 #[cfg(feature = "full")]
220 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
221 fn fold_expr_if(&mut self, i: crate::ExprIf) -> crate::ExprIf {
222 fold_expr_if(self, i)
223 }
224 #[cfg(any(feature = "derive", feature = "full"))]
225 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
226 fn fold_expr_index(&mut self, i: crate::ExprIndex) -> crate::ExprIndex {
227 fold_expr_index(self, i)
228 }
229 #[cfg(feature = "full")]
230 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
231 fn fold_expr_infer(&mut self, i: crate::ExprInfer) -> crate::ExprInfer {
232 fold_expr_infer(self, i)
233 }
234 #[cfg(feature = "full")]
235 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
236 fn fold_expr_let(&mut self, i: crate::ExprLet) -> crate::ExprLet {
237 fold_expr_let(self, i)
238 }
239 #[cfg(any(feature = "derive", feature = "full"))]
240 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
241 fn fold_expr_lit(&mut self, i: crate::ExprLit) -> crate::ExprLit {
242 fold_expr_lit(self, i)
243 }
244 #[cfg(feature = "full")]
245 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
246 fn fold_expr_loop(&mut self, i: crate::ExprLoop) -> crate::ExprLoop {
247 fold_expr_loop(self, i)
248 }
249 #[cfg(any(feature = "derive", feature = "full"))]
250 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
251 fn fold_expr_macro(&mut self, i: crate::ExprMacro) -> crate::ExprMacro {
252 fold_expr_macro(self, i)
253 }
254 #[cfg(feature = "full")]
255 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
256 fn fold_expr_match(&mut self, i: crate::ExprMatch) -> crate::ExprMatch {
257 fold_expr_match(self, i)
258 }
259 #[cfg(any(feature = "derive", feature = "full"))]
260 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
261 fn fold_expr_method_call(
262 &mut self,
263 i: crate::ExprMethodCall,
264 ) -> crate::ExprMethodCall {
265 fold_expr_method_call(self, i)
266 }
267 #[cfg(any(feature = "derive", feature = "full"))]
268 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
269 fn fold_expr_paren(&mut self, i: crate::ExprParen) -> crate::ExprParen {
270 fold_expr_paren(self, i)
271 }
272 #[cfg(any(feature = "derive", feature = "full"))]
273 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
274 fn fold_expr_path(&mut self, i: crate::ExprPath) -> crate::ExprPath {
275 fold_expr_path(self, i)
276 }
277 #[cfg(feature = "full")]
278 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
279 fn fold_expr_range(&mut self, i: crate::ExprRange) -> crate::ExprRange {
280 fold_expr_range(self, i)
281 }
282 #[cfg(feature = "full")]
283 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
284 fn fold_expr_raw_addr(&mut self, i: crate::ExprRawAddr) -> crate::ExprRawAddr {
285 fold_expr_raw_addr(self, i)
286 }
287 #[cfg(any(feature = "derive", feature = "full"))]
288 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
289 fn fold_expr_reference(&mut self, i: crate::ExprReference) -> crate::ExprReference {
290 fold_expr_reference(self, i)
291 }
292 #[cfg(feature = "full")]
293 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
294 fn fold_expr_repeat(&mut self, i: crate::ExprRepeat) -> crate::ExprRepeat {
295 fold_expr_repeat(self, i)
296 }
297 #[cfg(feature = "full")]
298 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
299 fn fold_expr_return(&mut self, i: crate::ExprReturn) -> crate::ExprReturn {
300 fold_expr_return(self, i)
301 }
302 #[cfg(any(feature = "derive", feature = "full"))]
303 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
304 fn fold_expr_struct(&mut self, i: crate::ExprStruct) -> crate::ExprStruct {
305 fold_expr_struct(self, i)
306 }
307 #[cfg(feature = "full")]
308 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
309 fn fold_expr_try(&mut self, i: crate::ExprTry) -> crate::ExprTry {
310 fold_expr_try(self, i)
311 }
312 #[cfg(feature = "full")]
313 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
314 fn fold_expr_try_block(&mut self, i: crate::ExprTryBlock) -> crate::ExprTryBlock {
315 fold_expr_try_block(self, i)
316 }
317 #[cfg(any(feature = "derive", feature = "full"))]
318 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
319 fn fold_expr_tuple(&mut self, i: crate::ExprTuple) -> crate::ExprTuple {
320 fold_expr_tuple(self, i)
321 }
322 #[cfg(any(feature = "derive", feature = "full"))]
323 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
324 fn fold_expr_unary(&mut self, i: crate::ExprUnary) -> crate::ExprUnary {
325 fold_expr_unary(self, i)
326 }
327 #[cfg(feature = "full")]
328 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
329 fn fold_expr_unsafe(&mut self, i: crate::ExprUnsafe) -> crate::ExprUnsafe {
330 fold_expr_unsafe(self, i)
331 }
332 #[cfg(feature = "full")]
333 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
334 fn fold_expr_while(&mut self, i: crate::ExprWhile) -> crate::ExprWhile {
335 fold_expr_while(self, i)
336 }
337 #[cfg(feature = "full")]
338 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
339 fn fold_expr_yield(&mut self, i: crate::ExprYield) -> crate::ExprYield {
340 fold_expr_yield(self, i)
341 }
342 #[cfg(any(feature = "derive", feature = "full"))]
343 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
344 fn fold_field(&mut self, i: crate::Field) -> crate::Field {
345 fold_field(self, i)
346 }
347 #[cfg(any(feature = "derive", feature = "full"))]
348 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
349 fn fold_field_mutability(
350 &mut self,
351 i: crate::FieldMutability,
352 ) -> crate::FieldMutability {
353 fold_field_mutability(self, i)
354 }
355 #[cfg(feature = "full")]
356 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
357 fn fold_field_pat(&mut self, i: crate::FieldPat) -> crate::FieldPat {
358 fold_field_pat(self, i)
359 }
360 #[cfg(any(feature = "derive", feature = "full"))]
361 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
362 fn fold_field_value(&mut self, i: crate::FieldValue) -> crate::FieldValue {
363 fold_field_value(self, i)
364 }
365 #[cfg(any(feature = "derive", feature = "full"))]
366 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
367 fn fold_fields(&mut self, i: crate::Fields) -> crate::Fields {
368 fold_fields(self, i)
369 }
370 #[cfg(any(feature = "derive", feature = "full"))]
371 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
372 fn fold_fields_named(&mut self, i: crate::FieldsNamed) -> crate::FieldsNamed {
373 fold_fields_named(self, i)
374 }
375 #[cfg(any(feature = "derive", feature = "full"))]
376 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
377 fn fold_fields_unnamed(&mut self, i: crate::FieldsUnnamed) -> crate::FieldsUnnamed {
378 fold_fields_unnamed(self, i)
379 }
380 #[cfg(feature = "full")]
381 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
382 fn fold_file(&mut self, i: crate::File) -> crate::File {
383 fold_file(self, i)
384 }
385 #[cfg(feature = "full")]
386 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
387 fn fold_fn_arg(&mut self, i: crate::FnArg) -> crate::FnArg {
388 fold_fn_arg(self, i)
389 }
390 #[cfg(feature = "full")]
391 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
392 fn fold_foreign_item(&mut self, i: crate::ForeignItem) -> crate::ForeignItem {
393 fold_foreign_item(self, i)
394 }
395 #[cfg(feature = "full")]
396 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
397 fn fold_foreign_item_fn(&mut self, i: crate::ForeignItemFn) -> crate::ForeignItemFn {
398 fold_foreign_item_fn(self, i)
399 }
400 #[cfg(feature = "full")]
401 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
402 fn fold_foreign_item_macro(
403 &mut self,
404 i: crate::ForeignItemMacro,
405 ) -> crate::ForeignItemMacro {
406 fold_foreign_item_macro(self, i)
407 }
408 #[cfg(feature = "full")]
409 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
410 fn fold_foreign_item_static(
411 &mut self,
412 i: crate::ForeignItemStatic,
413 ) -> crate::ForeignItemStatic {
414 fold_foreign_item_static(self, i)
415 }
416 #[cfg(feature = "full")]
417 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
418 fn fold_foreign_item_type(
419 &mut self,
420 i: crate::ForeignItemType,
421 ) -> crate::ForeignItemType {
422 fold_foreign_item_type(self, i)
423 }
424 #[cfg(any(feature = "derive", feature = "full"))]
425 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
426 fn fold_generic_argument(
427 &mut self,
428 i: crate::GenericArgument,
429 ) -> crate::GenericArgument {
430 fold_generic_argument(self, i)
431 }
432 #[cfg(any(feature = "derive", feature = "full"))]
433 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
434 fn fold_generic_param(&mut self, i: crate::GenericParam) -> crate::GenericParam {
435 fold_generic_param(self, i)
436 }
437 #[cfg(any(feature = "derive", feature = "full"))]
438 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
439 fn fold_generics(&mut self, i: crate::Generics) -> crate::Generics {
440 fold_generics(self, i)
441 }
442 fn fold_ident(&mut self, i: proc_macro2::Ident) -> proc_macro2::Ident {
443 fold_ident(self, i)
444 }
445 #[cfg(feature = "full")]
446 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
447 fn fold_impl_item(&mut self, i: crate::ImplItem) -> crate::ImplItem {
448 fold_impl_item(self, i)
449 }
450 #[cfg(feature = "full")]
451 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
452 fn fold_impl_item_const(&mut self, i: crate::ImplItemConst) -> crate::ImplItemConst {
453 fold_impl_item_const(self, i)
454 }
455 #[cfg(feature = "full")]
456 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
457 fn fold_impl_item_fn(&mut self, i: crate::ImplItemFn) -> crate::ImplItemFn {
458 fold_impl_item_fn(self, i)
459 }
460 #[cfg(feature = "full")]
461 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
462 fn fold_impl_item_macro(&mut self, i: crate::ImplItemMacro) -> crate::ImplItemMacro {
463 fold_impl_item_macro(self, i)
464 }
465 #[cfg(feature = "full")]
466 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
467 fn fold_impl_item_type(&mut self, i: crate::ImplItemType) -> crate::ImplItemType {
468 fold_impl_item_type(self, i)
469 }
470 #[cfg(feature = "full")]
471 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
472 fn fold_impl_restriction(
473 &mut self,
474 i: crate::ImplRestriction,
475 ) -> crate::ImplRestriction {
476 fold_impl_restriction(self, i)
477 }
478 #[cfg(any(feature = "derive", feature = "full"))]
479 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
480 fn fold_index(&mut self, i: crate::Index) -> crate::Index {
481 fold_index(self, i)
482 }
483 #[cfg(feature = "full")]
484 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
485 fn fold_item(&mut self, i: crate::Item) -> crate::Item {
486 fold_item(self, i)
487 }
488 #[cfg(feature = "full")]
489 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
490 fn fold_item_const(&mut self, i: crate::ItemConst) -> crate::ItemConst {
491 fold_item_const(self, i)
492 }
493 #[cfg(feature = "full")]
494 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
495 fn fold_item_enum(&mut self, i: crate::ItemEnum) -> crate::ItemEnum {
496 fold_item_enum(self, i)
497 }
498 #[cfg(feature = "full")]
499 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
500 fn fold_item_extern_crate(
501 &mut self,
502 i: crate::ItemExternCrate,
503 ) -> crate::ItemExternCrate {
504 fold_item_extern_crate(self, i)
505 }
506 #[cfg(feature = "full")]
507 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
508 fn fold_item_fn(&mut self, i: crate::ItemFn) -> crate::ItemFn {
509 fold_item_fn(self, i)
510 }
511 #[cfg(feature = "full")]
512 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
513 fn fold_item_foreign_mod(
514 &mut self,
515 i: crate::ItemForeignMod,
516 ) -> crate::ItemForeignMod {
517 fold_item_foreign_mod(self, i)
518 }
519 #[cfg(feature = "full")]
520 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
521 fn fold_item_impl(&mut self, i: crate::ItemImpl) -> crate::ItemImpl {
522 fold_item_impl(self, i)
523 }
524 #[cfg(feature = "full")]
525 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
526 fn fold_item_macro(&mut self, i: crate::ItemMacro) -> crate::ItemMacro {
527 fold_item_macro(self, i)
528 }
529 #[cfg(feature = "full")]
530 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
531 fn fold_item_mod(&mut self, i: crate::ItemMod) -> crate::ItemMod {
532 fold_item_mod(self, i)
533 }
534 #[cfg(feature = "full")]
535 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
536 fn fold_item_static(&mut self, i: crate::ItemStatic) -> crate::ItemStatic {
537 fold_item_static(self, i)
538 }
539 #[cfg(feature = "full")]
540 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
541 fn fold_item_struct(&mut self, i: crate::ItemStruct) -> crate::ItemStruct {
542 fold_item_struct(self, i)
543 }
544 #[cfg(feature = "full")]
545 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
546 fn fold_item_trait(&mut self, i: crate::ItemTrait) -> crate::ItemTrait {
547 fold_item_trait(self, i)
548 }
549 #[cfg(feature = "full")]
550 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
551 fn fold_item_trait_alias(
552 &mut self,
553 i: crate::ItemTraitAlias,
554 ) -> crate::ItemTraitAlias {
555 fold_item_trait_alias(self, i)
556 }
557 #[cfg(feature = "full")]
558 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
559 fn fold_item_type(&mut self, i: crate::ItemType) -> crate::ItemType {
560 fold_item_type(self, i)
561 }
562 #[cfg(feature = "full")]
563 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
564 fn fold_item_union(&mut self, i: crate::ItemUnion) -> crate::ItemUnion {
565 fold_item_union(self, i)
566 }
567 #[cfg(feature = "full")]
568 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
569 fn fold_item_use(&mut self, i: crate::ItemUse) -> crate::ItemUse {
570 fold_item_use(self, i)
571 }
572 #[cfg(feature = "full")]
573 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
574 fn fold_label(&mut self, i: crate::Label) -> crate::Label {
575 fold_label(self, i)
576 }
577 fn fold_lifetime(&mut self, i: crate::Lifetime) -> crate::Lifetime {
578 fold_lifetime(self, i)
579 }
580 #[cfg(any(feature = "derive", feature = "full"))]
581 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
582 fn fold_lifetime_param(&mut self, i: crate::LifetimeParam) -> crate::LifetimeParam {
583 fold_lifetime_param(self, i)
584 }
585 fn fold_lit(&mut self, i: crate::Lit) -> crate::Lit {
586 fold_lit(self, i)
587 }
588 fn fold_lit_bool(&mut self, i: crate::LitBool) -> crate::LitBool {
589 fold_lit_bool(self, i)
590 }
591 fn fold_lit_byte(&mut self, i: crate::LitByte) -> crate::LitByte {
592 fold_lit_byte(self, i)
593 }
594 fn fold_lit_byte_str(&mut self, i: crate::LitByteStr) -> crate::LitByteStr {
595 fold_lit_byte_str(self, i)
596 }
597 fn fold_lit_cstr(&mut self, i: crate::LitCStr) -> crate::LitCStr {
598 fold_lit_cstr(self, i)
599 }
600 fn fold_lit_char(&mut self, i: crate::LitChar) -> crate::LitChar {
601 fold_lit_char(self, i)
602 }
603 fn fold_lit_float(&mut self, i: crate::LitFloat) -> crate::LitFloat {
604 fold_lit_float(self, i)
605 }
606 fn fold_lit_int(&mut self, i: crate::LitInt) -> crate::LitInt {
607 fold_lit_int(self, i)
608 }
609 fn fold_lit_str(&mut self, i: crate::LitStr) -> crate::LitStr {
610 fold_lit_str(self, i)
611 }
612 #[cfg(feature = "full")]
613 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
614 fn fold_local(&mut self, i: crate::Local) -> crate::Local {
615 fold_local(self, i)
616 }
617 #[cfg(feature = "full")]
618 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
619 fn fold_local_init(&mut self, i: crate::LocalInit) -> crate::LocalInit {
620 fold_local_init(self, i)
621 }
622 #[cfg(any(feature = "derive", feature = "full"))]
623 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
624 fn fold_macro(&mut self, i: crate::Macro) -> crate::Macro {
625 fold_macro(self, i)
626 }
627 #[cfg(any(feature = "derive", feature = "full"))]
628 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
629 fn fold_macro_delimiter(
630 &mut self,
631 i: crate::MacroDelimiter,
632 ) -> crate::MacroDelimiter {
633 fold_macro_delimiter(self, i)
634 }
635 #[cfg(any(feature = "derive", feature = "full"))]
636 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
637 fn fold_member(&mut self, i: crate::Member) -> crate::Member {
638 fold_member(self, i)
639 }
640 #[cfg(any(feature = "derive", feature = "full"))]
641 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
642 fn fold_meta(&mut self, i: crate::Meta) -> crate::Meta {
643 fold_meta(self, i)
644 }
645 #[cfg(any(feature = "derive", feature = "full"))]
646 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
647 fn fold_meta_list(&mut self, i: crate::MetaList) -> crate::MetaList {
648 fold_meta_list(self, i)
649 }
650 #[cfg(any(feature = "derive", feature = "full"))]
651 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
652 fn fold_meta_name_value(&mut self, i: crate::MetaNameValue) -> crate::MetaNameValue {
653 fold_meta_name_value(self, i)
654 }
655 #[cfg(any(feature = "derive", feature = "full"))]
656 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
657 fn fold_parenthesized_generic_arguments(
658 &mut self,
659 i: crate::ParenthesizedGenericArguments,
660 ) -> crate::ParenthesizedGenericArguments {
661 fold_parenthesized_generic_arguments(self, i)
662 }
663 #[cfg(feature = "full")]
664 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
665 fn fold_pat(&mut self, i: crate::Pat) -> crate::Pat {
666 fold_pat(self, i)
667 }
668 #[cfg(feature = "full")]
669 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
670 fn fold_pat_ident(&mut self, i: crate::PatIdent) -> crate::PatIdent {
671 fold_pat_ident(self, i)
672 }
673 #[cfg(feature = "full")]
674 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
675 fn fold_pat_or(&mut self, i: crate::PatOr) -> crate::PatOr {
676 fold_pat_or(self, i)
677 }
678 #[cfg(feature = "full")]
679 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
680 fn fold_pat_paren(&mut self, i: crate::PatParen) -> crate::PatParen {
681 fold_pat_paren(self, i)
682 }
683 #[cfg(feature = "full")]
684 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
685 fn fold_pat_reference(&mut self, i: crate::PatReference) -> crate::PatReference {
686 fold_pat_reference(self, i)
687 }
688 #[cfg(feature = "full")]
689 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
690 fn fold_pat_rest(&mut self, i: crate::PatRest) -> crate::PatRest {
691 fold_pat_rest(self, i)
692 }
693 #[cfg(feature = "full")]
694 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
695 fn fold_pat_slice(&mut self, i: crate::PatSlice) -> crate::PatSlice {
696 fold_pat_slice(self, i)
697 }
698 #[cfg(feature = "full")]
699 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
700 fn fold_pat_struct(&mut self, i: crate::PatStruct) -> crate::PatStruct {
701 fold_pat_struct(self, i)
702 }
703 #[cfg(feature = "full")]
704 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
705 fn fold_pat_tuple(&mut self, i: crate::PatTuple) -> crate::PatTuple {
706 fold_pat_tuple(self, i)
707 }
708 #[cfg(feature = "full")]
709 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
710 fn fold_pat_tuple_struct(
711 &mut self,
712 i: crate::PatTupleStruct,
713 ) -> crate::PatTupleStruct {
714 fold_pat_tuple_struct(self, i)
715 }
716 #[cfg(feature = "full")]
717 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
718 fn fold_pat_type(&mut self, i: crate::PatType) -> crate::PatType {
719 fold_pat_type(self, i)
720 }
721 #[cfg(feature = "full")]
722 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
723 fn fold_pat_wild(&mut self, i: crate::PatWild) -> crate::PatWild {
724 fold_pat_wild(self, i)
725 }
726 #[cfg(any(feature = "derive", feature = "full"))]
727 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
728 fn fold_path(&mut self, i: crate::Path) -> crate::Path {
729 fold_path(self, i)
730 }
731 #[cfg(any(feature = "derive", feature = "full"))]
732 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
733 fn fold_path_arguments(&mut self, i: crate::PathArguments) -> crate::PathArguments {
734 fold_path_arguments(self, i)
735 }
736 #[cfg(any(feature = "derive", feature = "full"))]
737 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
738 fn fold_path_segment(&mut self, i: crate::PathSegment) -> crate::PathSegment {
739 fold_path_segment(self, i)
740 }
741 #[cfg(feature = "full")]
742 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
743 fn fold_pointer_mutability(
744 &mut self,
745 i: crate::PointerMutability,
746 ) -> crate::PointerMutability {
747 fold_pointer_mutability(self, i)
748 }
749 #[cfg(feature = "full")]
750 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
751 fn fold_precise_capture(
752 &mut self,
753 i: crate::PreciseCapture,
754 ) -> crate::PreciseCapture {
755 fold_precise_capture(self, i)
756 }
757 #[cfg(any(feature = "derive", feature = "full"))]
758 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
759 fn fold_predicate_lifetime(
760 &mut self,
761 i: crate::PredicateLifetime,
762 ) -> crate::PredicateLifetime {
763 fold_predicate_lifetime(self, i)
764 }
765 #[cfg(any(feature = "derive", feature = "full"))]
766 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
767 fn fold_predicate_type(&mut self, i: crate::PredicateType) -> crate::PredicateType {
768 fold_predicate_type(self, i)
769 }
770 #[cfg(any(feature = "derive", feature = "full"))]
771 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
772 fn fold_qself(&mut self, i: crate::QSelf) -> crate::QSelf {
773 fold_qself(self, i)
774 }
775 #[cfg(feature = "full")]
776 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
777 fn fold_range_limits(&mut self, i: crate::RangeLimits) -> crate::RangeLimits {
778 fold_range_limits(self, i)
779 }
780 #[cfg(feature = "full")]
781 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
782 fn fold_receiver(&mut self, i: crate::Receiver) -> crate::Receiver {
783 fold_receiver(self, i)
784 }
785 #[cfg(any(feature = "derive", feature = "full"))]
786 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
787 fn fold_return_type(&mut self, i: crate::ReturnType) -> crate::ReturnType {
788 fold_return_type(self, i)
789 }
790 #[cfg(feature = "full")]
791 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
792 fn fold_signature(&mut self, i: crate::Signature) -> crate::Signature {
793 fold_signature(self, i)
794 }
795 fn fold_span(&mut self, i: proc_macro2::Span) -> proc_macro2::Span {
796 i
797 }
798 #[cfg(feature = "full")]
799 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
800 fn fold_static_mutability(
801 &mut self,
802 i: crate::StaticMutability,
803 ) -> crate::StaticMutability {
804 fold_static_mutability(self, i)
805 }
806 #[cfg(feature = "full")]
807 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
808 fn fold_stmt(&mut self, i: crate::Stmt) -> crate::Stmt {
809 fold_stmt(self, i)
810 }
811 #[cfg(feature = "full")]
812 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
813 fn fold_stmt_macro(&mut self, i: crate::StmtMacro) -> crate::StmtMacro {
814 fold_stmt_macro(self, i)
815 }
816 fn fold_token_stream(
817 &mut self,
818 i: proc_macro2::TokenStream,
819 ) -> proc_macro2::TokenStream {
820 i
821 }
822 #[cfg(any(feature = "derive", feature = "full"))]
823 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
824 fn fold_trait_bound(&mut self, i: crate::TraitBound) -> crate::TraitBound {
825 fold_trait_bound(self, i)
826 }
827 #[cfg(any(feature = "derive", feature = "full"))]
828 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
829 fn fold_trait_bound_modifier(
830 &mut self,
831 i: crate::TraitBoundModifier,
832 ) -> crate::TraitBoundModifier {
833 fold_trait_bound_modifier(self, i)
834 }
835 #[cfg(feature = "full")]
836 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
837 fn fold_trait_item(&mut self, i: crate::TraitItem) -> crate::TraitItem {
838 fold_trait_item(self, i)
839 }
840 #[cfg(feature = "full")]
841 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
842 fn fold_trait_item_const(
843 &mut self,
844 i: crate::TraitItemConst,
845 ) -> crate::TraitItemConst {
846 fold_trait_item_const(self, i)
847 }
848 #[cfg(feature = "full")]
849 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
850 fn fold_trait_item_fn(&mut self, i: crate::TraitItemFn) -> crate::TraitItemFn {
851 fold_trait_item_fn(self, i)
852 }
853 #[cfg(feature = "full")]
854 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
855 fn fold_trait_item_macro(
856 &mut self,
857 i: crate::TraitItemMacro,
858 ) -> crate::TraitItemMacro {
859 fold_trait_item_macro(self, i)
860 }
861 #[cfg(feature = "full")]
862 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
863 fn fold_trait_item_type(&mut self, i: crate::TraitItemType) -> crate::TraitItemType {
864 fold_trait_item_type(self, i)
865 }
866 #[cfg(any(feature = "derive", feature = "full"))]
867 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
868 fn fold_type(&mut self, i: crate::Type) -> crate::Type {
869 fold_type(self, i)
870 }
871 #[cfg(any(feature = "derive", feature = "full"))]
872 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
873 fn fold_type_array(&mut self, i: crate::TypeArray) -> crate::TypeArray {
874 fold_type_array(self, i)
875 }
876 #[cfg(any(feature = "derive", feature = "full"))]
877 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
878 fn fold_type_bare_fn(&mut self, i: crate::TypeBareFn) -> crate::TypeBareFn {
879 fold_type_bare_fn(self, i)
880 }
881 #[cfg(any(feature = "derive", feature = "full"))]
882 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
883 fn fold_type_group(&mut self, i: crate::TypeGroup) -> crate::TypeGroup {
884 fold_type_group(self, i)
885 }
886 #[cfg(any(feature = "derive", feature = "full"))]
887 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
888 fn fold_type_impl_trait(&mut self, i: crate::TypeImplTrait) -> crate::TypeImplTrait {
889 fold_type_impl_trait(self, i)
890 }
891 #[cfg(any(feature = "derive", feature = "full"))]
892 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
893 fn fold_type_infer(&mut self, i: crate::TypeInfer) -> crate::TypeInfer {
894 fold_type_infer(self, i)
895 }
896 #[cfg(any(feature = "derive", feature = "full"))]
897 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
898 fn fold_type_macro(&mut self, i: crate::TypeMacro) -> crate::TypeMacro {
899 fold_type_macro(self, i)
900 }
901 #[cfg(any(feature = "derive", feature = "full"))]
902 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
903 fn fold_type_never(&mut self, i: crate::TypeNever) -> crate::TypeNever {
904 fold_type_never(self, i)
905 }
906 #[cfg(any(feature = "derive", feature = "full"))]
907 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
908 fn fold_type_param(&mut self, i: crate::TypeParam) -> crate::TypeParam {
909 fold_type_param(self, i)
910 }
911 #[cfg(any(feature = "derive", feature = "full"))]
912 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
913 fn fold_type_param_bound(
914 &mut self,
915 i: crate::TypeParamBound,
916 ) -> crate::TypeParamBound {
917 fold_type_param_bound(self, i)
918 }
919 #[cfg(any(feature = "derive", feature = "full"))]
920 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
921 fn fold_type_paren(&mut self, i: crate::TypeParen) -> crate::TypeParen {
922 fold_type_paren(self, i)
923 }
924 #[cfg(any(feature = "derive", feature = "full"))]
925 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
926 fn fold_type_path(&mut self, i: crate::TypePath) -> crate::TypePath {
927 fold_type_path(self, i)
928 }
929 #[cfg(any(feature = "derive", feature = "full"))]
930 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
931 fn fold_type_ptr(&mut self, i: crate::TypePtr) -> crate::TypePtr {
932 fold_type_ptr(self, i)
933 }
934 #[cfg(any(feature = "derive", feature = "full"))]
935 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
936 fn fold_type_reference(&mut self, i: crate::TypeReference) -> crate::TypeReference {
937 fold_type_reference(self, i)
938 }
939 #[cfg(any(feature = "derive", feature = "full"))]
940 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
941 fn fold_type_slice(&mut self, i: crate::TypeSlice) -> crate::TypeSlice {
942 fold_type_slice(self, i)
943 }
944 #[cfg(any(feature = "derive", feature = "full"))]
945 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
946 fn fold_type_trait_object(
947 &mut self,
948 i: crate::TypeTraitObject,
949 ) -> crate::TypeTraitObject {
950 fold_type_trait_object(self, i)
951 }
952 #[cfg(any(feature = "derive", feature = "full"))]
953 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
954 fn fold_type_tuple(&mut self, i: crate::TypeTuple) -> crate::TypeTuple {
955 fold_type_tuple(self, i)
956 }
957 #[cfg(any(feature = "derive", feature = "full"))]
958 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
959 fn fold_un_op(&mut self, i: crate::UnOp) -> crate::UnOp {
960 fold_un_op(self, i)
961 }
962 #[cfg(feature = "full")]
963 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
964 fn fold_use_glob(&mut self, i: crate::UseGlob) -> crate::UseGlob {
965 fold_use_glob(self, i)
966 }
967 #[cfg(feature = "full")]
968 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
969 fn fold_use_group(&mut self, i: crate::UseGroup) -> crate::UseGroup {
970 fold_use_group(self, i)
971 }
972 #[cfg(feature = "full")]
973 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
974 fn fold_use_name(&mut self, i: crate::UseName) -> crate::UseName {
975 fold_use_name(self, i)
976 }
977 #[cfg(feature = "full")]
978 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
979 fn fold_use_path(&mut self, i: crate::UsePath) -> crate::UsePath {
980 fold_use_path(self, i)
981 }
982 #[cfg(feature = "full")]
983 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
984 fn fold_use_rename(&mut self, i: crate::UseRename) -> crate::UseRename {
985 fold_use_rename(self, i)
986 }
987 #[cfg(feature = "full")]
988 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
989 fn fold_use_tree(&mut self, i: crate::UseTree) -> crate::UseTree {
990 fold_use_tree(self, i)
991 }
992 #[cfg(feature = "full")]
993 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
994 fn fold_variadic(&mut self, i: crate::Variadic) -> crate::Variadic {
995 fold_variadic(self, i)
996 }
997 #[cfg(any(feature = "derive", feature = "full"))]
998 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
999 fn fold_variant(&mut self, i: crate::Variant) -> crate::Variant {
1000 fold_variant(self, i)
1001 }
1002 #[cfg(any(feature = "derive", feature = "full"))]
1003 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1004 fn fold_vis_restricted(&mut self, i: crate::VisRestricted) -> crate::VisRestricted {
1005 fold_vis_restricted(self, i)
1006 }
1007 #[cfg(any(feature = "derive", feature = "full"))]
1008 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1009 fn fold_visibility(&mut self, i: crate::Visibility) -> crate::Visibility {
1010 fold_visibility(self, i)
1011 }
1012 #[cfg(any(feature = "derive", feature = "full"))]
1013 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1014 fn fold_where_clause(&mut self, i: crate::WhereClause) -> crate::WhereClause {
1015 fold_where_clause(self, i)
1016 }
1017 #[cfg(any(feature = "derive", feature = "full"))]
1018 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1019 fn fold_where_predicate(
1020 &mut self,
1021 i: crate::WherePredicate,
1022 ) -> crate::WherePredicate {
1023 fold_where_predicate(self, i)
1024 }
1025 }
1026 #[cfg(any(feature = "derive", feature = "full"))]
1027 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1028 pub fn fold_abi<F>(f: &mut F, node: crate::Abi) -> crate::Abi
1029 where
1030 F: Fold + ?Sized,
1031 {
1032 crate::Abi {
1033 extern_token: node.extern_token,
1034 name: (node.name).map(|it| f.fold_lit_str(it)),
1035 }
1036 }
1037 #[cfg(any(feature = "derive", feature = "full"))]
1038 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1039 pub fn fold_angle_bracketed_generic_arguments<F>(
1040 f: &mut F,
1041 node: crate::AngleBracketedGenericArguments,
1042 ) -> crate::AngleBracketedGenericArguments
1043 where
1044 F: Fold + ?Sized,
1045 {
1046 crate::AngleBracketedGenericArguments {
1047 colon2_token: node.colon2_token,
1048 lt_token: node.lt_token,
1049 args: crate::punctuated::fold(node.args, f, F::fold_generic_argument),
1050 gt_token: node.gt_token,
1051 }
1052 }
1053 #[cfg(feature = "full")]
1054 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1055 pub fn fold_arm<F>(f: &mut F, node: crate::Arm) -> crate::Arm
1056 where
1057 F: Fold + ?Sized,
1058 {
1059 crate::Arm {
1060 attrs: f.fold_attributes(node.attrs),
1061 pat: f.fold_pat(node.pat),
1062 guard: (node.guard).map(|it| ((it).0, Box::new(f.fold_expr(*(it).1)))),
1063 fat_arrow_token: node.fat_arrow_token,
1064 body: Box::new(f.fold_expr(*node.body)),
1065 comma: node.comma,
1066 }
1067 }
1068 #[cfg(any(feature = "derive", feature = "full"))]
1069 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1070 pub fn fold_assoc_const<F>(f: &mut F, node: crate::AssocConst) -> crate::AssocConst
1071 where
1072 F: Fold + ?Sized,
1073 {
1074 crate::AssocConst {
1075 ident: f.fold_ident(node.ident),
1076 generics: (node.generics).map(|it| f.fold_angle_bracketed_generic_arguments(it)),
1077 eq_token: node.eq_token,
1078 value: f.fold_expr(node.value),
1079 }
1080 }
1081 #[cfg(any(feature = "derive", feature = "full"))]
1082 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1083 pub fn fold_assoc_type<F>(f: &mut F, node: crate::AssocType) -> crate::AssocType
1084 where
1085 F: Fold + ?Sized,
1086 {
1087 crate::AssocType {
1088 ident: f.fold_ident(node.ident),
1089 generics: (node.generics).map(|it| f.fold_angle_bracketed_generic_arguments(it)),
1090 eq_token: node.eq_token,
1091 ty: f.fold_type(node.ty),
1092 }
1093 }
1094 #[cfg(any(feature = "derive", feature = "full"))]
1095 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1096 pub fn fold_attr_style<F>(f: &mut F, node: crate::AttrStyle) -> crate::AttrStyle
1097 where
1098 F: Fold + ?Sized,
1099 {
1100 match node {
1101 crate::AttrStyle::Outer => crate::AttrStyle::Outer,
1102 crate::AttrStyle::Inner(_binding_0) => crate::AttrStyle::Inner(_binding_0),
1103 }
1104 }
1105 #[cfg(any(feature = "derive", feature = "full"))]
1106 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1107 pub fn fold_attribute<F>(f: &mut F, node: crate::Attribute) -> crate::Attribute
1108 where
1109 F: Fold + ?Sized,
1110 {
1111 crate::Attribute {
1112 pound_token: node.pound_token,
1113 style: f.fold_attr_style(node.style),
1114 bracket_token: node.bracket_token,
1115 meta: f.fold_meta(node.meta),
1116 }
1117 }
1118 #[cfg(any(feature = "derive", feature = "full"))]
1119 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1120 pub fn fold_bare_fn_arg<F>(f: &mut F, node: crate::BareFnArg) -> crate::BareFnArg
1121 where
1122 F: Fold + ?Sized,
1123 {
1124 crate::BareFnArg {
1125 attrs: f.fold_attributes(node.attrs),
1126 name: (node.name).map(|it| (f.fold_ident((it).0), (it).1)),
1127 ty: f.fold_type(node.ty),
1128 }
1129 }
1130 #[cfg(any(feature = "derive", feature = "full"))]
1131 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1132 pub fn fold_bare_variadic<F>(f: &mut F, node: crate::BareVariadic) -> crate::BareVariadic
1133 where
1134 F: Fold + ?Sized,
1135 {
1136 crate::BareVariadic {
1137 attrs: f.fold_attributes(node.attrs),
1138 name: (node.name).map(|it| (f.fold_ident((it).0), (it).1)),
1139 dots: node.dots,
1140 comma: node.comma,
1141 }
1142 }
1143 #[cfg(any(feature = "derive", feature = "full"))]
1144 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1145 pub fn fold_bin_op<F>(f: &mut F, node: crate::BinOp) -> crate::BinOp
1146 where
1147 F: Fold + ?Sized,
1148 {
1149 match node {
1150 crate::BinOp::Add(_binding_0) => crate::BinOp::Add(_binding_0),
1151 crate::BinOp::Sub(_binding_0) => crate::BinOp::Sub(_binding_0),
1152 crate::BinOp::Mul(_binding_0) => crate::BinOp::Mul(_binding_0),
1153 crate::BinOp::Div(_binding_0) => crate::BinOp::Div(_binding_0),
1154 crate::BinOp::Rem(_binding_0) => crate::BinOp::Rem(_binding_0),
1155 crate::BinOp::And(_binding_0) => crate::BinOp::And(_binding_0),
1156 crate::BinOp::Or(_binding_0) => crate::BinOp::Or(_binding_0),
1157 crate::BinOp::BitXor(_binding_0) => crate::BinOp::BitXor(_binding_0),
1158 crate::BinOp::BitAnd(_binding_0) => crate::BinOp::BitAnd(_binding_0),
1159 crate::BinOp::BitOr(_binding_0) => crate::BinOp::BitOr(_binding_0),
1160 crate::BinOp::Shl(_binding_0) => crate::BinOp::Shl(_binding_0),
1161 crate::BinOp::Shr(_binding_0) => crate::BinOp::Shr(_binding_0),
1162 crate::BinOp::Eq(_binding_0) => crate::BinOp::Eq(_binding_0),
1163 crate::BinOp::Lt(_binding_0) => crate::BinOp::Lt(_binding_0),
1164 crate::BinOp::Le(_binding_0) => crate::BinOp::Le(_binding_0),
1165 crate::BinOp::Ne(_binding_0) => crate::BinOp::Ne(_binding_0),
1166 crate::BinOp::Ge(_binding_0) => crate::BinOp::Ge(_binding_0),
1167 crate::BinOp::Gt(_binding_0) => crate::BinOp::Gt(_binding_0),
1168 crate::BinOp::AddAssign(_binding_0) => crate::BinOp::AddAssign(_binding_0),
1169 crate::BinOp::SubAssign(_binding_0) => crate::BinOp::SubAssign(_binding_0),
1170 crate::BinOp::MulAssign(_binding_0) => crate::BinOp::MulAssign(_binding_0),
1171 crate::BinOp::DivAssign(_binding_0) => crate::BinOp::DivAssign(_binding_0),
1172 crate::BinOp::RemAssign(_binding_0) => crate::BinOp::RemAssign(_binding_0),
1173 crate::BinOp::BitXorAssign(_binding_0) => crate::BinOp::BitXorAssign(_binding_0),
1174 crate::BinOp::BitAndAssign(_binding_0) => crate::BinOp::BitAndAssign(_binding_0),
1175 crate::BinOp::BitOrAssign(_binding_0) => crate::BinOp::BitOrAssign(_binding_0),
1176 crate::BinOp::ShlAssign(_binding_0) => crate::BinOp::ShlAssign(_binding_0),
1177 crate::BinOp::ShrAssign(_binding_0) => crate::BinOp::ShrAssign(_binding_0),
1178 }
1179 }
1180 #[cfg(feature = "full")]
1181 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1182 pub fn fold_block<F>(f: &mut F, node: crate::Block) -> crate::Block
1183 where
1184 F: Fold + ?Sized,
1185 {
1186 crate::Block {
1187 brace_token: node.brace_token,
1188 stmts: fold_vec(node.stmts, f, F::fold_stmt),
1189 }
1190 }
1191 #[cfg(any(feature = "derive", feature = "full"))]
1192 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1193 pub fn fold_bound_lifetimes<F>(
1194 f: &mut F,
1195 node: crate::BoundLifetimes,
1196 ) -> crate::BoundLifetimes
1197 where
1198 F: Fold + ?Sized,
1199 {
1200 crate::BoundLifetimes {
1201 for_token: node.for_token,
1202 lt_token: node.lt_token,
1203 lifetimes: crate::punctuated::fold(node.lifetimes, f, F::fold_generic_param),
1204 gt_token: node.gt_token,
1205 }
1206 }
1207 #[cfg(feature = "full")]
1208 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1209 pub fn fold_captured_param<F>(
1210 f: &mut F,
1211 node: crate::CapturedParam,
1212 ) -> crate::CapturedParam
1213 where
1214 F: Fold + ?Sized,
1215 {
1216 match node {
1217 crate::CapturedParam::Lifetime(_binding_0) => {
1218 crate::CapturedParam::Lifetime(f.fold_lifetime(_binding_0))
1219 }
1220 crate::CapturedParam::Ident(_binding_0) => {
1221 crate::CapturedParam::Ident(f.fold_ident(_binding_0))
1222 }
1223 }
1224 }
1225 #[cfg(any(feature = "derive", feature = "full"))]
1226 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1227 pub fn fold_const_param<F>(f: &mut F, node: crate::ConstParam) -> crate::ConstParam
1228 where
1229 F: Fold + ?Sized,
1230 {
1231 crate::ConstParam {
1232 attrs: f.fold_attributes(node.attrs),
1233 const_token: node.const_token,
1234 ident: f.fold_ident(node.ident),
1235 colon_token: node.colon_token,
1236 ty: f.fold_type(node.ty),
1237 eq_token: node.eq_token,
1238 default: (node.default).map(|it| f.fold_expr(it)),
1239 }
1240 }
1241 #[cfg(any(feature = "derive", feature = "full"))]
1242 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1243 pub fn fold_constraint<F>(f: &mut F, node: crate::Constraint) -> crate::Constraint
1244 where
1245 F: Fold + ?Sized,
1246 {
1247 crate::Constraint {
1248 ident: f.fold_ident(node.ident),
1249 generics: (node.generics).map(|it| f.fold_angle_bracketed_generic_arguments(it)),
1250 colon_token: node.colon_token,
1251 bounds: crate::punctuated::fold(node.bounds, f, F::fold_type_param_bound),
1252 }
1253 }
1254 #[cfg(feature = "derive")]
1255 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
1256 pub fn fold_data<F>(f: &mut F, node: crate::Data) -> crate::Data
1257 where
1258 F: Fold + ?Sized,
1259 {
1260 match node {
1261 crate::Data::Struct(_binding_0) => {
1262 crate::Data::Struct(f.fold_data_struct(_binding_0))
1263 }
1264 crate::Data::Enum(_binding_0) => crate::Data::Enum(f.fold_data_enum(_binding_0)),
1265 crate::Data::Union(_binding_0) => {
1266 crate::Data::Union(f.fold_data_union(_binding_0))
1267 }
1268 }
1269 }
1270 #[cfg(feature = "derive")]
1271 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
1272 pub fn fold_data_enum<F>(f: &mut F, node: crate::DataEnum) -> crate::DataEnum
1273 where
1274 F: Fold + ?Sized,
1275 {
1276 crate::DataEnum {
1277 enum_token: node.enum_token,
1278 brace_token: node.brace_token,
1279 variants: crate::punctuated::fold(node.variants, f, F::fold_variant),
1280 }
1281 }
1282 #[cfg(feature = "derive")]
1283 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
1284 pub fn fold_data_struct<F>(f: &mut F, node: crate::DataStruct) -> crate::DataStruct
1285 where
1286 F: Fold + ?Sized,
1287 {
1288 crate::DataStruct {
1289 struct_token: node.struct_token,
1290 fields: f.fold_fields(node.fields),
1291 semi_token: node.semi_token,
1292 }
1293 }
1294 #[cfg(feature = "derive")]
1295 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
1296 pub fn fold_data_union<F>(f: &mut F, node: crate::DataUnion) -> crate::DataUnion
1297 where
1298 F: Fold + ?Sized,
1299 {
1300 crate::DataUnion {
1301 union_token: node.union_token,
1302 fields: f.fold_fields_named(node.fields),
1303 }
1304 }
1305 #[cfg(feature = "derive")]
1306 #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
1307 pub fn fold_derive_input<F>(f: &mut F, node: crate::DeriveInput) -> crate::DeriveInput
1308 where
1309 F: Fold + ?Sized,
1310 {
1311 crate::DeriveInput {
1312 attrs: f.fold_attributes(node.attrs),
1313 vis: f.fold_visibility(node.vis),
1314 ident: f.fold_ident(node.ident),
1315 generics: f.fold_generics(node.generics),
1316 data: f.fold_data(node.data),
1317 }
1318 }
1319 #[cfg(any(feature = "derive", feature = "full"))]
1320 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1321 pub fn fold_expr<F>(f: &mut F, node: crate::Expr) -> crate::Expr
1322 where
1323 F: Fold + ?Sized,
1324 {
1325 match node {
1326 crate::Expr::Array(_binding_0) => {
1327 crate::Expr::Array(full!(f.fold_expr_array(_binding_0)))
1328 }
1329 crate::Expr::Assign(_binding_0) => {
1330 crate::Expr::Assign(full!(f.fold_expr_assign(_binding_0)))
1331 }
1332 crate::Expr::Async(_binding_0) => {
1333 crate::Expr::Async(full!(f.fold_expr_async(_binding_0)))
1334 }
1335 crate::Expr::Await(_binding_0) => {
1336 crate::Expr::Await(full!(f.fold_expr_await(_binding_0)))
1337 }
1338 crate::Expr::Binary(_binding_0) => {
1339 crate::Expr::Binary(f.fold_expr_binary(_binding_0))
1340 }
1341 crate::Expr::Block(_binding_0) => {
1342 crate::Expr::Block(full!(f.fold_expr_block(_binding_0)))
1343 }
1344 crate::Expr::Break(_binding_0) => {
1345 crate::Expr::Break(full!(f.fold_expr_break(_binding_0)))
1346 }
1347 crate::Expr::Call(_binding_0) => crate::Expr::Call(f.fold_expr_call(_binding_0)),
1348 crate::Expr::Cast(_binding_0) => crate::Expr::Cast(f.fold_expr_cast(_binding_0)),
1349 crate::Expr::Closure(_binding_0) => {
1350 crate::Expr::Closure(full!(f.fold_expr_closure(_binding_0)))
1351 }
1352 crate::Expr::Const(_binding_0) => {
1353 crate::Expr::Const(full!(f.fold_expr_const(_binding_0)))
1354 }
1355 crate::Expr::Continue(_binding_0) => {
1356 crate::Expr::Continue(full!(f.fold_expr_continue(_binding_0)))
1357 }
1358 crate::Expr::Field(_binding_0) => {
1359 crate::Expr::Field(f.fold_expr_field(_binding_0))
1360 }
1361 crate::Expr::ForLoop(_binding_0) => {
1362 crate::Expr::ForLoop(full!(f.fold_expr_for_loop(_binding_0)))
1363 }
1364 crate::Expr::Group(_binding_0) => {
1365 crate::Expr::Group(f.fold_expr_group(_binding_0))
1366 }
1367 crate::Expr::If(_binding_0) => crate::Expr::If(full!(f.fold_expr_if(_binding_0))),
1368 crate::Expr::Index(_binding_0) => {
1369 crate::Expr::Index(f.fold_expr_index(_binding_0))
1370 }
1371 crate::Expr::Infer(_binding_0) => {
1372 crate::Expr::Infer(full!(f.fold_expr_infer(_binding_0)))
1373 }
1374 crate::Expr::Let(_binding_0) => {
1375 crate::Expr::Let(full!(f.fold_expr_let(_binding_0)))
1376 }
1377 crate::Expr::Lit(_binding_0) => crate::Expr::Lit(f.fold_expr_lit(_binding_0)),
1378 crate::Expr::Loop(_binding_0) => {
1379 crate::Expr::Loop(full!(f.fold_expr_loop(_binding_0)))
1380 }
1381 crate::Expr::Macro(_binding_0) => {
1382 crate::Expr::Macro(f.fold_expr_macro(_binding_0))
1383 }
1384 crate::Expr::Match(_binding_0) => {
1385 crate::Expr::Match(full!(f.fold_expr_match(_binding_0)))
1386 }
1387 crate::Expr::MethodCall(_binding_0) => {
1388 crate::Expr::MethodCall(f.fold_expr_method_call(_binding_0))
1389 }
1390 crate::Expr::Paren(_binding_0) => {
1391 crate::Expr::Paren(f.fold_expr_paren(_binding_0))
1392 }
1393 crate::Expr::Path(_binding_0) => crate::Expr::Path(f.fold_expr_path(_binding_0)),
1394 crate::Expr::Range(_binding_0) => {
1395 crate::Expr::Range(full!(f.fold_expr_range(_binding_0)))
1396 }
1397 crate::Expr::RawAddr(_binding_0) => {
1398 crate::Expr::RawAddr(full!(f.fold_expr_raw_addr(_binding_0)))
1399 }
1400 crate::Expr::Reference(_binding_0) => {
1401 crate::Expr::Reference(f.fold_expr_reference(_binding_0))
1402 }
1403 crate::Expr::Repeat(_binding_0) => {
1404 crate::Expr::Repeat(full!(f.fold_expr_repeat(_binding_0)))
1405 }
1406 crate::Expr::Return(_binding_0) => {
1407 crate::Expr::Return(full!(f.fold_expr_return(_binding_0)))
1408 }
1409 crate::Expr::Struct(_binding_0) => {
1410 crate::Expr::Struct(f.fold_expr_struct(_binding_0))
1411 }
1412 crate::Expr::Try(_binding_0) => {
1413 crate::Expr::Try(full!(f.fold_expr_try(_binding_0)))
1414 }
1415 crate::Expr::TryBlock(_binding_0) => {
1416 crate::Expr::TryBlock(full!(f.fold_expr_try_block(_binding_0)))
1417 }
1418 crate::Expr::Tuple(_binding_0) => {
1419 crate::Expr::Tuple(f.fold_expr_tuple(_binding_0))
1420 }
1421 crate::Expr::Unary(_binding_0) => {
1422 crate::Expr::Unary(f.fold_expr_unary(_binding_0))
1423 }
1424 crate::Expr::Unsafe(_binding_0) => {
1425 crate::Expr::Unsafe(full!(f.fold_expr_unsafe(_binding_0)))
1426 }
1427 crate::Expr::Verbatim(_binding_0) => {
1428 crate::Expr::Verbatim(f.fold_token_stream(_binding_0))
1429 }
1430 crate::Expr::While(_binding_0) => {
1431 crate::Expr::While(full!(f.fold_expr_while(_binding_0)))
1432 }
1433 crate::Expr::Yield(_binding_0) => {
1434 crate::Expr::Yield(full!(f.fold_expr_yield(_binding_0)))
1435 }
1436 }
1437 }
1438 #[cfg(feature = "full")]
1439 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1440 pub fn fold_expr_array<F>(f: &mut F, node: crate::ExprArray) -> crate::ExprArray
1441 where
1442 F: Fold + ?Sized,
1443 {
1444 crate::ExprArray {
1445 attrs: f.fold_attributes(node.attrs),
1446 bracket_token: node.bracket_token,
1447 elems: crate::punctuated::fold(node.elems, f, F::fold_expr),
1448 }
1449 }
1450 #[cfg(feature = "full")]
1451 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1452 pub fn fold_expr_assign<F>(f: &mut F, node: crate::ExprAssign) -> crate::ExprAssign
1453 where
1454 F: Fold + ?Sized,
1455 {
1456 crate::ExprAssign {
1457 attrs: f.fold_attributes(node.attrs),
1458 left: Box::new(f.fold_expr(*node.left)),
1459 eq_token: node.eq_token,
1460 right: Box::new(f.fold_expr(*node.right)),
1461 }
1462 }
1463 #[cfg(feature = "full")]
1464 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1465 pub fn fold_expr_async<F>(f: &mut F, node: crate::ExprAsync) -> crate::ExprAsync
1466 where
1467 F: Fold + ?Sized,
1468 {
1469 crate::ExprAsync {
1470 attrs: f.fold_attributes(node.attrs),
1471 async_token: node.async_token,
1472 capture: node.capture,
1473 block: f.fold_block(node.block),
1474 }
1475 }
1476 #[cfg(feature = "full")]
1477 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1478 pub fn fold_expr_await<F>(f: &mut F, node: crate::ExprAwait) -> crate::ExprAwait
1479 where
1480 F: Fold + ?Sized,
1481 {
1482 crate::ExprAwait {
1483 attrs: f.fold_attributes(node.attrs),
1484 base: Box::new(f.fold_expr(*node.base)),
1485 dot_token: node.dot_token,
1486 await_token: node.await_token,
1487 }
1488 }
1489 #[cfg(any(feature = "derive", feature = "full"))]
1490 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1491 pub fn fold_expr_binary<F>(f: &mut F, node: crate::ExprBinary) -> crate::ExprBinary
1492 where
1493 F: Fold + ?Sized,
1494 {
1495 crate::ExprBinary {
1496 attrs: f.fold_attributes(node.attrs),
1497 left: Box::new(f.fold_expr(*node.left)),
1498 op: f.fold_bin_op(node.op),
1499 right: Box::new(f.fold_expr(*node.right)),
1500 }
1501 }
1502 #[cfg(feature = "full")]
1503 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1504 pub fn fold_expr_block<F>(f: &mut F, node: crate::ExprBlock) -> crate::ExprBlock
1505 where
1506 F: Fold + ?Sized,
1507 {
1508 crate::ExprBlock {
1509 attrs: f.fold_attributes(node.attrs),
1510 label: (node.label).map(|it| f.fold_label(it)),
1511 block: f.fold_block(node.block),
1512 }
1513 }
1514 #[cfg(feature = "full")]
1515 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1516 pub fn fold_expr_break<F>(f: &mut F, node: crate::ExprBreak) -> crate::ExprBreak
1517 where
1518 F: Fold + ?Sized,
1519 {
1520 crate::ExprBreak {
1521 attrs: f.fold_attributes(node.attrs),
1522 break_token: node.break_token,
1523 label: (node.label).map(|it| f.fold_lifetime(it)),
1524 expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))),
1525 }
1526 }
1527 #[cfg(any(feature = "derive", feature = "full"))]
1528 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1529 pub fn fold_expr_call<F>(f: &mut F, node: crate::ExprCall) -> crate::ExprCall
1530 where
1531 F: Fold + ?Sized,
1532 {
1533 crate::ExprCall {
1534 attrs: f.fold_attributes(node.attrs),
1535 func: Box::new(f.fold_expr(*node.func)),
1536 paren_token: node.paren_token,
1537 args: crate::punctuated::fold(node.args, f, F::fold_expr),
1538 }
1539 }
1540 #[cfg(any(feature = "derive", feature = "full"))]
1541 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1542 pub fn fold_expr_cast<F>(f: &mut F, node: crate::ExprCast) -> crate::ExprCast
1543 where
1544 F: Fold + ?Sized,
1545 {
1546 crate::ExprCast {
1547 attrs: f.fold_attributes(node.attrs),
1548 expr: Box::new(f.fold_expr(*node.expr)),
1549 as_token: node.as_token,
1550 ty: Box::new(f.fold_type(*node.ty)),
1551 }
1552 }
1553 #[cfg(feature = "full")]
1554 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1555 pub fn fold_expr_closure<F>(f: &mut F, node: crate::ExprClosure) -> crate::ExprClosure
1556 where
1557 F: Fold + ?Sized,
1558 {
1559 crate::ExprClosure {
1560 attrs: f.fold_attributes(node.attrs),
1561 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
1562 constness: node.constness,
1563 movability: node.movability,
1564 asyncness: node.asyncness,
1565 capture: node.capture,
1566 or1_token: node.or1_token,
1567 inputs: crate::punctuated::fold(node.inputs, f, F::fold_pat),
1568 or2_token: node.or2_token,
1569 output: f.fold_return_type(node.output),
1570 body: Box::new(f.fold_expr(*node.body)),
1571 }
1572 }
1573 #[cfg(feature = "full")]
1574 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1575 pub fn fold_expr_const<F>(f: &mut F, node: crate::ExprConst) -> crate::ExprConst
1576 where
1577 F: Fold + ?Sized,
1578 {
1579 crate::ExprConst {
1580 attrs: f.fold_attributes(node.attrs),
1581 const_token: node.const_token,
1582 block: f.fold_block(node.block),
1583 }
1584 }
1585 #[cfg(feature = "full")]
1586 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1587 pub fn fold_expr_continue<F>(f: &mut F, node: crate::ExprContinue) -> crate::ExprContinue
1588 where
1589 F: Fold + ?Sized,
1590 {
1591 crate::ExprContinue {
1592 attrs: f.fold_attributes(node.attrs),
1593 continue_token: node.continue_token,
1594 label: (node.label).map(|it| f.fold_lifetime(it)),
1595 }
1596 }
1597 #[cfg(any(feature = "derive", feature = "full"))]
1598 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1599 pub fn fold_expr_field<F>(f: &mut F, node: crate::ExprField) -> crate::ExprField
1600 where
1601 F: Fold + ?Sized,
1602 {
1603 crate::ExprField {
1604 attrs: f.fold_attributes(node.attrs),
1605 base: Box::new(f.fold_expr(*node.base)),
1606 dot_token: node.dot_token,
1607 member: f.fold_member(node.member),
1608 }
1609 }
1610 #[cfg(feature = "full")]
1611 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1612 pub fn fold_expr_for_loop<F>(f: &mut F, node: crate::ExprForLoop) -> crate::ExprForLoop
1613 where
1614 F: Fold + ?Sized,
1615 {
1616 crate::ExprForLoop {
1617 attrs: f.fold_attributes(node.attrs),
1618 label: (node.label).map(|it| f.fold_label(it)),
1619 for_token: node.for_token,
1620 pat: Box::new(f.fold_pat(*node.pat)),
1621 in_token: node.in_token,
1622 expr: Box::new(f.fold_expr(*node.expr)),
1623 body: f.fold_block(node.body),
1624 }
1625 }
1626 #[cfg(any(feature = "derive", feature = "full"))]
1627 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1628 pub fn fold_expr_group<F>(f: &mut F, node: crate::ExprGroup) -> crate::ExprGroup
1629 where
1630 F: Fold + ?Sized,
1631 {
1632 crate::ExprGroup {
1633 attrs: f.fold_attributes(node.attrs),
1634 group_token: node.group_token,
1635 expr: Box::new(f.fold_expr(*node.expr)),
1636 }
1637 }
1638 #[cfg(feature = "full")]
1639 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1640 pub fn fold_expr_if<F>(f: &mut F, node: crate::ExprIf) -> crate::ExprIf
1641 where
1642 F: Fold + ?Sized,
1643 {
1644 crate::ExprIf {
1645 attrs: f.fold_attributes(node.attrs),
1646 if_token: node.if_token,
1647 cond: Box::new(f.fold_expr(*node.cond)),
1648 then_branch: f.fold_block(node.then_branch),
1649 else_branch: (node.else_branch)
1650 .map(|it| ((it).0, Box::new(f.fold_expr(*(it).1)))),
1651 }
1652 }
1653 #[cfg(any(feature = "derive", feature = "full"))]
1654 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1655 pub fn fold_expr_index<F>(f: &mut F, node: crate::ExprIndex) -> crate::ExprIndex
1656 where
1657 F: Fold + ?Sized,
1658 {
1659 crate::ExprIndex {
1660 attrs: f.fold_attributes(node.attrs),
1661 expr: Box::new(f.fold_expr(*node.expr)),
1662 bracket_token: node.bracket_token,
1663 index: Box::new(f.fold_expr(*node.index)),
1664 }
1665 }
1666 #[cfg(feature = "full")]
1667 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1668 pub fn fold_expr_infer<F>(f: &mut F, node: crate::ExprInfer) -> crate::ExprInfer
1669 where
1670 F: Fold + ?Sized,
1671 {
1672 crate::ExprInfer {
1673 attrs: f.fold_attributes(node.attrs),
1674 underscore_token: node.underscore_token,
1675 }
1676 }
1677 #[cfg(feature = "full")]
1678 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1679 pub fn fold_expr_let<F>(f: &mut F, node: crate::ExprLet) -> crate::ExprLet
1680 where
1681 F: Fold + ?Sized,
1682 {
1683 crate::ExprLet {
1684 attrs: f.fold_attributes(node.attrs),
1685 let_token: node.let_token,
1686 pat: Box::new(f.fold_pat(*node.pat)),
1687 eq_token: node.eq_token,
1688 expr: Box::new(f.fold_expr(*node.expr)),
1689 }
1690 }
1691 #[cfg(any(feature = "derive", feature = "full"))]
1692 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1693 pub fn fold_expr_lit<F>(f: &mut F, node: crate::ExprLit) -> crate::ExprLit
1694 where
1695 F: Fold + ?Sized,
1696 {
1697 crate::ExprLit {
1698 attrs: f.fold_attributes(node.attrs),
1699 lit: f.fold_lit(node.lit),
1700 }
1701 }
1702 #[cfg(feature = "full")]
1703 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1704 pub fn fold_expr_loop<F>(f: &mut F, node: crate::ExprLoop) -> crate::ExprLoop
1705 where
1706 F: Fold + ?Sized,
1707 {
1708 crate::ExprLoop {
1709 attrs: f.fold_attributes(node.attrs),
1710 label: (node.label).map(|it| f.fold_label(it)),
1711 loop_token: node.loop_token,
1712 body: f.fold_block(node.body),
1713 }
1714 }
1715 #[cfg(any(feature = "derive", feature = "full"))]
1716 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1717 pub fn fold_expr_macro<F>(f: &mut F, node: crate::ExprMacro) -> crate::ExprMacro
1718 where
1719 F: Fold + ?Sized,
1720 {
1721 crate::ExprMacro {
1722 attrs: f.fold_attributes(node.attrs),
1723 mac: f.fold_macro(node.mac),
1724 }
1725 }
1726 #[cfg(feature = "full")]
1727 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1728 pub fn fold_expr_match<F>(f: &mut F, node: crate::ExprMatch) -> crate::ExprMatch
1729 where
1730 F: Fold + ?Sized,
1731 {
1732 crate::ExprMatch {
1733 attrs: f.fold_attributes(node.attrs),
1734 match_token: node.match_token,
1735 expr: Box::new(f.fold_expr(*node.expr)),
1736 brace_token: node.brace_token,
1737 arms: fold_vec(node.arms, f, F::fold_arm),
1738 }
1739 }
1740 #[cfg(any(feature = "derive", feature = "full"))]
1741 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1742 pub fn fold_expr_method_call<F>(
1743 f: &mut F,
1744 node: crate::ExprMethodCall,
1745 ) -> crate::ExprMethodCall
1746 where
1747 F: Fold + ?Sized,
1748 {
1749 crate::ExprMethodCall {
1750 attrs: f.fold_attributes(node.attrs),
1751 receiver: Box::new(f.fold_expr(*node.receiver)),
1752 dot_token: node.dot_token,
1753 method: f.fold_ident(node.method),
1754 turbofish: (node.turbofish)
1755 .map(|it| f.fold_angle_bracketed_generic_arguments(it)),
1756 paren_token: node.paren_token,
1757 args: crate::punctuated::fold(node.args, f, F::fold_expr),
1758 }
1759 }
1760 #[cfg(any(feature = "derive", feature = "full"))]
1761 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1762 pub fn fold_expr_paren<F>(f: &mut F, node: crate::ExprParen) -> crate::ExprParen
1763 where
1764 F: Fold + ?Sized,
1765 {
1766 crate::ExprParen {
1767 attrs: f.fold_attributes(node.attrs),
1768 paren_token: node.paren_token,
1769 expr: Box::new(f.fold_expr(*node.expr)),
1770 }
1771 }
1772 #[cfg(any(feature = "derive", feature = "full"))]
1773 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1774 pub fn fold_expr_path<F>(f: &mut F, node: crate::ExprPath) -> crate::ExprPath
1775 where
1776 F: Fold + ?Sized,
1777 {
1778 crate::ExprPath {
1779 attrs: f.fold_attributes(node.attrs),
1780 qself: (node.qself).map(|it| f.fold_qself(it)),
1781 path: f.fold_path(node.path),
1782 }
1783 }
1784 #[cfg(feature = "full")]
1785 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1786 pub fn fold_expr_range<F>(f: &mut F, node: crate::ExprRange) -> crate::ExprRange
1787 where
1788 F: Fold + ?Sized,
1789 {
1790 crate::ExprRange {
1791 attrs: f.fold_attributes(node.attrs),
1792 start: (node.start).map(|it| Box::new(f.fold_expr(*it))),
1793 limits: f.fold_range_limits(node.limits),
1794 end: (node.end).map(|it| Box::new(f.fold_expr(*it))),
1795 }
1796 }
1797 #[cfg(feature = "full")]
1798 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1799 pub fn fold_expr_raw_addr<F>(f: &mut F, node: crate::ExprRawAddr) -> crate::ExprRawAddr
1800 where
1801 F: Fold + ?Sized,
1802 {
1803 crate::ExprRawAddr {
1804 attrs: f.fold_attributes(node.attrs),
1805 and_token: node.and_token,
1806 raw: node.raw,
1807 mutability: f.fold_pointer_mutability(node.mutability),
1808 expr: Box::new(f.fold_expr(*node.expr)),
1809 }
1810 }
1811 #[cfg(any(feature = "derive", feature = "full"))]
1812 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1813 pub fn fold_expr_reference<F>(
1814 f: &mut F,
1815 node: crate::ExprReference,
1816 ) -> crate::ExprReference
1817 where
1818 F: Fold + ?Sized,
1819 {
1820 crate::ExprReference {
1821 attrs: f.fold_attributes(node.attrs),
1822 and_token: node.and_token,
1823 mutability: node.mutability,
1824 expr: Box::new(f.fold_expr(*node.expr)),
1825 }
1826 }
1827 #[cfg(feature = "full")]
1828 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1829 pub fn fold_expr_repeat<F>(f: &mut F, node: crate::ExprRepeat) -> crate::ExprRepeat
1830 where
1831 F: Fold + ?Sized,
1832 {
1833 crate::ExprRepeat {
1834 attrs: f.fold_attributes(node.attrs),
1835 bracket_token: node.bracket_token,
1836 expr: Box::new(f.fold_expr(*node.expr)),
1837 semi_token: node.semi_token,
1838 len: Box::new(f.fold_expr(*node.len)),
1839 }
1840 }
1841 #[cfg(feature = "full")]
1842 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1843 pub fn fold_expr_return<F>(f: &mut F, node: crate::ExprReturn) -> crate::ExprReturn
1844 where
1845 F: Fold + ?Sized,
1846 {
1847 crate::ExprReturn {
1848 attrs: f.fold_attributes(node.attrs),
1849 return_token: node.return_token,
1850 expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))),
1851 }
1852 }
1853 #[cfg(any(feature = "derive", feature = "full"))]
1854 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1855 pub fn fold_expr_struct<F>(f: &mut F, node: crate::ExprStruct) -> crate::ExprStruct
1856 where
1857 F: Fold + ?Sized,
1858 {
1859 crate::ExprStruct {
1860 attrs: f.fold_attributes(node.attrs),
1861 qself: (node.qself).map(|it| f.fold_qself(it)),
1862 path: f.fold_path(node.path),
1863 brace_token: node.brace_token,
1864 fields: crate::punctuated::fold(node.fields, f, F::fold_field_value),
1865 dot2_token: node.dot2_token,
1866 rest: (node.rest).map(|it| Box::new(f.fold_expr(*it))),
1867 }
1868 }
1869 #[cfg(feature = "full")]
1870 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1871 pub fn fold_expr_try<F>(f: &mut F, node: crate::ExprTry) -> crate::ExprTry
1872 where
1873 F: Fold + ?Sized,
1874 {
1875 crate::ExprTry {
1876 attrs: f.fold_attributes(node.attrs),
1877 expr: Box::new(f.fold_expr(*node.expr)),
1878 question_token: node.question_token,
1879 }
1880 }
1881 #[cfg(feature = "full")]
1882 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1883 pub fn fold_expr_try_block<F>(
1884 f: &mut F,
1885 node: crate::ExprTryBlock,
1886 ) -> crate::ExprTryBlock
1887 where
1888 F: Fold + ?Sized,
1889 {
1890 crate::ExprTryBlock {
1891 attrs: f.fold_attributes(node.attrs),
1892 try_token: node.try_token,
1893 block: f.fold_block(node.block),
1894 }
1895 }
1896 #[cfg(any(feature = "derive", feature = "full"))]
1897 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1898 pub fn fold_expr_tuple<F>(f: &mut F, node: crate::ExprTuple) -> crate::ExprTuple
1899 where
1900 F: Fold + ?Sized,
1901 {
1902 crate::ExprTuple {
1903 attrs: f.fold_attributes(node.attrs),
1904 paren_token: node.paren_token,
1905 elems: crate::punctuated::fold(node.elems, f, F::fold_expr),
1906 }
1907 }
1908 #[cfg(any(feature = "derive", feature = "full"))]
1909 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1910 pub fn fold_expr_unary<F>(f: &mut F, node: crate::ExprUnary) -> crate::ExprUnary
1911 where
1912 F: Fold + ?Sized,
1913 {
1914 crate::ExprUnary {
1915 attrs: f.fold_attributes(node.attrs),
1916 op: f.fold_un_op(node.op),
1917 expr: Box::new(f.fold_expr(*node.expr)),
1918 }
1919 }
1920 #[cfg(feature = "full")]
1921 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1922 pub fn fold_expr_unsafe<F>(f: &mut F, node: crate::ExprUnsafe) -> crate::ExprUnsafe
1923 where
1924 F: Fold + ?Sized,
1925 {
1926 crate::ExprUnsafe {
1927 attrs: f.fold_attributes(node.attrs),
1928 unsafe_token: node.unsafe_token,
1929 block: f.fold_block(node.block),
1930 }
1931 }
1932 #[cfg(feature = "full")]
1933 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1934 pub fn fold_expr_while<F>(f: &mut F, node: crate::ExprWhile) -> crate::ExprWhile
1935 where
1936 F: Fold + ?Sized,
1937 {
1938 crate::ExprWhile {
1939 attrs: f.fold_attributes(node.attrs),
1940 label: (node.label).map(|it| f.fold_label(it)),
1941 while_token: node.while_token,
1942 cond: Box::new(f.fold_expr(*node.cond)),
1943 body: f.fold_block(node.body),
1944 }
1945 }
1946 #[cfg(feature = "full")]
1947 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1948 pub fn fold_expr_yield<F>(f: &mut F, node: crate::ExprYield) -> crate::ExprYield
1949 where
1950 F: Fold + ?Sized,
1951 {
1952 crate::ExprYield {
1953 attrs: f.fold_attributes(node.attrs),
1954 yield_token: node.yield_token,
1955 expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))),
1956 }
1957 }
1958 #[cfg(any(feature = "derive", feature = "full"))]
1959 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1960 pub fn fold_field<F>(f: &mut F, node: crate::Field) -> crate::Field
1961 where
1962 F: Fold + ?Sized,
1963 {
1964 crate::Field {
1965 attrs: f.fold_attributes(node.attrs),
1966 vis: f.fold_visibility(node.vis),
1967 mutability: f.fold_field_mutability(node.mutability),
1968 ident: (node.ident).map(|it| f.fold_ident(it)),
1969 colon_token: node.colon_token,
1970 ty: f.fold_type(node.ty),
1971 }
1972 }
1973 #[cfg(any(feature = "derive", feature = "full"))]
1974 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
1975 pub fn fold_field_mutability<F>(
1976 f: &mut F,
1977 node: crate::FieldMutability,
1978 ) -> crate::FieldMutability
1979 where
1980 F: Fold + ?Sized,
1981 {
1982 match node {
1983 crate::FieldMutability::None => crate::FieldMutability::None,
1984 }
1985 }
1986 #[cfg(feature = "full")]
1987 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
1988 pub fn fold_field_pat<F>(f: &mut F, node: crate::FieldPat) -> crate::FieldPat
1989 where
1990 F: Fold + ?Sized,
1991 {
1992 crate::FieldPat {
1993 attrs: f.fold_attributes(node.attrs),
1994 member: f.fold_member(node.member),
1995 colon_token: node.colon_token,
1996 pat: Box::new(f.fold_pat(*node.pat)),
1997 }
1998 }
1999 #[cfg(any(feature = "derive", feature = "full"))]
2000 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2001 pub fn fold_field_value<F>(f: &mut F, node: crate::FieldValue) -> crate::FieldValue
2002 where
2003 F: Fold + ?Sized,
2004 {
2005 crate::FieldValue {
2006 attrs: f.fold_attributes(node.attrs),
2007 member: f.fold_member(node.member),
2008 colon_token: node.colon_token,
2009 expr: f.fold_expr(node.expr),
2010 }
2011 }
2012 #[cfg(any(feature = "derive", feature = "full"))]
2013 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2014 pub fn fold_fields<F>(f: &mut F, node: crate::Fields) -> crate::Fields
2015 where
2016 F: Fold + ?Sized,
2017 {
2018 match node {
2019 crate::Fields::Named(_binding_0) => {
2020 crate::Fields::Named(f.fold_fields_named(_binding_0))
2021 }
2022 crate::Fields::Unnamed(_binding_0) => {
2023 crate::Fields::Unnamed(f.fold_fields_unnamed(_binding_0))
2024 }
2025 crate::Fields::Unit => crate::Fields::Unit,
2026 }
2027 }
2028 #[cfg(any(feature = "derive", feature = "full"))]
2029 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2030 pub fn fold_fields_named<F>(f: &mut F, node: crate::FieldsNamed) -> crate::FieldsNamed
2031 where
2032 F: Fold + ?Sized,
2033 {
2034 crate::FieldsNamed {
2035 brace_token: node.brace_token,
2036 named: crate::punctuated::fold(node.named, f, F::fold_field),
2037 }
2038 }
2039 #[cfg(any(feature = "derive", feature = "full"))]
2040 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2041 pub fn fold_fields_unnamed<F>(
2042 f: &mut F,
2043 node: crate::FieldsUnnamed,
2044 ) -> crate::FieldsUnnamed
2045 where
2046 F: Fold + ?Sized,
2047 {
2048 crate::FieldsUnnamed {
2049 paren_token: node.paren_token,
2050 unnamed: crate::punctuated::fold(node.unnamed, f, F::fold_field),
2051 }
2052 }
2053 #[cfg(feature = "full")]
2054 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2055 pub fn fold_file<F>(f: &mut F, node: crate::File) -> crate::File
2056 where
2057 F: Fold + ?Sized,
2058 {
2059 crate::File {
2060 shebang: node.shebang,
2061 attrs: f.fold_attributes(node.attrs),
2062 items: fold_vec(node.items, f, F::fold_item),
2063 }
2064 }
2065 #[cfg(feature = "full")]
2066 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2067 pub fn fold_fn_arg<F>(f: &mut F, node: crate::FnArg) -> crate::FnArg
2068 where
2069 F: Fold + ?Sized,
2070 {
2071 match node {
2072 crate::FnArg::Receiver(_binding_0) => {
2073 crate::FnArg::Receiver(f.fold_receiver(_binding_0))
2074 }
2075 crate::FnArg::Typed(_binding_0) => {
2076 crate::FnArg::Typed(f.fold_pat_type(_binding_0))
2077 }
2078 }
2079 }
2080 #[cfg(feature = "full")]
2081 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2082 pub fn fold_foreign_item<F>(f: &mut F, node: crate::ForeignItem) -> crate::ForeignItem
2083 where
2084 F: Fold + ?Sized,
2085 {
2086 match node {
2087 crate::ForeignItem::Fn(_binding_0) => {
2088 crate::ForeignItem::Fn(f.fold_foreign_item_fn(_binding_0))
2089 }
2090 crate::ForeignItem::Static(_binding_0) => {
2091 crate::ForeignItem::Static(f.fold_foreign_item_static(_binding_0))
2092 }
2093 crate::ForeignItem::Type(_binding_0) => {
2094 crate::ForeignItem::Type(f.fold_foreign_item_type(_binding_0))
2095 }
2096 crate::ForeignItem::Macro(_binding_0) => {
2097 crate::ForeignItem::Macro(f.fold_foreign_item_macro(_binding_0))
2098 }
2099 crate::ForeignItem::Verbatim(_binding_0) => {
2100 crate::ForeignItem::Verbatim(f.fold_token_stream(_binding_0))
2101 }
2102 }
2103 }
2104 #[cfg(feature = "full")]
2105 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2106 pub fn fold_foreign_item_fn<F>(
2107 f: &mut F,
2108 node: crate::ForeignItemFn,
2109 ) -> crate::ForeignItemFn
2110 where
2111 F: Fold + ?Sized,
2112 {
2113 crate::ForeignItemFn {
2114 attrs: f.fold_attributes(node.attrs),
2115 vis: f.fold_visibility(node.vis),
2116 sig: f.fold_signature(node.sig),
2117 semi_token: node.semi_token,
2118 }
2119 }
2120 #[cfg(feature = "full")]
2121 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2122 pub fn fold_foreign_item_macro<F>(
2123 f: &mut F,
2124 node: crate::ForeignItemMacro,
2125 ) -> crate::ForeignItemMacro
2126 where
2127 F: Fold + ?Sized,
2128 {
2129 crate::ForeignItemMacro {
2130 attrs: f.fold_attributes(node.attrs),
2131 mac: f.fold_macro(node.mac),
2132 semi_token: node.semi_token,
2133 }
2134 }
2135 #[cfg(feature = "full")]
2136 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2137 pub fn fold_foreign_item_static<F>(
2138 f: &mut F,
2139 node: crate::ForeignItemStatic,
2140 ) -> crate::ForeignItemStatic
2141 where
2142 F: Fold + ?Sized,
2143 {
2144 crate::ForeignItemStatic {
2145 attrs: f.fold_attributes(node.attrs),
2146 vis: f.fold_visibility(node.vis),
2147 static_token: node.static_token,
2148 mutability: f.fold_static_mutability(node.mutability),
2149 ident: f.fold_ident(node.ident),
2150 colon_token: node.colon_token,
2151 ty: Box::new(f.fold_type(*node.ty)),
2152 semi_token: node.semi_token,
2153 }
2154 }
2155 #[cfg(feature = "full")]
2156 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2157 pub fn fold_foreign_item_type<F>(
2158 f: &mut F,
2159 node: crate::ForeignItemType,
2160 ) -> crate::ForeignItemType
2161 where
2162 F: Fold + ?Sized,
2163 {
2164 crate::ForeignItemType {
2165 attrs: f.fold_attributes(node.attrs),
2166 vis: f.fold_visibility(node.vis),
2167 type_token: node.type_token,
2168 ident: f.fold_ident(node.ident),
2169 generics: f.fold_generics(node.generics),
2170 semi_token: node.semi_token,
2171 }
2172 }
2173 #[cfg(any(feature = "derive", feature = "full"))]
2174 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2175 pub fn fold_generic_argument<F>(
2176 f: &mut F,
2177 node: crate::GenericArgument,
2178 ) -> crate::GenericArgument
2179 where
2180 F: Fold + ?Sized,
2181 {
2182 match node {
2183 crate::GenericArgument::Lifetime(_binding_0) => {
2184 crate::GenericArgument::Lifetime(f.fold_lifetime(_binding_0))
2185 }
2186 crate::GenericArgument::Type(_binding_0) => {
2187 crate::GenericArgument::Type(f.fold_type(_binding_0))
2188 }
2189 crate::GenericArgument::Const(_binding_0) => {
2190 crate::GenericArgument::Const(f.fold_expr(_binding_0))
2191 }
2192 crate::GenericArgument::AssocType(_binding_0) => {
2193 crate::GenericArgument::AssocType(f.fold_assoc_type(_binding_0))
2194 }
2195 crate::GenericArgument::AssocConst(_binding_0) => {
2196 crate::GenericArgument::AssocConst(f.fold_assoc_const(_binding_0))
2197 }
2198 crate::GenericArgument::Constraint(_binding_0) => {
2199 crate::GenericArgument::Constraint(f.fold_constraint(_binding_0))
2200 }
2201 }
2202 }
2203 #[cfg(any(feature = "derive", feature = "full"))]
2204 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2205 pub fn fold_generic_param<F>(f: &mut F, node: crate::GenericParam) -> crate::GenericParam
2206 where
2207 F: Fold + ?Sized,
2208 {
2209 match node {
2210 crate::GenericParam::Lifetime(_binding_0) => {
2211 crate::GenericParam::Lifetime(f.fold_lifetime_param(_binding_0))
2212 }
2213 crate::GenericParam::Type(_binding_0) => {
2214 crate::GenericParam::Type(f.fold_type_param(_binding_0))
2215 }
2216 crate::GenericParam::Const(_binding_0) => {
2217 crate::GenericParam::Const(f.fold_const_param(_binding_0))
2218 }
2219 }
2220 }
2221 #[cfg(any(feature = "derive", feature = "full"))]
2222 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2223 pub fn fold_generics<F>(f: &mut F, node: crate::Generics) -> crate::Generics
2224 where
2225 F: Fold + ?Sized,
2226 {
2227 crate::Generics {
2228 lt_token: node.lt_token,
2229 params: crate::punctuated::fold(node.params, f, F::fold_generic_param),
2230 gt_token: node.gt_token,
2231 where_clause: (node.where_clause).map(|it| f.fold_where_clause(it)),
2232 }
2233 }
2234 pub fn fold_ident<F>(f: &mut F, node: proc_macro2::Ident) -> proc_macro2::Ident
2235 where
2236 F: Fold + ?Sized,
2237 {
2238 let mut node = node;
2239 let span = f.fold_span(node.span());
2240 node.set_span(span);
2241 node
2242 }
2243 #[cfg(feature = "full")]
2244 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2245 pub fn fold_impl_item<F>(f: &mut F, node: crate::ImplItem) -> crate::ImplItem
2246 where
2247 F: Fold + ?Sized,
2248 {
2249 match node {
2250 crate::ImplItem::Const(_binding_0) => {
2251 crate::ImplItem::Const(f.fold_impl_item_const(_binding_0))
2252 }
2253 crate::ImplItem::Fn(_binding_0) => {
2254 crate::ImplItem::Fn(f.fold_impl_item_fn(_binding_0))
2255 }
2256 crate::ImplItem::Type(_binding_0) => {
2257 crate::ImplItem::Type(f.fold_impl_item_type(_binding_0))
2258 }
2259 crate::ImplItem::Macro(_binding_0) => {
2260 crate::ImplItem::Macro(f.fold_impl_item_macro(_binding_0))
2261 }
2262 crate::ImplItem::Verbatim(_binding_0) => {
2263 crate::ImplItem::Verbatim(f.fold_token_stream(_binding_0))
2264 }
2265 }
2266 }
2267 #[cfg(feature = "full")]
2268 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2269 pub fn fold_impl_item_const<F>(
2270 f: &mut F,
2271 node: crate::ImplItemConst,
2272 ) -> crate::ImplItemConst
2273 where
2274 F: Fold + ?Sized,
2275 {
2276 crate::ImplItemConst {
2277 attrs: f.fold_attributes(node.attrs),
2278 vis: f.fold_visibility(node.vis),
2279 defaultness: node.defaultness,
2280 const_token: node.const_token,
2281 ident: f.fold_ident(node.ident),
2282 generics: f.fold_generics(node.generics),
2283 colon_token: node.colon_token,
2284 ty: f.fold_type(node.ty),
2285 eq_token: node.eq_token,
2286 expr: f.fold_expr(node.expr),
2287 semi_token: node.semi_token,
2288 }
2289 }
2290 #[cfg(feature = "full")]
2291 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2292 pub fn fold_impl_item_fn<F>(f: &mut F, node: crate::ImplItemFn) -> crate::ImplItemFn
2293 where
2294 F: Fold + ?Sized,
2295 {
2296 crate::ImplItemFn {
2297 attrs: f.fold_attributes(node.attrs),
2298 vis: f.fold_visibility(node.vis),
2299 defaultness: node.defaultness,
2300 sig: f.fold_signature(node.sig),
2301 block: f.fold_block(node.block),
2302 }
2303 }
2304 #[cfg(feature = "full")]
2305 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2306 pub fn fold_impl_item_macro<F>(
2307 f: &mut F,
2308 node: crate::ImplItemMacro,
2309 ) -> crate::ImplItemMacro
2310 where
2311 F: Fold + ?Sized,
2312 {
2313 crate::ImplItemMacro {
2314 attrs: f.fold_attributes(node.attrs),
2315 mac: f.fold_macro(node.mac),
2316 semi_token: node.semi_token,
2317 }
2318 }
2319 #[cfg(feature = "full")]
2320 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2321 pub fn fold_impl_item_type<F>(
2322 f: &mut F,
2323 node: crate::ImplItemType,
2324 ) -> crate::ImplItemType
2325 where
2326 F: Fold + ?Sized,
2327 {
2328 crate::ImplItemType {
2329 attrs: f.fold_attributes(node.attrs),
2330 vis: f.fold_visibility(node.vis),
2331 defaultness: node.defaultness,
2332 type_token: node.type_token,
2333 ident: f.fold_ident(node.ident),
2334 generics: f.fold_generics(node.generics),
2335 eq_token: node.eq_token,
2336 ty: f.fold_type(node.ty),
2337 semi_token: node.semi_token,
2338 }
2339 }
2340 #[cfg(feature = "full")]
2341 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2342 pub fn fold_impl_restriction<F>(
2343 f: &mut F,
2344 node: crate::ImplRestriction,
2345 ) -> crate::ImplRestriction
2346 where
2347 F: Fold + ?Sized,
2348 {
2349 match node {}
2350 }
2351 #[cfg(any(feature = "derive", feature = "full"))]
2352 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2353 pub fn fold_index<F>(f: &mut F, node: crate::Index) -> crate::Index
2354 where
2355 F: Fold + ?Sized,
2356 {
2357 crate::Index {
2358 index: node.index,
2359 span: f.fold_span(node.span),
2360 }
2361 }
2362 #[cfg(feature = "full")]
2363 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2364 pub fn fold_item<F>(f: &mut F, node: crate::Item) -> crate::Item
2365 where
2366 F: Fold + ?Sized,
2367 {
2368 match node {
2369 crate::Item::Const(_binding_0) => {
2370 crate::Item::Const(f.fold_item_const(_binding_0))
2371 }
2372 crate::Item::Enum(_binding_0) => crate::Item::Enum(f.fold_item_enum(_binding_0)),
2373 crate::Item::ExternCrate(_binding_0) => {
2374 crate::Item::ExternCrate(f.fold_item_extern_crate(_binding_0))
2375 }
2376 crate::Item::Fn(_binding_0) => crate::Item::Fn(f.fold_item_fn(_binding_0)),
2377 crate::Item::ForeignMod(_binding_0) => {
2378 crate::Item::ForeignMod(f.fold_item_foreign_mod(_binding_0))
2379 }
2380 crate::Item::Impl(_binding_0) => crate::Item::Impl(f.fold_item_impl(_binding_0)),
2381 crate::Item::Macro(_binding_0) => {
2382 crate::Item::Macro(f.fold_item_macro(_binding_0))
2383 }
2384 crate::Item::Mod(_binding_0) => crate::Item::Mod(f.fold_item_mod(_binding_0)),
2385 crate::Item::Static(_binding_0) => {
2386 crate::Item::Static(f.fold_item_static(_binding_0))
2387 }
2388 crate::Item::Struct(_binding_0) => {
2389 crate::Item::Struct(f.fold_item_struct(_binding_0))
2390 }
2391 crate::Item::Trait(_binding_0) => {
2392 crate::Item::Trait(f.fold_item_trait(_binding_0))
2393 }
2394 crate::Item::TraitAlias(_binding_0) => {
2395 crate::Item::TraitAlias(f.fold_item_trait_alias(_binding_0))
2396 }
2397 crate::Item::Type(_binding_0) => crate::Item::Type(f.fold_item_type(_binding_0)),
2398 crate::Item::Union(_binding_0) => {
2399 crate::Item::Union(f.fold_item_union(_binding_0))
2400 }
2401 crate::Item::Use(_binding_0) => crate::Item::Use(f.fold_item_use(_binding_0)),
2402 crate::Item::Verbatim(_binding_0) => {
2403 crate::Item::Verbatim(f.fold_token_stream(_binding_0))
2404 }
2405 }
2406 }
2407 #[cfg(feature = "full")]
2408 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2409 pub fn fold_item_const<F>(f: &mut F, node: crate::ItemConst) -> crate::ItemConst
2410 where
2411 F: Fold + ?Sized,
2412 {
2413 crate::ItemConst {
2414 attrs: f.fold_attributes(node.attrs),
2415 vis: f.fold_visibility(node.vis),
2416 const_token: node.const_token,
2417 ident: f.fold_ident(node.ident),
2418 generics: f.fold_generics(node.generics),
2419 colon_token: node.colon_token,
2420 ty: Box::new(f.fold_type(*node.ty)),
2421 eq_token: node.eq_token,
2422 expr: Box::new(f.fold_expr(*node.expr)),
2423 semi_token: node.semi_token,
2424 }
2425 }
2426 #[cfg(feature = "full")]
2427 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2428 pub fn fold_item_enum<F>(f: &mut F, node: crate::ItemEnum) -> crate::ItemEnum
2429 where
2430 F: Fold + ?Sized,
2431 {
2432 crate::ItemEnum {
2433 attrs: f.fold_attributes(node.attrs),
2434 vis: f.fold_visibility(node.vis),
2435 enum_token: node.enum_token,
2436 ident: f.fold_ident(node.ident),
2437 generics: f.fold_generics(node.generics),
2438 brace_token: node.brace_token,
2439 variants: crate::punctuated::fold(node.variants, f, F::fold_variant),
2440 }
2441 }
2442 #[cfg(feature = "full")]
2443 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2444 pub fn fold_item_extern_crate<F>(
2445 f: &mut F,
2446 node: crate::ItemExternCrate,
2447 ) -> crate::ItemExternCrate
2448 where
2449 F: Fold + ?Sized,
2450 {
2451 crate::ItemExternCrate {
2452 attrs: f.fold_attributes(node.attrs),
2453 vis: f.fold_visibility(node.vis),
2454 extern_token: node.extern_token,
2455 crate_token: node.crate_token,
2456 ident: f.fold_ident(node.ident),
2457 rename: (node.rename).map(|it| ((it).0, f.fold_ident((it).1))),
2458 semi_token: node.semi_token,
2459 }
2460 }
2461 #[cfg(feature = "full")]
2462 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2463 pub fn fold_item_fn<F>(f: &mut F, node: crate::ItemFn) -> crate::ItemFn
2464 where
2465 F: Fold + ?Sized,
2466 {
2467 crate::ItemFn {
2468 attrs: f.fold_attributes(node.attrs),
2469 vis: f.fold_visibility(node.vis),
2470 sig: f.fold_signature(node.sig),
2471 block: Box::new(f.fold_block(*node.block)),
2472 }
2473 }
2474 #[cfg(feature = "full")]
2475 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2476 pub fn fold_item_foreign_mod<F>(
2477 f: &mut F,
2478 node: crate::ItemForeignMod,
2479 ) -> crate::ItemForeignMod
2480 where
2481 F: Fold + ?Sized,
2482 {
2483 crate::ItemForeignMod {
2484 attrs: f.fold_attributes(node.attrs),
2485 unsafety: node.unsafety,
2486 abi: f.fold_abi(node.abi),
2487 brace_token: node.brace_token,
2488 items: fold_vec(node.items, f, F::fold_foreign_item),
2489 }
2490 }
2491 #[cfg(feature = "full")]
2492 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2493 pub fn fold_item_impl<F>(f: &mut F, node: crate::ItemImpl) -> crate::ItemImpl
2494 where
2495 F: Fold + ?Sized,
2496 {
2497 crate::ItemImpl {
2498 attrs: f.fold_attributes(node.attrs),
2499 defaultness: node.defaultness,
2500 unsafety: node.unsafety,
2501 impl_token: node.impl_token,
2502 generics: f.fold_generics(node.generics),
2503 trait_: (node.trait_).map(|it| ((it).0, f.fold_path((it).1), (it).2)),
2504 self_ty: Box::new(f.fold_type(*node.self_ty)),
2505 brace_token: node.brace_token,
2506 items: fold_vec(node.items, f, F::fold_impl_item),
2507 }
2508 }
2509 #[cfg(feature = "full")]
2510 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2511 pub fn fold_item_macro<F>(f: &mut F, node: crate::ItemMacro) -> crate::ItemMacro
2512 where
2513 F: Fold + ?Sized,
2514 {
2515 crate::ItemMacro {
2516 attrs: f.fold_attributes(node.attrs),
2517 ident: (node.ident).map(|it| f.fold_ident(it)),
2518 mac: f.fold_macro(node.mac),
2519 semi_token: node.semi_token,
2520 }
2521 }
2522 #[cfg(feature = "full")]
2523 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2524 pub fn fold_item_mod<F>(f: &mut F, node: crate::ItemMod) -> crate::ItemMod
2525 where
2526 F: Fold + ?Sized,
2527 {
2528 crate::ItemMod {
2529 attrs: f.fold_attributes(node.attrs),
2530 vis: f.fold_visibility(node.vis),
2531 unsafety: node.unsafety,
2532 mod_token: node.mod_token,
2533 ident: f.fold_ident(node.ident),
2534 content: (node.content).map(|it| ((it).0, fold_vec((it).1, f, F::fold_item))),
2535 semi: node.semi,
2536 }
2537 }
2538 #[cfg(feature = "full")]
2539 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2540 pub fn fold_item_static<F>(f: &mut F, node: crate::ItemStatic) -> crate::ItemStatic
2541 where
2542 F: Fold + ?Sized,
2543 {
2544 crate::ItemStatic {
2545 attrs: f.fold_attributes(node.attrs),
2546 vis: f.fold_visibility(node.vis),
2547 static_token: node.static_token,
2548 mutability: f.fold_static_mutability(node.mutability),
2549 ident: f.fold_ident(node.ident),
2550 colon_token: node.colon_token,
2551 ty: Box::new(f.fold_type(*node.ty)),
2552 eq_token: node.eq_token,
2553 expr: Box::new(f.fold_expr(*node.expr)),
2554 semi_token: node.semi_token,
2555 }
2556 }
2557 #[cfg(feature = "full")]
2558 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2559 pub fn fold_item_struct<F>(f: &mut F, node: crate::ItemStruct) -> crate::ItemStruct
2560 where
2561 F: Fold + ?Sized,
2562 {
2563 crate::ItemStruct {
2564 attrs: f.fold_attributes(node.attrs),
2565 vis: f.fold_visibility(node.vis),
2566 struct_token: node.struct_token,
2567 ident: f.fold_ident(node.ident),
2568 generics: f.fold_generics(node.generics),
2569 fields: f.fold_fields(node.fields),
2570 semi_token: node.semi_token,
2571 }
2572 }
2573 #[cfg(feature = "full")]
2574 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2575 pub fn fold_item_trait<F>(f: &mut F, node: crate::ItemTrait) -> crate::ItemTrait
2576 where
2577 F: Fold + ?Sized,
2578 {
2579 crate::ItemTrait {
2580 attrs: f.fold_attributes(node.attrs),
2581 vis: f.fold_visibility(node.vis),
2582 unsafety: node.unsafety,
2583 auto_token: node.auto_token,
2584 restriction: (node.restriction).map(|it| f.fold_impl_restriction(it)),
2585 trait_token: node.trait_token,
2586 ident: f.fold_ident(node.ident),
2587 generics: f.fold_generics(node.generics),
2588 colon_token: node.colon_token,
2589 supertraits: crate::punctuated::fold(
2590 node.supertraits,
2591 f,
2592 F::fold_type_param_bound,
2593 ),
2594 brace_token: node.brace_token,
2595 items: fold_vec(node.items, f, F::fold_trait_item),
2596 }
2597 }
2598 #[cfg(feature = "full")]
2599 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2600 pub fn fold_item_trait_alias<F>(
2601 f: &mut F,
2602 node: crate::ItemTraitAlias,
2603 ) -> crate::ItemTraitAlias
2604 where
2605 F: Fold + ?Sized,
2606 {
2607 crate::ItemTraitAlias {
2608 attrs: f.fold_attributes(node.attrs),
2609 vis: f.fold_visibility(node.vis),
2610 trait_token: node.trait_token,
2611 ident: f.fold_ident(node.ident),
2612 generics: f.fold_generics(node.generics),
2613 eq_token: node.eq_token,
2614 bounds: crate::punctuated::fold(node.bounds, f, F::fold_type_param_bound),
2615 semi_token: node.semi_token,
2616 }
2617 }
2618 #[cfg(feature = "full")]
2619 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2620 pub fn fold_item_type<F>(f: &mut F, node: crate::ItemType) -> crate::ItemType
2621 where
2622 F: Fold + ?Sized,
2623 {
2624 crate::ItemType {
2625 attrs: f.fold_attributes(node.attrs),
2626 vis: f.fold_visibility(node.vis),
2627 type_token: node.type_token,
2628 ident: f.fold_ident(node.ident),
2629 generics: f.fold_generics(node.generics),
2630 eq_token: node.eq_token,
2631 ty: Box::new(f.fold_type(*node.ty)),
2632 semi_token: node.semi_token,
2633 }
2634 }
2635 #[cfg(feature = "full")]
2636 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2637 pub fn fold_item_union<F>(f: &mut F, node: crate::ItemUnion) -> crate::ItemUnion
2638 where
2639 F: Fold + ?Sized,
2640 {
2641 crate::ItemUnion {
2642 attrs: f.fold_attributes(node.attrs),
2643 vis: f.fold_visibility(node.vis),
2644 union_token: node.union_token,
2645 ident: f.fold_ident(node.ident),
2646 generics: f.fold_generics(node.generics),
2647 fields: f.fold_fields_named(node.fields),
2648 }
2649 }
2650 #[cfg(feature = "full")]
2651 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2652 pub fn fold_item_use<F>(f: &mut F, node: crate::ItemUse) -> crate::ItemUse
2653 where
2654 F: Fold + ?Sized,
2655 {
2656 crate::ItemUse {
2657 attrs: f.fold_attributes(node.attrs),
2658 vis: f.fold_visibility(node.vis),
2659 use_token: node.use_token,
2660 leading_colon: node.leading_colon,
2661 tree: f.fold_use_tree(node.tree),
2662 semi_token: node.semi_token,
2663 }
2664 }
2665 #[cfg(feature = "full")]
2666 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2667 pub fn fold_label<F>(f: &mut F, node: crate::Label) -> crate::Label
2668 where
2669 F: Fold + ?Sized,
2670 {
2671 crate::Label {
2672 name: f.fold_lifetime(node.name),
2673 colon_token: node.colon_token,
2674 }
2675 }
2676 pub fn fold_lifetime<F>(f: &mut F, node: crate::Lifetime) -> crate::Lifetime
2677 where
2678 F: Fold + ?Sized,
2679 {
2680 crate::Lifetime {
2681 apostrophe: f.fold_span(node.apostrophe),
2682 ident: f.fold_ident(node.ident),
2683 }
2684 }
2685 #[cfg(any(feature = "derive", feature = "full"))]
2686 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2687 pub fn fold_lifetime_param<F>(
2688 f: &mut F,
2689 node: crate::LifetimeParam,
2690 ) -> crate::LifetimeParam
2691 where
2692 F: Fold + ?Sized,
2693 {
2694 crate::LifetimeParam {
2695 attrs: f.fold_attributes(node.attrs),
2696 lifetime: f.fold_lifetime(node.lifetime),
2697 colon_token: node.colon_token,
2698 bounds: crate::punctuated::fold(node.bounds, f, F::fold_lifetime),
2699 }
2700 }
2701 pub fn fold_lit<F>(f: &mut F, node: crate::Lit) -> crate::Lit
2702 where
2703 F: Fold + ?Sized,
2704 {
2705 match node {
2706 crate::Lit::Str(_binding_0) => crate::Lit::Str(f.fold_lit_str(_binding_0)),
2707 crate::Lit::ByteStr(_binding_0) => {
2708 crate::Lit::ByteStr(f.fold_lit_byte_str(_binding_0))
2709 }
2710 crate::Lit::CStr(_binding_0) => crate::Lit::CStr(f.fold_lit_cstr(_binding_0)),
2711 crate::Lit::Byte(_binding_0) => crate::Lit::Byte(f.fold_lit_byte(_binding_0)),
2712 crate::Lit::Char(_binding_0) => crate::Lit::Char(f.fold_lit_char(_binding_0)),
2713 crate::Lit::Int(_binding_0) => crate::Lit::Int(f.fold_lit_int(_binding_0)),
2714 crate::Lit::Float(_binding_0) => crate::Lit::Float(f.fold_lit_float(_binding_0)),
2715 crate::Lit::Bool(_binding_0) => crate::Lit::Bool(f.fold_lit_bool(_binding_0)),
2716 crate::Lit::Verbatim(_binding_0) => crate::Lit::Verbatim(_binding_0),
2717 }
2718 }
2719 pub fn fold_lit_bool<F>(f: &mut F, node: crate::LitBool) -> crate::LitBool
2720 where
2721 F: Fold + ?Sized,
2722 {
2723 crate::LitBool {
2724 value: node.value,
2725 span: f.fold_span(node.span),
2726 }
2727 }
2728 pub fn fold_lit_byte<F>(f: &mut F, node: crate::LitByte) -> crate::LitByte
2729 where
2730 F: Fold + ?Sized,
2731 {
2732 let span = f.fold_span(node.span());
2733 let mut node = node;
2734 node.set_span(span);
2735 node
2736 }
2737 pub fn fold_lit_byte_str<F>(f: &mut F, node: crate::LitByteStr) -> crate::LitByteStr
2738 where
2739 F: Fold + ?Sized,
2740 {
2741 let span = f.fold_span(node.span());
2742 let mut node = node;
2743 node.set_span(span);
2744 node
2745 }
2746 pub fn fold_lit_cstr<F>(f: &mut F, node: crate::LitCStr) -> crate::LitCStr
2747 where
2748 F: Fold + ?Sized,
2749 {
2750 let span = f.fold_span(node.span());
2751 let mut node = node;
2752 node.set_span(span);
2753 node
2754 }
2755 pub fn fold_lit_char<F>(f: &mut F, node: crate::LitChar) -> crate::LitChar
2756 where
2757 F: Fold + ?Sized,
2758 {
2759 let span = f.fold_span(node.span());
2760 let mut node = node;
2761 node.set_span(span);
2762 node
2763 }
2764 pub fn fold_lit_float<F>(f: &mut F, node: crate::LitFloat) -> crate::LitFloat
2765 where
2766 F: Fold + ?Sized,
2767 {
2768 let span = f.fold_span(node.span());
2769 let mut node = node;
2770 node.set_span(span);
2771 node
2772 }
2773 pub fn fold_lit_int<F>(f: &mut F, node: crate::LitInt) -> crate::LitInt
2774 where
2775 F: Fold + ?Sized,
2776 {
2777 let span = f.fold_span(node.span());
2778 let mut node = node;
2779 node.set_span(span);
2780 node
2781 }
2782 pub fn fold_lit_str<F>(f: &mut F, node: crate::LitStr) -> crate::LitStr
2783 where
2784 F: Fold + ?Sized,
2785 {
2786 let span = f.fold_span(node.span());
2787 let mut node = node;
2788 node.set_span(span);
2789 node
2790 }
2791 #[cfg(feature = "full")]
2792 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2793 pub fn fold_local<F>(f: &mut F, node: crate::Local) -> crate::Local
2794 where
2795 F: Fold + ?Sized,
2796 {
2797 crate::Local {
2798 attrs: f.fold_attributes(node.attrs),
2799 let_token: node.let_token,
2800 pat: f.fold_pat(node.pat),
2801 init: (node.init).map(|it| f.fold_local_init(it)),
2802 semi_token: node.semi_token,
2803 }
2804 }
2805 #[cfg(feature = "full")]
2806 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2807 pub fn fold_local_init<F>(f: &mut F, node: crate::LocalInit) -> crate::LocalInit
2808 where
2809 F: Fold + ?Sized,
2810 {
2811 crate::LocalInit {
2812 eq_token: node.eq_token,
2813 expr: Box::new(f.fold_expr(*node.expr)),
2814 diverge: (node.diverge).map(|it| ((it).0, Box::new(f.fold_expr(*(it).1)))),
2815 }
2816 }
2817 #[cfg(any(feature = "derive", feature = "full"))]
2818 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2819 pub fn fold_macro<F>(f: &mut F, node: crate::Macro) -> crate::Macro
2820 where
2821 F: Fold + ?Sized,
2822 {
2823 crate::Macro {
2824 path: f.fold_path(node.path),
2825 bang_token: node.bang_token,
2826 delimiter: f.fold_macro_delimiter(node.delimiter),
2827 tokens: f.fold_token_stream(node.tokens),
2828 }
2829 }
2830 #[cfg(any(feature = "derive", feature = "full"))]
2831 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2832 pub fn fold_macro_delimiter<F>(
2833 f: &mut F,
2834 node: crate::MacroDelimiter,
2835 ) -> crate::MacroDelimiter
2836 where
2837 F: Fold + ?Sized,
2838 {
2839 match node {
2840 crate::MacroDelimiter::Paren(_binding_0) => {
2841 crate::MacroDelimiter::Paren(_binding_0)
2842 }
2843 crate::MacroDelimiter::Brace(_binding_0) => {
2844 crate::MacroDelimiter::Brace(_binding_0)
2845 }
2846 crate::MacroDelimiter::Bracket(_binding_0) => {
2847 crate::MacroDelimiter::Bracket(_binding_0)
2848 }
2849 }
2850 }
2851 #[cfg(any(feature = "derive", feature = "full"))]
2852 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2853 pub fn fold_member<F>(f: &mut F, node: crate::Member) -> crate::Member
2854 where
2855 F: Fold + ?Sized,
2856 {
2857 match node {
2858 crate::Member::Named(_binding_0) => {
2859 crate::Member::Named(f.fold_ident(_binding_0))
2860 }
2861 crate::Member::Unnamed(_binding_0) => {
2862 crate::Member::Unnamed(f.fold_index(_binding_0))
2863 }
2864 }
2865 }
2866 #[cfg(any(feature = "derive", feature = "full"))]
2867 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2868 pub fn fold_meta<F>(f: &mut F, node: crate::Meta) -> crate::Meta
2869 where
2870 F: Fold + ?Sized,
2871 {
2872 match node {
2873 crate::Meta::Path(_binding_0) => crate::Meta::Path(f.fold_path(_binding_0)),
2874 crate::Meta::List(_binding_0) => crate::Meta::List(f.fold_meta_list(_binding_0)),
2875 crate::Meta::NameValue(_binding_0) => {
2876 crate::Meta::NameValue(f.fold_meta_name_value(_binding_0))
2877 }
2878 }
2879 }
2880 #[cfg(any(feature = "derive", feature = "full"))]
2881 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2882 pub fn fold_meta_list<F>(f: &mut F, node: crate::MetaList) -> crate::MetaList
2883 where
2884 F: Fold + ?Sized,
2885 {
2886 crate::MetaList {
2887 path: f.fold_path(node.path),
2888 delimiter: f.fold_macro_delimiter(node.delimiter),
2889 tokens: f.fold_token_stream(node.tokens),
2890 }
2891 }
2892 #[cfg(any(feature = "derive", feature = "full"))]
2893 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2894 pub fn fold_meta_name_value<F>(
2895 f: &mut F,
2896 node: crate::MetaNameValue,
2897 ) -> crate::MetaNameValue
2898 where
2899 F: Fold + ?Sized,
2900 {
2901 crate::MetaNameValue {
2902 path: f.fold_path(node.path),
2903 eq_token: node.eq_token,
2904 value: f.fold_expr(node.value),
2905 }
2906 }
2907 #[cfg(any(feature = "derive", feature = "full"))]
2908 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
2909 pub fn fold_parenthesized_generic_arguments<F>(
2910 f: &mut F,
2911 node: crate::ParenthesizedGenericArguments,
2912 ) -> crate::ParenthesizedGenericArguments
2913 where
2914 F: Fold + ?Sized,
2915 {
2916 crate::ParenthesizedGenericArguments {
2917 paren_token: node.paren_token,
2918 inputs: crate::punctuated::fold(node.inputs, f, F::fold_type),
2919 output: f.fold_return_type(node.output),
2920 }
2921 }
2922 #[cfg(feature = "full")]
2923 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2924 pub fn fold_pat<F>(f: &mut F, node: crate::Pat) -> crate::Pat
2925 where
2926 F: Fold + ?Sized,
2927 {
2928 match node {
2929 crate::Pat::Const(_binding_0) => crate::Pat::Const(f.fold_expr_const(_binding_0)),
2930 crate::Pat::Ident(_binding_0) => crate::Pat::Ident(f.fold_pat_ident(_binding_0)),
2931 crate::Pat::Lit(_binding_0) => crate::Pat::Lit(f.fold_expr_lit(_binding_0)),
2932 crate::Pat::Macro(_binding_0) => crate::Pat::Macro(f.fold_expr_macro(_binding_0)),
2933 crate::Pat::Or(_binding_0) => crate::Pat::Or(f.fold_pat_or(_binding_0)),
2934 crate::Pat::Paren(_binding_0) => crate::Pat::Paren(f.fold_pat_paren(_binding_0)),
2935 crate::Pat::Path(_binding_0) => crate::Pat::Path(f.fold_expr_path(_binding_0)),
2936 crate::Pat::Range(_binding_0) => crate::Pat::Range(f.fold_expr_range(_binding_0)),
2937 crate::Pat::Reference(_binding_0) => {
2938 crate::Pat::Reference(f.fold_pat_reference(_binding_0))
2939 }
2940 crate::Pat::Rest(_binding_0) => crate::Pat::Rest(f.fold_pat_rest(_binding_0)),
2941 crate::Pat::Slice(_binding_0) => crate::Pat::Slice(f.fold_pat_slice(_binding_0)),
2942 crate::Pat::Struct(_binding_0) => {
2943 crate::Pat::Struct(f.fold_pat_struct(_binding_0))
2944 }
2945 crate::Pat::Tuple(_binding_0) => crate::Pat::Tuple(f.fold_pat_tuple(_binding_0)),
2946 crate::Pat::TupleStruct(_binding_0) => {
2947 crate::Pat::TupleStruct(f.fold_pat_tuple_struct(_binding_0))
2948 }
2949 crate::Pat::Type(_binding_0) => crate::Pat::Type(f.fold_pat_type(_binding_0)),
2950 crate::Pat::Verbatim(_binding_0) => {
2951 crate::Pat::Verbatim(f.fold_token_stream(_binding_0))
2952 }
2953 crate::Pat::Wild(_binding_0) => crate::Pat::Wild(f.fold_pat_wild(_binding_0)),
2954 }
2955 }
2956 #[cfg(feature = "full")]
2957 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2958 pub fn fold_pat_ident<F>(f: &mut F, node: crate::PatIdent) -> crate::PatIdent
2959 where
2960 F: Fold + ?Sized,
2961 {
2962 crate::PatIdent {
2963 attrs: f.fold_attributes(node.attrs),
2964 by_ref: node.by_ref,
2965 mutability: node.mutability,
2966 ident: f.fold_ident(node.ident),
2967 subpat: (node.subpat).map(|it| ((it).0, Box::new(f.fold_pat(*(it).1)))),
2968 }
2969 }
2970 #[cfg(feature = "full")]
2971 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2972 pub fn fold_pat_or<F>(f: &mut F, node: crate::PatOr) -> crate::PatOr
2973 where
2974 F: Fold + ?Sized,
2975 {
2976 crate::PatOr {
2977 attrs: f.fold_attributes(node.attrs),
2978 leading_vert: node.leading_vert,
2979 cases: crate::punctuated::fold(node.cases, f, F::fold_pat),
2980 }
2981 }
2982 #[cfg(feature = "full")]
2983 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2984 pub fn fold_pat_paren<F>(f: &mut F, node: crate::PatParen) -> crate::PatParen
2985 where
2986 F: Fold + ?Sized,
2987 {
2988 crate::PatParen {
2989 attrs: f.fold_attributes(node.attrs),
2990 paren_token: node.paren_token,
2991 pat: Box::new(f.fold_pat(*node.pat)),
2992 }
2993 }
2994 #[cfg(feature = "full")]
2995 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
2996 pub fn fold_pat_reference<F>(f: &mut F, node: crate::PatReference) -> crate::PatReference
2997 where
2998 F: Fold + ?Sized,
2999 {
3000 crate::PatReference {
3001 attrs: f.fold_attributes(node.attrs),
3002 and_token: node.and_token,
3003 mutability: node.mutability,
3004 pat: Box::new(f.fold_pat(*node.pat)),
3005 }
3006 }
3007 #[cfg(feature = "full")]
3008 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3009 pub fn fold_pat_rest<F>(f: &mut F, node: crate::PatRest) -> crate::PatRest
3010 where
3011 F: Fold + ?Sized,
3012 {
3013 crate::PatRest {
3014 attrs: f.fold_attributes(node.attrs),
3015 dot2_token: node.dot2_token,
3016 }
3017 }
3018 #[cfg(feature = "full")]
3019 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3020 pub fn fold_pat_slice<F>(f: &mut F, node: crate::PatSlice) -> crate::PatSlice
3021 where
3022 F: Fold + ?Sized,
3023 {
3024 crate::PatSlice {
3025 attrs: f.fold_attributes(node.attrs),
3026 bracket_token: node.bracket_token,
3027 elems: crate::punctuated::fold(node.elems, f, F::fold_pat),
3028 }
3029 }
3030 #[cfg(feature = "full")]
3031 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3032 pub fn fold_pat_struct<F>(f: &mut F, node: crate::PatStruct) -> crate::PatStruct
3033 where
3034 F: Fold + ?Sized,
3035 {
3036 crate::PatStruct {
3037 attrs: f.fold_attributes(node.attrs),
3038 qself: (node.qself).map(|it| f.fold_qself(it)),
3039 path: f.fold_path(node.path),
3040 brace_token: node.brace_token,
3041 fields: crate::punctuated::fold(node.fields, f, F::fold_field_pat),
3042 rest: (node.rest).map(|it| f.fold_pat_rest(it)),
3043 }
3044 }
3045 #[cfg(feature = "full")]
3046 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3047 pub fn fold_pat_tuple<F>(f: &mut F, node: crate::PatTuple) -> crate::PatTuple
3048 where
3049 F: Fold + ?Sized,
3050 {
3051 crate::PatTuple {
3052 attrs: f.fold_attributes(node.attrs),
3053 paren_token: node.paren_token,
3054 elems: crate::punctuated::fold(node.elems, f, F::fold_pat),
3055 }
3056 }
3057 #[cfg(feature = "full")]
3058 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3059 pub fn fold_pat_tuple_struct<F>(
3060 f: &mut F,
3061 node: crate::PatTupleStruct,
3062 ) -> crate::PatTupleStruct
3063 where
3064 F: Fold + ?Sized,
3065 {
3066 crate::PatTupleStruct {
3067 attrs: f.fold_attributes(node.attrs),
3068 qself: (node.qself).map(|it| f.fold_qself(it)),
3069 path: f.fold_path(node.path),
3070 paren_token: node.paren_token,
3071 elems: crate::punctuated::fold(node.elems, f, F::fold_pat),
3072 }
3073 }
3074 #[cfg(feature = "full")]
3075 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3076 pub fn fold_pat_type<F>(f: &mut F, node: crate::PatType) -> crate::PatType
3077 where
3078 F: Fold + ?Sized,
3079 {
3080 crate::PatType {
3081 attrs: f.fold_attributes(node.attrs),
3082 pat: Box::new(f.fold_pat(*node.pat)),
3083 colon_token: node.colon_token,
3084 ty: Box::new(f.fold_type(*node.ty)),
3085 }
3086 }
3087 #[cfg(feature = "full")]
3088 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3089 pub fn fold_pat_wild<F>(f: &mut F, node: crate::PatWild) -> crate::PatWild
3090 where
3091 F: Fold + ?Sized,
3092 {
3093 crate::PatWild {
3094 attrs: f.fold_attributes(node.attrs),
3095 underscore_token: node.underscore_token,
3096 }
3097 }
3098 #[cfg(any(feature = "derive", feature = "full"))]
3099 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3100 pub fn fold_path<F>(f: &mut F, node: crate::Path) -> crate::Path
3101 where
3102 F: Fold + ?Sized,
3103 {
3104 crate::Path {
3105 leading_colon: node.leading_colon,
3106 segments: crate::punctuated::fold(node.segments, f, F::fold_path_segment),
3107 }
3108 }
3109 #[cfg(any(feature = "derive", feature = "full"))]
3110 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3111 pub fn fold_path_arguments<F>(
3112 f: &mut F,
3113 node: crate::PathArguments,
3114 ) -> crate::PathArguments
3115 where
3116 F: Fold + ?Sized,
3117 {
3118 match node {
3119 crate::PathArguments::None => crate::PathArguments::None,
3120 crate::PathArguments::AngleBracketed(_binding_0) => {
3121 crate::PathArguments::AngleBracketed(
3122 f.fold_angle_bracketed_generic_arguments(_binding_0),
3123 )
3124 }
3125 crate::PathArguments::Parenthesized(_binding_0) => {
3126 crate::PathArguments::Parenthesized(
3127 f.fold_parenthesized_generic_arguments(_binding_0),
3128 )
3129 }
3130 }
3131 }
3132 #[cfg(any(feature = "derive", feature = "full"))]
3133 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3134 pub fn fold_path_segment<F>(f: &mut F, node: crate::PathSegment) -> crate::PathSegment
3135 where
3136 F: Fold + ?Sized,
3137 {
3138 crate::PathSegment {
3139 ident: f.fold_ident(node.ident),
3140 arguments: f.fold_path_arguments(node.arguments),
3141 }
3142 }
3143 #[cfg(feature = "full")]
3144 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3145 pub fn fold_pointer_mutability<F>(
3146 f: &mut F,
3147 node: crate::PointerMutability,
3148 ) -> crate::PointerMutability
3149 where
3150 F: Fold + ?Sized,
3151 {
3152 match node {
3153 crate::PointerMutability::Const(_binding_0) => {
3154 crate::PointerMutability::Const(_binding_0)
3155 }
3156 crate::PointerMutability::Mut(_binding_0) => {
3157 crate::PointerMutability::Mut(_binding_0)
3158 }
3159 }
3160 }
3161 #[cfg(feature = "full")]
3162 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3163 pub fn fold_precise_capture<F>(
3164 f: &mut F,
3165 node: crate::PreciseCapture,
3166 ) -> crate::PreciseCapture
3167 where
3168 F: Fold + ?Sized,
3169 {
3170 crate::PreciseCapture {
3171 use_token: node.use_token,
3172 lt_token: node.lt_token,
3173 params: crate::punctuated::fold(node.params, f, F::fold_captured_param),
3174 gt_token: node.gt_token,
3175 }
3176 }
3177 #[cfg(any(feature = "derive", feature = "full"))]
3178 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3179 pub fn fold_predicate_lifetime<F>(
3180 f: &mut F,
3181 node: crate::PredicateLifetime,
3182 ) -> crate::PredicateLifetime
3183 where
3184 F: Fold + ?Sized,
3185 {
3186 crate::PredicateLifetime {
3187 lifetime: f.fold_lifetime(node.lifetime),
3188 colon_token: node.colon_token,
3189 bounds: crate::punctuated::fold(node.bounds, f, F::fold_lifetime),
3190 }
3191 }
3192 #[cfg(any(feature = "derive", feature = "full"))]
3193 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3194 pub fn fold_predicate_type<F>(
3195 f: &mut F,
3196 node: crate::PredicateType,
3197 ) -> crate::PredicateType
3198 where
3199 F: Fold + ?Sized,
3200 {
3201 crate::PredicateType {
3202 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
3203 bounded_ty: f.fold_type(node.bounded_ty),
3204 colon_token: node.colon_token,
3205 bounds: crate::punctuated::fold(node.bounds, f, F::fold_type_param_bound),
3206 }
3207 }
3208 #[cfg(any(feature = "derive", feature = "full"))]
3209 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3210 pub fn fold_qself<F>(f: &mut F, node: crate::QSelf) -> crate::QSelf
3211 where
3212 F: Fold + ?Sized,
3213 {
3214 crate::QSelf {
3215 lt_token: node.lt_token,
3216 ty: Box::new(f.fold_type(*node.ty)),
3217 position: node.position,
3218 as_token: node.as_token,
3219 gt_token: node.gt_token,
3220 }
3221 }
3222 #[cfg(feature = "full")]
3223 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3224 pub fn fold_range_limits<F>(f: &mut F, node: crate::RangeLimits) -> crate::RangeLimits
3225 where
3226 F: Fold + ?Sized,
3227 {
3228 match node {
3229 crate::RangeLimits::HalfOpen(_binding_0) => {
3230 crate::RangeLimits::HalfOpen(_binding_0)
3231 }
3232 crate::RangeLimits::Closed(_binding_0) => crate::RangeLimits::Closed(_binding_0),
3233 }
3234 }
3235 #[cfg(feature = "full")]
3236 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3237 pub fn fold_receiver<F>(f: &mut F, node: crate::Receiver) -> crate::Receiver
3238 where
3239 F: Fold + ?Sized,
3240 {
3241 crate::Receiver {
3242 attrs: f.fold_attributes(node.attrs),
3243 reference: (node.reference)
3244 .map(|it| ((it).0, ((it).1).map(|it| f.fold_lifetime(it)))),
3245 mutability: node.mutability,
3246 self_token: node.self_token,
3247 colon_token: node.colon_token,
3248 ty: Box::new(f.fold_type(*node.ty)),
3249 }
3250 }
3251 #[cfg(any(feature = "derive", feature = "full"))]
3252 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3253 pub fn fold_return_type<F>(f: &mut F, node: crate::ReturnType) -> crate::ReturnType
3254 where
3255 F: Fold + ?Sized,
3256 {
3257 match node {
3258 crate::ReturnType::Default => crate::ReturnType::Default,
3259 crate::ReturnType::Type(_binding_0, _binding_1) => {
3260 crate::ReturnType::Type(_binding_0, Box::new(f.fold_type(*_binding_1)))
3261 }
3262 }
3263 }
3264 #[cfg(feature = "full")]
3265 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3266 pub fn fold_signature<F>(f: &mut F, node: crate::Signature) -> crate::Signature
3267 where
3268 F: Fold + ?Sized,
3269 {
3270 crate::Signature {
3271 constness: node.constness,
3272 asyncness: node.asyncness,
3273 unsafety: node.unsafety,
3274 abi: (node.abi).map(|it| f.fold_abi(it)),
3275 fn_token: node.fn_token,
3276 ident: f.fold_ident(node.ident),
3277 generics: f.fold_generics(node.generics),
3278 paren_token: node.paren_token,
3279 inputs: crate::punctuated::fold(node.inputs, f, F::fold_fn_arg),
3280 variadic: (node.variadic).map(|it| f.fold_variadic(it)),
3281 output: f.fold_return_type(node.output),
3282 }
3283 }
3284 pub fn fold_span<F>(f: &mut F, node: proc_macro2::Span) -> proc_macro2::Span
3285 where
3286 F: Fold + ?Sized,
3287 {
3288 node
3289 }
3290 #[cfg(feature = "full")]
3291 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3292 pub fn fold_static_mutability<F>(
3293 f: &mut F,
3294 node: crate::StaticMutability,
3295 ) -> crate::StaticMutability
3296 where
3297 F: Fold + ?Sized,
3298 {
3299 match node {
3300 crate::StaticMutability::Mut(_binding_0) => {
3301 crate::StaticMutability::Mut(_binding_0)
3302 }
3303 crate::StaticMutability::None => crate::StaticMutability::None,
3304 }
3305 }
3306 #[cfg(feature = "full")]
3307 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3308 pub fn fold_stmt<F>(f: &mut F, node: crate::Stmt) -> crate::Stmt
3309 where
3310 F: Fold + ?Sized,
3311 {
3312 match node {
3313 crate::Stmt::Local(_binding_0) => crate::Stmt::Local(f.fold_local(_binding_0)),
3314 crate::Stmt::Item(_binding_0) => crate::Stmt::Item(f.fold_item(_binding_0)),
3315 crate::Stmt::Expr(_binding_0, _binding_1) => {
3316 crate::Stmt::Expr(f.fold_expr(_binding_0), _binding_1)
3317 }
3318 crate::Stmt::Macro(_binding_0) => {
3319 crate::Stmt::Macro(f.fold_stmt_macro(_binding_0))
3320 }
3321 }
3322 }
3323 #[cfg(feature = "full")]
3324 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3325 pub fn fold_stmt_macro<F>(f: &mut F, node: crate::StmtMacro) -> crate::StmtMacro
3326 where
3327 F: Fold + ?Sized,
3328 {
3329 crate::StmtMacro {
3330 attrs: f.fold_attributes(node.attrs),
3331 mac: f.fold_macro(node.mac),
3332 semi_token: node.semi_token,
3333 }
3334 }
3335 #[cfg(any(feature = "derive", feature = "full"))]
3336 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3337 pub fn fold_trait_bound<F>(f: &mut F, node: crate::TraitBound) -> crate::TraitBound
3338 where
3339 F: Fold + ?Sized,
3340 {
3341 crate::TraitBound {
3342 paren_token: node.paren_token,
3343 modifier: f.fold_trait_bound_modifier(node.modifier),
3344 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
3345 path: f.fold_path(node.path),
3346 }
3347 }
3348 #[cfg(any(feature = "derive", feature = "full"))]
3349 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3350 pub fn fold_trait_bound_modifier<F>(
3351 f: &mut F,
3352 node: crate::TraitBoundModifier,
3353 ) -> crate::TraitBoundModifier
3354 where
3355 F: Fold + ?Sized,
3356 {
3357 match node {
3358 crate::TraitBoundModifier::None => crate::TraitBoundModifier::None,
3359 crate::TraitBoundModifier::Maybe(_binding_0) => {
3360 crate::TraitBoundModifier::Maybe(_binding_0)
3361 }
3362 }
3363 }
3364 #[cfg(feature = "full")]
3365 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3366 pub fn fold_trait_item<F>(f: &mut F, node: crate::TraitItem) -> crate::TraitItem
3367 where
3368 F: Fold + ?Sized,
3369 {
3370 match node {
3371 crate::TraitItem::Const(_binding_0) => {
3372 crate::TraitItem::Const(f.fold_trait_item_const(_binding_0))
3373 }
3374 crate::TraitItem::Fn(_binding_0) => {
3375 crate::TraitItem::Fn(f.fold_trait_item_fn(_binding_0))
3376 }
3377 crate::TraitItem::Type(_binding_0) => {
3378 crate::TraitItem::Type(f.fold_trait_item_type(_binding_0))
3379 }
3380 crate::TraitItem::Macro(_binding_0) => {
3381 crate::TraitItem::Macro(f.fold_trait_item_macro(_binding_0))
3382 }
3383 crate::TraitItem::Verbatim(_binding_0) => {
3384 crate::TraitItem::Verbatim(f.fold_token_stream(_binding_0))
3385 }
3386 }
3387 }
3388 #[cfg(feature = "full")]
3389 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3390 pub fn fold_trait_item_const<F>(
3391 f: &mut F,
3392 node: crate::TraitItemConst,
3393 ) -> crate::TraitItemConst
3394 where
3395 F: Fold + ?Sized,
3396 {
3397 crate::TraitItemConst {
3398 attrs: f.fold_attributes(node.attrs),
3399 const_token: node.const_token,
3400 ident: f.fold_ident(node.ident),
3401 generics: f.fold_generics(node.generics),
3402 colon_token: node.colon_token,
3403 ty: f.fold_type(node.ty),
3404 default: (node.default).map(|it| ((it).0, f.fold_expr((it).1))),
3405 semi_token: node.semi_token,
3406 }
3407 }
3408 #[cfg(feature = "full")]
3409 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3410 pub fn fold_trait_item_fn<F>(f: &mut F, node: crate::TraitItemFn) -> crate::TraitItemFn
3411 where
3412 F: Fold + ?Sized,
3413 {
3414 crate::TraitItemFn {
3415 attrs: f.fold_attributes(node.attrs),
3416 sig: f.fold_signature(node.sig),
3417 default: (node.default).map(|it| f.fold_block(it)),
3418 semi_token: node.semi_token,
3419 }
3420 }
3421 #[cfg(feature = "full")]
3422 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3423 pub fn fold_trait_item_macro<F>(
3424 f: &mut F,
3425 node: crate::TraitItemMacro,
3426 ) -> crate::TraitItemMacro
3427 where
3428 F: Fold + ?Sized,
3429 {
3430 crate::TraitItemMacro {
3431 attrs: f.fold_attributes(node.attrs),
3432 mac: f.fold_macro(node.mac),
3433 semi_token: node.semi_token,
3434 }
3435 }
3436 #[cfg(feature = "full")]
3437 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3438 pub fn fold_trait_item_type<F>(
3439 f: &mut F,
3440 node: crate::TraitItemType,
3441 ) -> crate::TraitItemType
3442 where
3443 F: Fold + ?Sized,
3444 {
3445 crate::TraitItemType {
3446 attrs: f.fold_attributes(node.attrs),
3447 type_token: node.type_token,
3448 ident: f.fold_ident(node.ident),
3449 generics: f.fold_generics(node.generics),
3450 colon_token: node.colon_token,
3451 bounds: crate::punctuated::fold(node.bounds, f, F::fold_type_param_bound),
3452 default: (node.default).map(|it| ((it).0, f.fold_type((it).1))),
3453 semi_token: node.semi_token,
3454 }
3455 }
3456 #[cfg(any(feature = "derive", feature = "full"))]
3457 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3458 pub fn fold_type<F>(f: &mut F, node: crate::Type) -> crate::Type
3459 where
3460 F: Fold + ?Sized,
3461 {
3462 match node {
3463 crate::Type::Array(_binding_0) => {
3464 crate::Type::Array(f.fold_type_array(_binding_0))
3465 }
3466 crate::Type::BareFn(_binding_0) => {
3467 crate::Type::BareFn(f.fold_type_bare_fn(_binding_0))
3468 }
3469 crate::Type::Group(_binding_0) => {
3470 crate::Type::Group(f.fold_type_group(_binding_0))
3471 }
3472 crate::Type::ImplTrait(_binding_0) => {
3473 crate::Type::ImplTrait(f.fold_type_impl_trait(_binding_0))
3474 }
3475 crate::Type::Infer(_binding_0) => {
3476 crate::Type::Infer(f.fold_type_infer(_binding_0))
3477 }
3478 crate::Type::Macro(_binding_0) => {
3479 crate::Type::Macro(f.fold_type_macro(_binding_0))
3480 }
3481 crate::Type::Never(_binding_0) => {
3482 crate::Type::Never(f.fold_type_never(_binding_0))
3483 }
3484 crate::Type::Paren(_binding_0) => {
3485 crate::Type::Paren(f.fold_type_paren(_binding_0))
3486 }
3487 crate::Type::Path(_binding_0) => crate::Type::Path(f.fold_type_path(_binding_0)),
3488 crate::Type::Ptr(_binding_0) => crate::Type::Ptr(f.fold_type_ptr(_binding_0)),
3489 crate::Type::Reference(_binding_0) => {
3490 crate::Type::Reference(f.fold_type_reference(_binding_0))
3491 }
3492 crate::Type::Slice(_binding_0) => {
3493 crate::Type::Slice(f.fold_type_slice(_binding_0))
3494 }
3495 crate::Type::TraitObject(_binding_0) => {
3496 crate::Type::TraitObject(f.fold_type_trait_object(_binding_0))
3497 }
3498 crate::Type::Tuple(_binding_0) => {
3499 crate::Type::Tuple(f.fold_type_tuple(_binding_0))
3500 }
3501 crate::Type::Verbatim(_binding_0) => {
3502 crate::Type::Verbatim(f.fold_token_stream(_binding_0))
3503 }
3504 }
3505 }
3506 #[cfg(any(feature = "derive", feature = "full"))]
3507 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3508 pub fn fold_type_array<F>(f: &mut F, node: crate::TypeArray) -> crate::TypeArray
3509 where
3510 F: Fold + ?Sized,
3511 {
3512 crate::TypeArray {
3513 bracket_token: node.bracket_token,
3514 elem: Box::new(f.fold_type(*node.elem)),
3515 semi_token: node.semi_token,
3516 len: f.fold_expr(node.len),
3517 }
3518 }
3519 #[cfg(any(feature = "derive", feature = "full"))]
3520 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3521 pub fn fold_type_bare_fn<F>(f: &mut F, node: crate::TypeBareFn) -> crate::TypeBareFn
3522 where
3523 F: Fold + ?Sized,
3524 {
3525 crate::TypeBareFn {
3526 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
3527 unsafety: node.unsafety,
3528 abi: (node.abi).map(|it| f.fold_abi(it)),
3529 fn_token: node.fn_token,
3530 paren_token: node.paren_token,
3531 inputs: crate::punctuated::fold(node.inputs, f, F::fold_bare_fn_arg),
3532 variadic: (node.variadic).map(|it| f.fold_bare_variadic(it)),
3533 output: f.fold_return_type(node.output),
3534 }
3535 }
3536 #[cfg(any(feature = "derive", feature = "full"))]
3537 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3538 pub fn fold_type_group<F>(f: &mut F, node: crate::TypeGroup) -> crate::TypeGroup
3539 where
3540 F: Fold + ?Sized,
3541 {
3542 crate::TypeGroup {
3543 group_token: node.group_token,
3544 elem: Box::new(f.fold_type(*node.elem)),
3545 }
3546 }
3547 #[cfg(any(feature = "derive", feature = "full"))]
3548 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3549 pub fn fold_type_impl_trait<F>(
3550 f: &mut F,
3551 node: crate::TypeImplTrait,
3552 ) -> crate::TypeImplTrait
3553 where
3554 F: Fold + ?Sized,
3555 {
3556 crate::TypeImplTrait {
3557 impl_token: node.impl_token,
3558 bounds: crate::punctuated::fold(node.bounds, f, F::fold_type_param_bound),
3559 }
3560 }
3561 #[cfg(any(feature = "derive", feature = "full"))]
3562 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3563 pub fn fold_type_infer<F>(f: &mut F, node: crate::TypeInfer) -> crate::TypeInfer
3564 where
3565 F: Fold + ?Sized,
3566 {
3567 crate::TypeInfer {
3568 underscore_token: node.underscore_token,
3569 }
3570 }
3571 #[cfg(any(feature = "derive", feature = "full"))]
3572 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3573 pub fn fold_type_macro<F>(f: &mut F, node: crate::TypeMacro) -> crate::TypeMacro
3574 where
3575 F: Fold + ?Sized,
3576 {
3577 crate::TypeMacro {
3578 mac: f.fold_macro(node.mac),
3579 }
3580 }
3581 #[cfg(any(feature = "derive", feature = "full"))]
3582 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3583 pub fn fold_type_never<F>(f: &mut F, node: crate::TypeNever) -> crate::TypeNever
3584 where
3585 F: Fold + ?Sized,
3586 {
3587 crate::TypeNever {
3588 bang_token: node.bang_token,
3589 }
3590 }
3591 #[cfg(any(feature = "derive", feature = "full"))]
3592 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3593 pub fn fold_type_param<F>(f: &mut F, node: crate::TypeParam) -> crate::TypeParam
3594 where
3595 F: Fold + ?Sized,
3596 {
3597 crate::TypeParam {
3598 attrs: f.fold_attributes(node.attrs),
3599 ident: f.fold_ident(node.ident),
3600 colon_token: node.colon_token,
3601 bounds: crate::punctuated::fold(node.bounds, f, F::fold_type_param_bound),
3602 eq_token: node.eq_token,
3603 default: (node.default).map(|it| f.fold_type(it)),
3604 }
3605 }
3606 #[cfg(any(feature = "derive", feature = "full"))]
3607 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3608 pub fn fold_type_param_bound<F>(
3609 f: &mut F,
3610 node: crate::TypeParamBound,
3611 ) -> crate::TypeParamBound
3612 where
3613 F: Fold + ?Sized,
3614 {
3615 match node {
3616 crate::TypeParamBound::Trait(_binding_0) => {
3617 crate::TypeParamBound::Trait(f.fold_trait_bound(_binding_0))
3618 }
3619 crate::TypeParamBound::Lifetime(_binding_0) => {
3620 crate::TypeParamBound::Lifetime(f.fold_lifetime(_binding_0))
3621 }
3622 crate::TypeParamBound::PreciseCapture(_binding_0) => {
3623 crate::TypeParamBound::PreciseCapture(
3624 full!(f.fold_precise_capture(_binding_0)),
3625 )
3626 }
3627 crate::TypeParamBound::Verbatim(_binding_0) => {
3628 crate::TypeParamBound::Verbatim(f.fold_token_stream(_binding_0))
3629 }
3630 }
3631 }
3632 #[cfg(any(feature = "derive", feature = "full"))]
3633 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3634 pub fn fold_type_paren<F>(f: &mut F, node: crate::TypeParen) -> crate::TypeParen
3635 where
3636 F: Fold + ?Sized,
3637 {
3638 crate::TypeParen {
3639 paren_token: node.paren_token,
3640 elem: Box::new(f.fold_type(*node.elem)),
3641 }
3642 }
3643 #[cfg(any(feature = "derive", feature = "full"))]
3644 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3645 pub fn fold_type_path<F>(f: &mut F, node: crate::TypePath) -> crate::TypePath
3646 where
3647 F: Fold + ?Sized,
3648 {
3649 crate::TypePath {
3650 qself: (node.qself).map(|it| f.fold_qself(it)),
3651 path: f.fold_path(node.path),
3652 }
3653 }
3654 #[cfg(any(feature = "derive", feature = "full"))]
3655 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3656 pub fn fold_type_ptr<F>(f: &mut F, node: crate::TypePtr) -> crate::TypePtr
3657 where
3658 F: Fold + ?Sized,
3659 {
3660 crate::TypePtr {
3661 star_token: node.star_token,
3662 const_token: node.const_token,
3663 mutability: node.mutability,
3664 elem: Box::new(f.fold_type(*node.elem)),
3665 }
3666 }
3667 #[cfg(any(feature = "derive", feature = "full"))]
3668 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3669 pub fn fold_type_reference<F>(
3670 f: &mut F,
3671 node: crate::TypeReference,
3672 ) -> crate::TypeReference
3673 where
3674 F: Fold + ?Sized,
3675 {
3676 crate::TypeReference {
3677 and_token: node.and_token,
3678 lifetime: (node.lifetime).map(|it| f.fold_lifetime(it)),
3679 mutability: node.mutability,
3680 elem: Box::new(f.fold_type(*node.elem)),
3681 }
3682 }
3683 #[cfg(any(feature = "derive", feature = "full"))]
3684 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3685 pub fn fold_type_slice<F>(f: &mut F, node: crate::TypeSlice) -> crate::TypeSlice
3686 where
3687 F: Fold + ?Sized,
3688 {
3689 crate::TypeSlice {
3690 bracket_token: node.bracket_token,
3691 elem: Box::new(f.fold_type(*node.elem)),
3692 }
3693 }
3694 #[cfg(any(feature = "derive", feature = "full"))]
3695 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3696 pub fn fold_type_trait_object<F>(
3697 f: &mut F,
3698 node: crate::TypeTraitObject,
3699 ) -> crate::TypeTraitObject
3700 where
3701 F: Fold + ?Sized,
3702 {
3703 crate::TypeTraitObject {
3704 dyn_token: node.dyn_token,
3705 bounds: crate::punctuated::fold(node.bounds, f, F::fold_type_param_bound),
3706 }
3707 }
3708 #[cfg(any(feature = "derive", feature = "full"))]
3709 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3710 pub fn fold_type_tuple<F>(f: &mut F, node: crate::TypeTuple) -> crate::TypeTuple
3711 where
3712 F: Fold + ?Sized,
3713 {
3714 crate::TypeTuple {
3715 paren_token: node.paren_token,
3716 elems: crate::punctuated::fold(node.elems, f, F::fold_type),
3717 }
3718 }
3719 #[cfg(any(feature = "derive", feature = "full"))]
3720 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3721 pub fn fold_un_op<F>(f: &mut F, node: crate::UnOp) -> crate::UnOp
3722 where
3723 F: Fold + ?Sized,
3724 {
3725 match node {
3726 crate::UnOp::Deref(_binding_0) => crate::UnOp::Deref(_binding_0),
3727 crate::UnOp::Not(_binding_0) => crate::UnOp::Not(_binding_0),
3728 crate::UnOp::Neg(_binding_0) => crate::UnOp::Neg(_binding_0),
3729 }
3730 }
3731 #[cfg(feature = "full")]
3732 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3733 pub fn fold_use_glob<F>(f: &mut F, node: crate::UseGlob) -> crate::UseGlob
3734 where
3735 F: Fold + ?Sized,
3736 {
3737 crate::UseGlob {
3738 star_token: node.star_token,
3739 }
3740 }
3741 #[cfg(feature = "full")]
3742 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3743 pub fn fold_use_group<F>(f: &mut F, node: crate::UseGroup) -> crate::UseGroup
3744 where
3745 F: Fold + ?Sized,
3746 {
3747 crate::UseGroup {
3748 brace_token: node.brace_token,
3749 items: crate::punctuated::fold(node.items, f, F::fold_use_tree),
3750 }
3751 }
3752 #[cfg(feature = "full")]
3753 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3754 pub fn fold_use_name<F>(f: &mut F, node: crate::UseName) -> crate::UseName
3755 where
3756 F: Fold + ?Sized,
3757 {
3758 crate::UseName {
3759 ident: f.fold_ident(node.ident),
3760 }
3761 }
3762 #[cfg(feature = "full")]
3763 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3764 pub fn fold_use_path<F>(f: &mut F, node: crate::UsePath) -> crate::UsePath
3765 where
3766 F: Fold + ?Sized,
3767 {
3768 crate::UsePath {
3769 ident: f.fold_ident(node.ident),
3770 colon2_token: node.colon2_token,
3771 tree: Box::new(f.fold_use_tree(*node.tree)),
3772 }
3773 }
3774 #[cfg(feature = "full")]
3775 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3776 pub fn fold_use_rename<F>(f: &mut F, node: crate::UseRename) -> crate::UseRename
3777 where
3778 F: Fold + ?Sized,
3779 {
3780 crate::UseRename {
3781 ident: f.fold_ident(node.ident),
3782 as_token: node.as_token,
3783 rename: f.fold_ident(node.rename),
3784 }
3785 }
3786 #[cfg(feature = "full")]
3787 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3788 pub fn fold_use_tree<F>(f: &mut F, node: crate::UseTree) -> crate::UseTree
3789 where
3790 F: Fold + ?Sized,
3791 {
3792 match node {
3793 crate::UseTree::Path(_binding_0) => {
3794 crate::UseTree::Path(f.fold_use_path(_binding_0))
3795 }
3796 crate::UseTree::Name(_binding_0) => {
3797 crate::UseTree::Name(f.fold_use_name(_binding_0))
3798 }
3799 crate::UseTree::Rename(_binding_0) => {
3800 crate::UseTree::Rename(f.fold_use_rename(_binding_0))
3801 }
3802 crate::UseTree::Glob(_binding_0) => {
3803 crate::UseTree::Glob(f.fold_use_glob(_binding_0))
3804 }
3805 crate::UseTree::Group(_binding_0) => {
3806 crate::UseTree::Group(f.fold_use_group(_binding_0))
3807 }
3808 }
3809 }
3810 #[cfg(feature = "full")]
3811 #[cfg_attr(docsrs, doc(cfg(feature = "full")))]
3812 pub fn fold_variadic<F>(f: &mut F, node: crate::Variadic) -> crate::Variadic
3813 where
3814 F: Fold + ?Sized,
3815 {
3816 crate::Variadic {
3817 attrs: f.fold_attributes(node.attrs),
3818 pat: (node.pat).map(|it| (Box::new(f.fold_pat(*(it).0)), (it).1)),
3819 dots: node.dots,
3820 comma: node.comma,
3821 }
3822 }
3823 #[cfg(any(feature = "derive", feature = "full"))]
3824 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3825 pub fn fold_variant<F>(f: &mut F, node: crate::Variant) -> crate::Variant
3826 where
3827 F: Fold + ?Sized,
3828 {
3829 crate::Variant {
3830 attrs: f.fold_attributes(node.attrs),
3831 ident: f.fold_ident(node.ident),
3832 fields: f.fold_fields(node.fields),
3833 discriminant: (node.discriminant).map(|it| ((it).0, f.fold_expr((it).1))),
3834 }
3835 }
3836 #[cfg(any(feature = "derive", feature = "full"))]
3837 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3838 pub fn fold_vis_restricted<F>(
3839 f: &mut F,
3840 node: crate::VisRestricted,
3841 ) -> crate::VisRestricted
3842 where
3843 F: Fold + ?Sized,
3844 {
3845 crate::VisRestricted {
3846 pub_token: node.pub_token,
3847 paren_token: node.paren_token,
3848 in_token: node.in_token,
3849 path: Box::new(f.fold_path(*node.path)),
3850 }
3851 }
3852 #[cfg(any(feature = "derive", feature = "full"))]
3853 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3854 pub fn fold_visibility<F>(f: &mut F, node: crate::Visibility) -> crate::Visibility
3855 where
3856 F: Fold + ?Sized,
3857 {
3858 match node {
3859 crate::Visibility::Public(_binding_0) => crate::Visibility::Public(_binding_0),
3860 crate::Visibility::Restricted(_binding_0) => {
3861 crate::Visibility::Restricted(f.fold_vis_restricted(_binding_0))
3862 }
3863 crate::Visibility::Inherited => crate::Visibility::Inherited,
3864 }
3865 }
3866 #[cfg(any(feature = "derive", feature = "full"))]
3867 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3868 pub fn fold_where_clause<F>(f: &mut F, node: crate::WhereClause) -> crate::WhereClause
3869 where
3870 F: Fold + ?Sized,
3871 {
3872 crate::WhereClause {
3873 where_token: node.where_token,
3874 predicates: crate::punctuated::fold(node.predicates, f, F::fold_where_predicate),
3875 }
3876 }
3877 #[cfg(any(feature = "derive", feature = "full"))]
3878 #[cfg_attr(docsrs, doc(cfg(any(feature = "derive", feature = "full"))))]
3879 pub fn fold_where_predicate<F>(
3880 f: &mut F,
3881 node: crate::WherePredicate,
3882 ) -> crate::WherePredicate
3883 where
3884 F: Fold + ?Sized,
3885 {
3886 match node {
3887 crate::WherePredicate::Lifetime(_binding_0) => {
3888 crate::WherePredicate::Lifetime(f.fold_predicate_lifetime(_binding_0))
3889 }
3890 crate::WherePredicate::Type(_binding_0) => {
3891 crate::WherePredicate::Type(f.fold_predicate_type(_binding_0))
3892 }
3893 }
3894 }
3895 #[cfg(any(feature = "derive", feature = "full"))]
3896 fn fold_vec<T, V, F>(vec: Vec<T>, fold: &mut V, mut f: F) -> Vec<T>
3897 where
3898 V: ?Sized,
3899 F: FnMut(&mut V, T) -> T,
3900 {
3901 vec.into_iter().map(|it| f(fold, it)).collect()
3902 }