Debian Codegraph @

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