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