1 // This file is @generated by syn-internal-codegen.
2 // It is not intended for manual editing.
3
4 #![allow(unreachable_code, unused_variables)]
5 #![allow(
6 clippy::match_wildcard_for_single_variants,
7 clippy::needless_match,
8 clippy::needless_pass_by_ref_mut,
9 )]
10 #[cfg(any(feature = "full", feature = "derive"))]
11 use crate::gen::helper::fold::*;
12 use crate::*;
13 use proc_macro2::Span;
14 #[cfg(feature = "full")]
15 macro_rules! full {
16 ($e:expr) => {
17 $e
18 };
19 }
20 #[cfg(all(feature = "derive", not(feature = "full")))]
21 macro_rules! full {
22 ($e:expr) => {
23 unreachable!()
24 };
25 }
26 /// Syntax tree traversal to transform the nodes of an owned syntax tree.
27 ///
28 /// See the [module documentation] for details.
29 ///
30 /// [module documentation]: self
31 pub trait Fold {
32 #[cfg(any(feature = "derive", feature = "full"))]
fold_abi(&mut self, i: Abi) -> Abi33 fn fold_abi(&mut self, i: Abi) -> Abi {
34 fold_abi(self, i)
35 }
36 #[cfg(any(feature = "derive", feature = "full"))]
fold_angle_bracketed_generic_arguments( &mut self, i: AngleBracketedGenericArguments, ) -> AngleBracketedGenericArguments37 fn fold_angle_bracketed_generic_arguments(
38 &mut self,
39 i: AngleBracketedGenericArguments,
40 ) -> AngleBracketedGenericArguments {
41 fold_angle_bracketed_generic_arguments(self, i)
42 }
43 #[cfg(feature = "full")]
fold_arm(&mut self, i: Arm) -> Arm44 fn fold_arm(&mut self, i: Arm) -> Arm {
45 fold_arm(self, i)
46 }
47 #[cfg(any(feature = "derive", feature = "full"))]
fold_assoc_const(&mut self, i: AssocConst) -> AssocConst48 fn fold_assoc_const(&mut self, i: AssocConst) -> AssocConst {
49 fold_assoc_const(self, i)
50 }
51 #[cfg(any(feature = "derive", feature = "full"))]
fold_assoc_type(&mut self, i: AssocType) -> AssocType52 fn fold_assoc_type(&mut self, i: AssocType) -> AssocType {
53 fold_assoc_type(self, i)
54 }
55 #[cfg(any(feature = "derive", feature = "full"))]
fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle56 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
57 fold_attr_style(self, i)
58 }
59 #[cfg(any(feature = "derive", feature = "full"))]
fold_attribute(&mut self, i: Attribute) -> Attribute60 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
61 fold_attribute(self, i)
62 }
63 #[cfg(any(feature = "derive", feature = "full"))]
fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg64 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
65 fold_bare_fn_arg(self, i)
66 }
67 #[cfg(any(feature = "derive", feature = "full"))]
fold_bare_variadic(&mut self, i: BareVariadic) -> BareVariadic68 fn fold_bare_variadic(&mut self, i: BareVariadic) -> BareVariadic {
69 fold_bare_variadic(self, i)
70 }
71 #[cfg(any(feature = "derive", feature = "full"))]
fold_bin_op(&mut self, i: BinOp) -> BinOp72 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
73 fold_bin_op(self, i)
74 }
75 #[cfg(feature = "full")]
fold_block(&mut self, i: Block) -> Block76 fn fold_block(&mut self, i: Block) -> Block {
77 fold_block(self, i)
78 }
79 #[cfg(any(feature = "derive", feature = "full"))]
fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes80 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
81 fold_bound_lifetimes(self, i)
82 }
83 #[cfg(any(feature = "derive", feature = "full"))]
fold_const_param(&mut self, i: ConstParam) -> ConstParam84 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
85 fold_const_param(self, i)
86 }
87 #[cfg(any(feature = "derive", feature = "full"))]
fold_constraint(&mut self, i: Constraint) -> Constraint88 fn fold_constraint(&mut self, i: Constraint) -> Constraint {
89 fold_constraint(self, i)
90 }
91 #[cfg(feature = "derive")]
fold_data(&mut self, i: Data) -> Data92 fn fold_data(&mut self, i: Data) -> Data {
93 fold_data(self, i)
94 }
95 #[cfg(feature = "derive")]
fold_data_enum(&mut self, i: DataEnum) -> DataEnum96 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
97 fold_data_enum(self, i)
98 }
99 #[cfg(feature = "derive")]
fold_data_struct(&mut self, i: DataStruct) -> DataStruct100 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
101 fold_data_struct(self, i)
102 }
103 #[cfg(feature = "derive")]
fold_data_union(&mut self, i: DataUnion) -> DataUnion104 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
105 fold_data_union(self, i)
106 }
107 #[cfg(feature = "derive")]
fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput108 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
109 fold_derive_input(self, i)
110 }
111 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr(&mut self, i: Expr) -> Expr112 fn fold_expr(&mut self, i: Expr) -> Expr {
113 fold_expr(self, i)
114 }
115 #[cfg(feature = "full")]
fold_expr_array(&mut self, i: ExprArray) -> ExprArray116 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
117 fold_expr_array(self, i)
118 }
119 #[cfg(feature = "full")]
fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign120 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
121 fold_expr_assign(self, i)
122 }
123 #[cfg(feature = "full")]
fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync124 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
125 fold_expr_async(self, i)
126 }
127 #[cfg(feature = "full")]
fold_expr_await(&mut self, i: ExprAwait) -> ExprAwait128 fn fold_expr_await(&mut self, i: ExprAwait) -> ExprAwait {
129 fold_expr_await(self, i)
130 }
131 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary132 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
133 fold_expr_binary(self, i)
134 }
135 #[cfg(feature = "full")]
fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock136 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
137 fold_expr_block(self, i)
138 }
139 #[cfg(feature = "full")]
fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak140 fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak {
141 fold_expr_break(self, i)
142 }
143 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_call(&mut self, i: ExprCall) -> ExprCall144 fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall {
145 fold_expr_call(self, i)
146 }
147 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_cast(&mut self, i: ExprCast) -> ExprCast148 fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast {
149 fold_expr_cast(self, i)
150 }
151 #[cfg(feature = "full")]
fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure152 fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure {
153 fold_expr_closure(self, i)
154 }
155 #[cfg(feature = "full")]
fold_expr_const(&mut self, i: ExprConst) -> ExprConst156 fn fold_expr_const(&mut self, i: ExprConst) -> ExprConst {
157 fold_expr_const(self, i)
158 }
159 #[cfg(feature = "full")]
fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue160 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
161 fold_expr_continue(self, i)
162 }
163 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_field(&mut self, i: ExprField) -> ExprField164 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
165 fold_expr_field(self, i)
166 }
167 #[cfg(feature = "full")]
fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop168 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
169 fold_expr_for_loop(self, i)
170 }
171 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup172 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
173 fold_expr_group(self, i)
174 }
175 #[cfg(feature = "full")]
fold_expr_if(&mut self, i: ExprIf) -> ExprIf176 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
177 fold_expr_if(self, i)
178 }
179 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex180 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
181 fold_expr_index(self, i)
182 }
183 #[cfg(feature = "full")]
fold_expr_infer(&mut self, i: ExprInfer) -> ExprInfer184 fn fold_expr_infer(&mut self, i: ExprInfer) -> ExprInfer {
185 fold_expr_infer(self, i)
186 }
187 #[cfg(feature = "full")]
fold_expr_let(&mut self, i: ExprLet) -> ExprLet188 fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet {
189 fold_expr_let(self, i)
190 }
191 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_lit(&mut self, i: ExprLit) -> ExprLit192 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
193 fold_expr_lit(self, i)
194 }
195 #[cfg(feature = "full")]
fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop196 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
197 fold_expr_loop(self, i)
198 }
199 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro200 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
201 fold_expr_macro(self, i)
202 }
203 #[cfg(feature = "full")]
fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch204 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
205 fold_expr_match(self, i)
206 }
207 #[cfg(feature = "full")]
fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall208 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
209 fold_expr_method_call(self, i)
210 }
211 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_paren(&mut self, i: ExprParen) -> ExprParen212 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
213 fold_expr_paren(self, i)
214 }
215 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_path(&mut self, i: ExprPath) -> ExprPath216 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
217 fold_expr_path(self, i)
218 }
219 #[cfg(feature = "full")]
fold_expr_range(&mut self, i: ExprRange) -> ExprRange220 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
221 fold_expr_range(self, i)
222 }
223 #[cfg(feature = "full")]
fold_expr_reference(&mut self, i: ExprReference) -> ExprReference224 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
225 fold_expr_reference(self, i)
226 }
227 #[cfg(feature = "full")]
fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat228 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
229 fold_expr_repeat(self, i)
230 }
231 #[cfg(feature = "full")]
fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn232 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
233 fold_expr_return(self, i)
234 }
235 #[cfg(feature = "full")]
fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct236 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
237 fold_expr_struct(self, i)
238 }
239 #[cfg(feature = "full")]
fold_expr_try(&mut self, i: ExprTry) -> ExprTry240 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
241 fold_expr_try(self, i)
242 }
243 #[cfg(feature = "full")]
fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock244 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
245 fold_expr_try_block(self, i)
246 }
247 #[cfg(feature = "full")]
fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple248 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
249 fold_expr_tuple(self, i)
250 }
251 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary252 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
253 fold_expr_unary(self, i)
254 }
255 #[cfg(feature = "full")]
fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe256 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
257 fold_expr_unsafe(self, i)
258 }
259 #[cfg(feature = "full")]
fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile260 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
261 fold_expr_while(self, i)
262 }
263 #[cfg(feature = "full")]
fold_expr_yield(&mut self, i: ExprYield) -> ExprYield264 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
265 fold_expr_yield(self, i)
266 }
267 #[cfg(any(feature = "derive", feature = "full"))]
fold_field(&mut self, i: Field) -> Field268 fn fold_field(&mut self, i: Field) -> Field {
269 fold_field(self, i)
270 }
271 #[cfg(any(feature = "derive", feature = "full"))]
fold_field_mutability(&mut self, i: FieldMutability) -> FieldMutability272 fn fold_field_mutability(&mut self, i: FieldMutability) -> FieldMutability {
273 fold_field_mutability(self, i)
274 }
275 #[cfg(feature = "full")]
fold_field_pat(&mut self, i: FieldPat) -> FieldPat276 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
277 fold_field_pat(self, i)
278 }
279 #[cfg(feature = "full")]
fold_field_value(&mut self, i: FieldValue) -> FieldValue280 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
281 fold_field_value(self, i)
282 }
283 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields(&mut self, i: Fields) -> Fields284 fn fold_fields(&mut self, i: Fields) -> Fields {
285 fold_fields(self, i)
286 }
287 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed288 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
289 fold_fields_named(self, i)
290 }
291 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed292 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
293 fold_fields_unnamed(self, i)
294 }
295 #[cfg(feature = "full")]
fold_file(&mut self, i: File) -> File296 fn fold_file(&mut self, i: File) -> File {
297 fold_file(self, i)
298 }
299 #[cfg(feature = "full")]
fold_fn_arg(&mut self, i: FnArg) -> FnArg300 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
301 fold_fn_arg(self, i)
302 }
303 #[cfg(feature = "full")]
fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem304 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
305 fold_foreign_item(self, i)
306 }
307 #[cfg(feature = "full")]
fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn308 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
309 fold_foreign_item_fn(self, i)
310 }
311 #[cfg(feature = "full")]
fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro312 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
313 fold_foreign_item_macro(self, i)
314 }
315 #[cfg(feature = "full")]
fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic316 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
317 fold_foreign_item_static(self, i)
318 }
319 #[cfg(feature = "full")]
fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType320 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
321 fold_foreign_item_type(self, i)
322 }
323 #[cfg(any(feature = "derive", feature = "full"))]
fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument324 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
325 fold_generic_argument(self, i)
326 }
327 #[cfg(any(feature = "derive", feature = "full"))]
fold_generic_param(&mut self, i: GenericParam) -> GenericParam328 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
329 fold_generic_param(self, i)
330 }
331 #[cfg(any(feature = "derive", feature = "full"))]
fold_generics(&mut self, i: Generics) -> Generics332 fn fold_generics(&mut self, i: Generics) -> Generics {
333 fold_generics(self, i)
334 }
fold_ident(&mut self, i: Ident) -> Ident335 fn fold_ident(&mut self, i: Ident) -> Ident {
336 fold_ident(self, i)
337 }
338 #[cfg(feature = "full")]
fold_impl_item(&mut self, i: ImplItem) -> ImplItem339 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
340 fold_impl_item(self, i)
341 }
342 #[cfg(feature = "full")]
fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst343 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
344 fold_impl_item_const(self, i)
345 }
346 #[cfg(feature = "full")]
fold_impl_item_fn(&mut self, i: ImplItemFn) -> ImplItemFn347 fn fold_impl_item_fn(&mut self, i: ImplItemFn) -> ImplItemFn {
348 fold_impl_item_fn(self, i)
349 }
350 #[cfg(feature = "full")]
fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro351 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
352 fold_impl_item_macro(self, i)
353 }
354 #[cfg(feature = "full")]
fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType355 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
356 fold_impl_item_type(self, i)
357 }
358 #[cfg(feature = "full")]
fold_impl_restriction(&mut self, i: ImplRestriction) -> ImplRestriction359 fn fold_impl_restriction(&mut self, i: ImplRestriction) -> ImplRestriction {
360 fold_impl_restriction(self, i)
361 }
362 #[cfg(any(feature = "derive", feature = "full"))]
fold_index(&mut self, i: Index) -> Index363 fn fold_index(&mut self, i: Index) -> Index {
364 fold_index(self, i)
365 }
366 #[cfg(feature = "full")]
fold_item(&mut self, i: Item) -> Item367 fn fold_item(&mut self, i: Item) -> Item {
368 fold_item(self, i)
369 }
370 #[cfg(feature = "full")]
fold_item_const(&mut self, i: ItemConst) -> ItemConst371 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
372 fold_item_const(self, i)
373 }
374 #[cfg(feature = "full")]
fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum375 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
376 fold_item_enum(self, i)
377 }
378 #[cfg(feature = "full")]
fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate379 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
380 fold_item_extern_crate(self, i)
381 }
382 #[cfg(feature = "full")]
fold_item_fn(&mut self, i: ItemFn) -> ItemFn383 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
384 fold_item_fn(self, i)
385 }
386 #[cfg(feature = "full")]
fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod387 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
388 fold_item_foreign_mod(self, i)
389 }
390 #[cfg(feature = "full")]
fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl391 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
392 fold_item_impl(self, i)
393 }
394 #[cfg(feature = "full")]
fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro395 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
396 fold_item_macro(self, i)
397 }
398 #[cfg(feature = "full")]
fold_item_mod(&mut self, i: ItemMod) -> ItemMod399 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
400 fold_item_mod(self, i)
401 }
402 #[cfg(feature = "full")]
fold_item_static(&mut self, i: ItemStatic) -> ItemStatic403 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
404 fold_item_static(self, i)
405 }
406 #[cfg(feature = "full")]
fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct407 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
408 fold_item_struct(self, i)
409 }
410 #[cfg(feature = "full")]
fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait411 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
412 fold_item_trait(self, i)
413 }
414 #[cfg(feature = "full")]
fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias415 fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias {
416 fold_item_trait_alias(self, i)
417 }
418 #[cfg(feature = "full")]
fold_item_type(&mut self, i: ItemType) -> ItemType419 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
420 fold_item_type(self, i)
421 }
422 #[cfg(feature = "full")]
fold_item_union(&mut self, i: ItemUnion) -> ItemUnion423 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
424 fold_item_union(self, i)
425 }
426 #[cfg(feature = "full")]
fold_item_use(&mut self, i: ItemUse) -> ItemUse427 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
428 fold_item_use(self, i)
429 }
430 #[cfg(feature = "full")]
fold_label(&mut self, i: Label) -> Label431 fn fold_label(&mut self, i: Label) -> Label {
432 fold_label(self, i)
433 }
fold_lifetime(&mut self, i: Lifetime) -> Lifetime434 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
435 fold_lifetime(self, i)
436 }
437 #[cfg(any(feature = "derive", feature = "full"))]
fold_lifetime_param(&mut self, i: LifetimeParam) -> LifetimeParam438 fn fold_lifetime_param(&mut self, i: LifetimeParam) -> LifetimeParam {
439 fold_lifetime_param(self, i)
440 }
fold_lit(&mut self, i: Lit) -> Lit441 fn fold_lit(&mut self, i: Lit) -> Lit {
442 fold_lit(self, i)
443 }
fold_lit_bool(&mut self, i: LitBool) -> LitBool444 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
445 fold_lit_bool(self, i)
446 }
fold_lit_byte(&mut self, i: LitByte) -> LitByte447 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
448 fold_lit_byte(self, i)
449 }
fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr450 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
451 fold_lit_byte_str(self, i)
452 }
fold_lit_char(&mut self, i: LitChar) -> LitChar453 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
454 fold_lit_char(self, i)
455 }
fold_lit_float(&mut self, i: LitFloat) -> LitFloat456 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
457 fold_lit_float(self, i)
458 }
fold_lit_int(&mut self, i: LitInt) -> LitInt459 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
460 fold_lit_int(self, i)
461 }
fold_lit_str(&mut self, i: LitStr) -> LitStr462 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
463 fold_lit_str(self, i)
464 }
465 #[cfg(feature = "full")]
fold_local(&mut self, i: Local) -> Local466 fn fold_local(&mut self, i: Local) -> Local {
467 fold_local(self, i)
468 }
469 #[cfg(feature = "full")]
fold_local_init(&mut self, i: LocalInit) -> LocalInit470 fn fold_local_init(&mut self, i: LocalInit) -> LocalInit {
471 fold_local_init(self, i)
472 }
473 #[cfg(any(feature = "derive", feature = "full"))]
fold_macro(&mut self, i: Macro) -> Macro474 fn fold_macro(&mut self, i: Macro) -> Macro {
475 fold_macro(self, i)
476 }
477 #[cfg(any(feature = "derive", feature = "full"))]
fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter478 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
479 fold_macro_delimiter(self, i)
480 }
481 #[cfg(any(feature = "derive", feature = "full"))]
fold_member(&mut self, i: Member) -> Member482 fn fold_member(&mut self, i: Member) -> Member {
483 fold_member(self, i)
484 }
485 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta(&mut self, i: Meta) -> Meta486 fn fold_meta(&mut self, i: Meta) -> Meta {
487 fold_meta(self, i)
488 }
489 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta_list(&mut self, i: MetaList) -> MetaList490 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
491 fold_meta_list(self, i)
492 }
493 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue494 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
495 fold_meta_name_value(self, i)
496 }
497 #[cfg(any(feature = "derive", feature = "full"))]
fold_parenthesized_generic_arguments( &mut self, i: ParenthesizedGenericArguments, ) -> ParenthesizedGenericArguments498 fn fold_parenthesized_generic_arguments(
499 &mut self,
500 i: ParenthesizedGenericArguments,
501 ) -> ParenthesizedGenericArguments {
502 fold_parenthesized_generic_arguments(self, i)
503 }
504 #[cfg(feature = "full")]
fold_pat(&mut self, i: Pat) -> Pat505 fn fold_pat(&mut self, i: Pat) -> Pat {
506 fold_pat(self, i)
507 }
508 #[cfg(feature = "full")]
fold_pat_ident(&mut self, i: PatIdent) -> PatIdent509 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
510 fold_pat_ident(self, i)
511 }
512 #[cfg(feature = "full")]
fold_pat_or(&mut self, i: PatOr) -> PatOr513 fn fold_pat_or(&mut self, i: PatOr) -> PatOr {
514 fold_pat_or(self, i)
515 }
516 #[cfg(feature = "full")]
fold_pat_paren(&mut self, i: PatParen) -> PatParen517 fn fold_pat_paren(&mut self, i: PatParen) -> PatParen {
518 fold_pat_paren(self, i)
519 }
520 #[cfg(feature = "full")]
fold_pat_reference(&mut self, i: PatReference) -> PatReference521 fn fold_pat_reference(&mut self, i: PatReference) -> PatReference {
522 fold_pat_reference(self, i)
523 }
524 #[cfg(feature = "full")]
fold_pat_rest(&mut self, i: PatRest) -> PatRest525 fn fold_pat_rest(&mut self, i: PatRest) -> PatRest {
526 fold_pat_rest(self, i)
527 }
528 #[cfg(feature = "full")]
fold_pat_slice(&mut self, i: PatSlice) -> PatSlice529 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
530 fold_pat_slice(self, i)
531 }
532 #[cfg(feature = "full")]
fold_pat_struct(&mut self, i: PatStruct) -> PatStruct533 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
534 fold_pat_struct(self, i)
535 }
536 #[cfg(feature = "full")]
fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple537 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
538 fold_pat_tuple(self, i)
539 }
540 #[cfg(feature = "full")]
fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct541 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
542 fold_pat_tuple_struct(self, i)
543 }
544 #[cfg(feature = "full")]
fold_pat_type(&mut self, i: PatType) -> PatType545 fn fold_pat_type(&mut self, i: PatType) -> PatType {
546 fold_pat_type(self, i)
547 }
548 #[cfg(feature = "full")]
fold_pat_wild(&mut self, i: PatWild) -> PatWild549 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
550 fold_pat_wild(self, i)
551 }
552 #[cfg(any(feature = "derive", feature = "full"))]
fold_path(&mut self, i: Path) -> Path553 fn fold_path(&mut self, i: Path) -> Path {
554 fold_path(self, i)
555 }
556 #[cfg(any(feature = "derive", feature = "full"))]
fold_path_arguments(&mut self, i: PathArguments) -> PathArguments557 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
558 fold_path_arguments(self, i)
559 }
560 #[cfg(any(feature = "derive", feature = "full"))]
fold_path_segment(&mut self, i: PathSegment) -> PathSegment561 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
562 fold_path_segment(self, i)
563 }
564 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime565 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
566 fold_predicate_lifetime(self, i)
567 }
568 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_type(&mut self, i: PredicateType) -> PredicateType569 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
570 fold_predicate_type(self, i)
571 }
572 #[cfg(any(feature = "derive", feature = "full"))]
fold_qself(&mut self, i: QSelf) -> QSelf573 fn fold_qself(&mut self, i: QSelf) -> QSelf {
574 fold_qself(self, i)
575 }
576 #[cfg(feature = "full")]
fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits577 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
578 fold_range_limits(self, i)
579 }
580 #[cfg(feature = "full")]
fold_receiver(&mut self, i: Receiver) -> Receiver581 fn fold_receiver(&mut self, i: Receiver) -> Receiver {
582 fold_receiver(self, i)
583 }
584 #[cfg(any(feature = "derive", feature = "full"))]
fold_return_type(&mut self, i: ReturnType) -> ReturnType585 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
586 fold_return_type(self, i)
587 }
588 #[cfg(feature = "full")]
fold_signature(&mut self, i: Signature) -> Signature589 fn fold_signature(&mut self, i: Signature) -> Signature {
590 fold_signature(self, i)
591 }
fold_span(&mut self, i: Span) -> Span592 fn fold_span(&mut self, i: Span) -> Span {
593 fold_span(self, i)
594 }
595 #[cfg(feature = "full")]
fold_static_mutability(&mut self, i: StaticMutability) -> StaticMutability596 fn fold_static_mutability(&mut self, i: StaticMutability) -> StaticMutability {
597 fold_static_mutability(self, i)
598 }
599 #[cfg(feature = "full")]
fold_stmt(&mut self, i: Stmt) -> Stmt600 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
601 fold_stmt(self, i)
602 }
603 #[cfg(feature = "full")]
fold_stmt_macro(&mut self, i: StmtMacro) -> StmtMacro604 fn fold_stmt_macro(&mut self, i: StmtMacro) -> StmtMacro {
605 fold_stmt_macro(self, i)
606 }
607 #[cfg(any(feature = "derive", feature = "full"))]
fold_trait_bound(&mut self, i: TraitBound) -> TraitBound608 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
609 fold_trait_bound(self, i)
610 }
611 #[cfg(any(feature = "derive", feature = "full"))]
fold_trait_bound_modifier( &mut self, i: TraitBoundModifier, ) -> TraitBoundModifier612 fn fold_trait_bound_modifier(
613 &mut self,
614 i: TraitBoundModifier,
615 ) -> TraitBoundModifier {
616 fold_trait_bound_modifier(self, i)
617 }
618 #[cfg(feature = "full")]
fold_trait_item(&mut self, i: TraitItem) -> TraitItem619 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
620 fold_trait_item(self, i)
621 }
622 #[cfg(feature = "full")]
fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst623 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
624 fold_trait_item_const(self, i)
625 }
626 #[cfg(feature = "full")]
fold_trait_item_fn(&mut self, i: TraitItemFn) -> TraitItemFn627 fn fold_trait_item_fn(&mut self, i: TraitItemFn) -> TraitItemFn {
628 fold_trait_item_fn(self, i)
629 }
630 #[cfg(feature = "full")]
fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro631 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
632 fold_trait_item_macro(self, i)
633 }
634 #[cfg(feature = "full")]
fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType635 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
636 fold_trait_item_type(self, i)
637 }
638 #[cfg(any(feature = "derive", feature = "full"))]
fold_type(&mut self, i: Type) -> Type639 fn fold_type(&mut self, i: Type) -> Type {
640 fold_type(self, i)
641 }
642 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_array(&mut self, i: TypeArray) -> TypeArray643 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
644 fold_type_array(self, i)
645 }
646 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn647 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
648 fold_type_bare_fn(self, i)
649 }
650 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_group(&mut self, i: TypeGroup) -> TypeGroup651 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
652 fold_type_group(self, i)
653 }
654 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait655 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
656 fold_type_impl_trait(self, i)
657 }
658 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer659 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
660 fold_type_infer(self, i)
661 }
662 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro663 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
664 fold_type_macro(self, i)
665 }
666 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_never(&mut self, i: TypeNever) -> TypeNever667 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
668 fold_type_never(self, i)
669 }
670 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_param(&mut self, i: TypeParam) -> TypeParam671 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
672 fold_type_param(self, i)
673 }
674 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound675 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
676 fold_type_param_bound(self, i)
677 }
678 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_paren(&mut self, i: TypeParen) -> TypeParen679 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
680 fold_type_paren(self, i)
681 }
682 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_path(&mut self, i: TypePath) -> TypePath683 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
684 fold_type_path(self, i)
685 }
686 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_ptr(&mut self, i: TypePtr) -> TypePtr687 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
688 fold_type_ptr(self, i)
689 }
690 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_reference(&mut self, i: TypeReference) -> TypeReference691 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
692 fold_type_reference(self, i)
693 }
694 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice695 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
696 fold_type_slice(self, i)
697 }
698 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject699 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
700 fold_type_trait_object(self, i)
701 }
702 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple703 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
704 fold_type_tuple(self, i)
705 }
706 #[cfg(any(feature = "derive", feature = "full"))]
fold_un_op(&mut self, i: UnOp) -> UnOp707 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
708 fold_un_op(self, i)
709 }
710 #[cfg(feature = "full")]
fold_use_glob(&mut self, i: UseGlob) -> UseGlob711 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
712 fold_use_glob(self, i)
713 }
714 #[cfg(feature = "full")]
fold_use_group(&mut self, i: UseGroup) -> UseGroup715 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
716 fold_use_group(self, i)
717 }
718 #[cfg(feature = "full")]
fold_use_name(&mut self, i: UseName) -> UseName719 fn fold_use_name(&mut self, i: UseName) -> UseName {
720 fold_use_name(self, i)
721 }
722 #[cfg(feature = "full")]
fold_use_path(&mut self, i: UsePath) -> UsePath723 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
724 fold_use_path(self, i)
725 }
726 #[cfg(feature = "full")]
fold_use_rename(&mut self, i: UseRename) -> UseRename727 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
728 fold_use_rename(self, i)
729 }
730 #[cfg(feature = "full")]
fold_use_tree(&mut self, i: UseTree) -> UseTree731 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
732 fold_use_tree(self, i)
733 }
734 #[cfg(feature = "full")]
fold_variadic(&mut self, i: Variadic) -> Variadic735 fn fold_variadic(&mut self, i: Variadic) -> Variadic {
736 fold_variadic(self, i)
737 }
738 #[cfg(any(feature = "derive", feature = "full"))]
fold_variant(&mut self, i: Variant) -> Variant739 fn fold_variant(&mut self, i: Variant) -> Variant {
740 fold_variant(self, i)
741 }
742 #[cfg(any(feature = "derive", feature = "full"))]
fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted743 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
744 fold_vis_restricted(self, i)
745 }
746 #[cfg(any(feature = "derive", feature = "full"))]
fold_visibility(&mut self, i: Visibility) -> Visibility747 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
748 fold_visibility(self, i)
749 }
750 #[cfg(any(feature = "derive", feature = "full"))]
fold_where_clause(&mut self, i: WhereClause) -> WhereClause751 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
752 fold_where_clause(self, i)
753 }
754 #[cfg(any(feature = "derive", feature = "full"))]
fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate755 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
756 fold_where_predicate(self, i)
757 }
758 }
759 #[cfg(any(feature = "derive", feature = "full"))]
fold_abi<F>(f: &mut F, node: Abi) -> Abi where F: Fold + ?Sized,760 pub fn fold_abi<F>(f: &mut F, node: Abi) -> Abi
761 where
762 F: Fold + ?Sized,
763 {
764 Abi {
765 extern_token: node.extern_token,
766 name: (node.name).map(|it| f.fold_lit_str(it)),
767 }
768 }
769 #[cfg(any(feature = "derive", feature = "full"))]
fold_angle_bracketed_generic_arguments<F>( f: &mut F, node: AngleBracketedGenericArguments, ) -> AngleBracketedGenericArguments where F: Fold + ?Sized,770 pub fn fold_angle_bracketed_generic_arguments<F>(
771 f: &mut F,
772 node: AngleBracketedGenericArguments,
773 ) -> AngleBracketedGenericArguments
774 where
775 F: Fold + ?Sized,
776 {
777 AngleBracketedGenericArguments {
778 colon2_token: node.colon2_token,
779 lt_token: node.lt_token,
780 args: FoldHelper::lift(node.args, |it| f.fold_generic_argument(it)),
781 gt_token: node.gt_token,
782 }
783 }
784 #[cfg(feature = "full")]
fold_arm<F>(f: &mut F, node: Arm) -> Arm where F: Fold + ?Sized,785 pub fn fold_arm<F>(f: &mut F, node: Arm) -> Arm
786 where
787 F: Fold + ?Sized,
788 {
789 Arm {
790 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
791 pat: f.fold_pat(node.pat),
792 guard: (node.guard).map(|it| ((it).0, Box::new(f.fold_expr(*(it).1)))),
793 fat_arrow_token: node.fat_arrow_token,
794 body: Box::new(f.fold_expr(*node.body)),
795 comma: node.comma,
796 }
797 }
798 #[cfg(any(feature = "derive", feature = "full"))]
fold_assoc_const<F>(f: &mut F, node: AssocConst) -> AssocConst where F: Fold + ?Sized,799 pub fn fold_assoc_const<F>(f: &mut F, node: AssocConst) -> AssocConst
800 where
801 F: Fold + ?Sized,
802 {
803 AssocConst {
804 ident: f.fold_ident(node.ident),
805 generics: (node.generics).map(|it| f.fold_angle_bracketed_generic_arguments(it)),
806 eq_token: node.eq_token,
807 value: f.fold_expr(node.value),
808 }
809 }
810 #[cfg(any(feature = "derive", feature = "full"))]
fold_assoc_type<F>(f: &mut F, node: AssocType) -> AssocType where F: Fold + ?Sized,811 pub fn fold_assoc_type<F>(f: &mut F, node: AssocType) -> AssocType
812 where
813 F: Fold + ?Sized,
814 {
815 AssocType {
816 ident: f.fold_ident(node.ident),
817 generics: (node.generics).map(|it| f.fold_angle_bracketed_generic_arguments(it)),
818 eq_token: node.eq_token,
819 ty: f.fold_type(node.ty),
820 }
821 }
822 #[cfg(any(feature = "derive", feature = "full"))]
fold_attr_style<F>(f: &mut F, node: AttrStyle) -> AttrStyle where F: Fold + ?Sized,823 pub fn fold_attr_style<F>(f: &mut F, node: AttrStyle) -> AttrStyle
824 where
825 F: Fold + ?Sized,
826 {
827 match node {
828 AttrStyle::Outer => AttrStyle::Outer,
829 AttrStyle::Inner(_binding_0) => AttrStyle::Inner(_binding_0),
830 }
831 }
832 #[cfg(any(feature = "derive", feature = "full"))]
fold_attribute<F>(f: &mut F, node: Attribute) -> Attribute where F: Fold + ?Sized,833 pub fn fold_attribute<F>(f: &mut F, node: Attribute) -> Attribute
834 where
835 F: Fold + ?Sized,
836 {
837 Attribute {
838 pound_token: node.pound_token,
839 style: f.fold_attr_style(node.style),
840 bracket_token: node.bracket_token,
841 meta: f.fold_meta(node.meta),
842 }
843 }
844 #[cfg(any(feature = "derive", feature = "full"))]
fold_bare_fn_arg<F>(f: &mut F, node: BareFnArg) -> BareFnArg where F: Fold + ?Sized,845 pub fn fold_bare_fn_arg<F>(f: &mut F, node: BareFnArg) -> BareFnArg
846 where
847 F: Fold + ?Sized,
848 {
849 BareFnArg {
850 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
851 name: (node.name).map(|it| (f.fold_ident((it).0), (it).1)),
852 ty: f.fold_type(node.ty),
853 }
854 }
855 #[cfg(any(feature = "derive", feature = "full"))]
fold_bare_variadic<F>(f: &mut F, node: BareVariadic) -> BareVariadic where F: Fold + ?Sized,856 pub fn fold_bare_variadic<F>(f: &mut F, node: BareVariadic) -> BareVariadic
857 where
858 F: Fold + ?Sized,
859 {
860 BareVariadic {
861 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
862 name: (node.name).map(|it| (f.fold_ident((it).0), (it).1)),
863 dots: node.dots,
864 comma: node.comma,
865 }
866 }
867 #[cfg(any(feature = "derive", feature = "full"))]
fold_bin_op<F>(f: &mut F, node: BinOp) -> BinOp where F: Fold + ?Sized,868 pub fn fold_bin_op<F>(f: &mut F, node: BinOp) -> BinOp
869 where
870 F: Fold + ?Sized,
871 {
872 match node {
873 BinOp::Add(_binding_0) => BinOp::Add(_binding_0),
874 BinOp::Sub(_binding_0) => BinOp::Sub(_binding_0),
875 BinOp::Mul(_binding_0) => BinOp::Mul(_binding_0),
876 BinOp::Div(_binding_0) => BinOp::Div(_binding_0),
877 BinOp::Rem(_binding_0) => BinOp::Rem(_binding_0),
878 BinOp::And(_binding_0) => BinOp::And(_binding_0),
879 BinOp::Or(_binding_0) => BinOp::Or(_binding_0),
880 BinOp::BitXor(_binding_0) => BinOp::BitXor(_binding_0),
881 BinOp::BitAnd(_binding_0) => BinOp::BitAnd(_binding_0),
882 BinOp::BitOr(_binding_0) => BinOp::BitOr(_binding_0),
883 BinOp::Shl(_binding_0) => BinOp::Shl(_binding_0),
884 BinOp::Shr(_binding_0) => BinOp::Shr(_binding_0),
885 BinOp::Eq(_binding_0) => BinOp::Eq(_binding_0),
886 BinOp::Lt(_binding_0) => BinOp::Lt(_binding_0),
887 BinOp::Le(_binding_0) => BinOp::Le(_binding_0),
888 BinOp::Ne(_binding_0) => BinOp::Ne(_binding_0),
889 BinOp::Ge(_binding_0) => BinOp::Ge(_binding_0),
890 BinOp::Gt(_binding_0) => BinOp::Gt(_binding_0),
891 BinOp::AddAssign(_binding_0) => BinOp::AddAssign(_binding_0),
892 BinOp::SubAssign(_binding_0) => BinOp::SubAssign(_binding_0),
893 BinOp::MulAssign(_binding_0) => BinOp::MulAssign(_binding_0),
894 BinOp::DivAssign(_binding_0) => BinOp::DivAssign(_binding_0),
895 BinOp::RemAssign(_binding_0) => BinOp::RemAssign(_binding_0),
896 BinOp::BitXorAssign(_binding_0) => BinOp::BitXorAssign(_binding_0),
897 BinOp::BitAndAssign(_binding_0) => BinOp::BitAndAssign(_binding_0),
898 BinOp::BitOrAssign(_binding_0) => BinOp::BitOrAssign(_binding_0),
899 BinOp::ShlAssign(_binding_0) => BinOp::ShlAssign(_binding_0),
900 BinOp::ShrAssign(_binding_0) => BinOp::ShrAssign(_binding_0),
901 }
902 }
903 #[cfg(feature = "full")]
fold_block<F>(f: &mut F, node: Block) -> Block where F: Fold + ?Sized,904 pub fn fold_block<F>(f: &mut F, node: Block) -> Block
905 where
906 F: Fold + ?Sized,
907 {
908 Block {
909 brace_token: node.brace_token,
910 stmts: FoldHelper::lift(node.stmts, |it| f.fold_stmt(it)),
911 }
912 }
913 #[cfg(any(feature = "derive", feature = "full"))]
fold_bound_lifetimes<F>(f: &mut F, node: BoundLifetimes) -> BoundLifetimes where F: Fold + ?Sized,914 pub fn fold_bound_lifetimes<F>(f: &mut F, node: BoundLifetimes) -> BoundLifetimes
915 where
916 F: Fold + ?Sized,
917 {
918 BoundLifetimes {
919 for_token: node.for_token,
920 lt_token: node.lt_token,
921 lifetimes: FoldHelper::lift(node.lifetimes, |it| f.fold_generic_param(it)),
922 gt_token: node.gt_token,
923 }
924 }
925 #[cfg(any(feature = "derive", feature = "full"))]
fold_const_param<F>(f: &mut F, node: ConstParam) -> ConstParam where F: Fold + ?Sized,926 pub fn fold_const_param<F>(f: &mut F, node: ConstParam) -> ConstParam
927 where
928 F: Fold + ?Sized,
929 {
930 ConstParam {
931 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
932 const_token: node.const_token,
933 ident: f.fold_ident(node.ident),
934 colon_token: node.colon_token,
935 ty: f.fold_type(node.ty),
936 eq_token: node.eq_token,
937 default: (node.default).map(|it| f.fold_expr(it)),
938 }
939 }
940 #[cfg(any(feature = "derive", feature = "full"))]
fold_constraint<F>(f: &mut F, node: Constraint) -> Constraint where F: Fold + ?Sized,941 pub fn fold_constraint<F>(f: &mut F, node: Constraint) -> Constraint
942 where
943 F: Fold + ?Sized,
944 {
945 Constraint {
946 ident: f.fold_ident(node.ident),
947 generics: (node.generics).map(|it| f.fold_angle_bracketed_generic_arguments(it)),
948 colon_token: node.colon_token,
949 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
950 }
951 }
952 #[cfg(feature = "derive")]
fold_data<F>(f: &mut F, node: Data) -> Data where F: Fold + ?Sized,953 pub fn fold_data<F>(f: &mut F, node: Data) -> Data
954 where
955 F: Fold + ?Sized,
956 {
957 match node {
958 Data::Struct(_binding_0) => Data::Struct(f.fold_data_struct(_binding_0)),
959 Data::Enum(_binding_0) => Data::Enum(f.fold_data_enum(_binding_0)),
960 Data::Union(_binding_0) => Data::Union(f.fold_data_union(_binding_0)),
961 }
962 }
963 #[cfg(feature = "derive")]
fold_data_enum<F>(f: &mut F, node: DataEnum) -> DataEnum where F: Fold + ?Sized,964 pub fn fold_data_enum<F>(f: &mut F, node: DataEnum) -> DataEnum
965 where
966 F: Fold + ?Sized,
967 {
968 DataEnum {
969 enum_token: node.enum_token,
970 brace_token: node.brace_token,
971 variants: FoldHelper::lift(node.variants, |it| f.fold_variant(it)),
972 }
973 }
974 #[cfg(feature = "derive")]
fold_data_struct<F>(f: &mut F, node: DataStruct) -> DataStruct where F: Fold + ?Sized,975 pub fn fold_data_struct<F>(f: &mut F, node: DataStruct) -> DataStruct
976 where
977 F: Fold + ?Sized,
978 {
979 DataStruct {
980 struct_token: node.struct_token,
981 fields: f.fold_fields(node.fields),
982 semi_token: node.semi_token,
983 }
984 }
985 #[cfg(feature = "derive")]
fold_data_union<F>(f: &mut F, node: DataUnion) -> DataUnion where F: Fold + ?Sized,986 pub fn fold_data_union<F>(f: &mut F, node: DataUnion) -> DataUnion
987 where
988 F: Fold + ?Sized,
989 {
990 DataUnion {
991 union_token: node.union_token,
992 fields: f.fold_fields_named(node.fields),
993 }
994 }
995 #[cfg(feature = "derive")]
fold_derive_input<F>(f: &mut F, node: DeriveInput) -> DeriveInput where F: Fold + ?Sized,996 pub fn fold_derive_input<F>(f: &mut F, node: DeriveInput) -> DeriveInput
997 where
998 F: Fold + ?Sized,
999 {
1000 DeriveInput {
1001 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1002 vis: f.fold_visibility(node.vis),
1003 ident: f.fold_ident(node.ident),
1004 generics: f.fold_generics(node.generics),
1005 data: f.fold_data(node.data),
1006 }
1007 }
1008 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr<F>(f: &mut F, node: Expr) -> Expr where F: Fold + ?Sized,1009 pub fn fold_expr<F>(f: &mut F, node: Expr) -> Expr
1010 where
1011 F: Fold + ?Sized,
1012 {
1013 match node {
1014 Expr::Array(_binding_0) => Expr::Array(full!(f.fold_expr_array(_binding_0))),
1015 Expr::Assign(_binding_0) => Expr::Assign(full!(f.fold_expr_assign(_binding_0))),
1016 Expr::Async(_binding_0) => Expr::Async(full!(f.fold_expr_async(_binding_0))),
1017 Expr::Await(_binding_0) => Expr::Await(full!(f.fold_expr_await(_binding_0))),
1018 Expr::Binary(_binding_0) => Expr::Binary(f.fold_expr_binary(_binding_0)),
1019 Expr::Block(_binding_0) => Expr::Block(full!(f.fold_expr_block(_binding_0))),
1020 Expr::Break(_binding_0) => Expr::Break(full!(f.fold_expr_break(_binding_0))),
1021 Expr::Call(_binding_0) => Expr::Call(f.fold_expr_call(_binding_0)),
1022 Expr::Cast(_binding_0) => Expr::Cast(f.fold_expr_cast(_binding_0)),
1023 Expr::Closure(_binding_0) => {
1024 Expr::Closure(full!(f.fold_expr_closure(_binding_0)))
1025 }
1026 Expr::Const(_binding_0) => Expr::Const(full!(f.fold_expr_const(_binding_0))),
1027 Expr::Continue(_binding_0) => {
1028 Expr::Continue(full!(f.fold_expr_continue(_binding_0)))
1029 }
1030 Expr::Field(_binding_0) => Expr::Field(f.fold_expr_field(_binding_0)),
1031 Expr::ForLoop(_binding_0) => {
1032 Expr::ForLoop(full!(f.fold_expr_for_loop(_binding_0)))
1033 }
1034 Expr::Group(_binding_0) => Expr::Group(f.fold_expr_group(_binding_0)),
1035 Expr::If(_binding_0) => Expr::If(full!(f.fold_expr_if(_binding_0))),
1036 Expr::Index(_binding_0) => Expr::Index(f.fold_expr_index(_binding_0)),
1037 Expr::Infer(_binding_0) => Expr::Infer(full!(f.fold_expr_infer(_binding_0))),
1038 Expr::Let(_binding_0) => Expr::Let(full!(f.fold_expr_let(_binding_0))),
1039 Expr::Lit(_binding_0) => Expr::Lit(f.fold_expr_lit(_binding_0)),
1040 Expr::Loop(_binding_0) => Expr::Loop(full!(f.fold_expr_loop(_binding_0))),
1041 Expr::Macro(_binding_0) => Expr::Macro(f.fold_expr_macro(_binding_0)),
1042 Expr::Match(_binding_0) => Expr::Match(full!(f.fold_expr_match(_binding_0))),
1043 Expr::MethodCall(_binding_0) => {
1044 Expr::MethodCall(full!(f.fold_expr_method_call(_binding_0)))
1045 }
1046 Expr::Paren(_binding_0) => Expr::Paren(f.fold_expr_paren(_binding_0)),
1047 Expr::Path(_binding_0) => Expr::Path(f.fold_expr_path(_binding_0)),
1048 Expr::Range(_binding_0) => Expr::Range(full!(f.fold_expr_range(_binding_0))),
1049 Expr::Reference(_binding_0) => {
1050 Expr::Reference(full!(f.fold_expr_reference(_binding_0)))
1051 }
1052 Expr::Repeat(_binding_0) => Expr::Repeat(full!(f.fold_expr_repeat(_binding_0))),
1053 Expr::Return(_binding_0) => Expr::Return(full!(f.fold_expr_return(_binding_0))),
1054 Expr::Struct(_binding_0) => Expr::Struct(full!(f.fold_expr_struct(_binding_0))),
1055 Expr::Try(_binding_0) => Expr::Try(full!(f.fold_expr_try(_binding_0))),
1056 Expr::TryBlock(_binding_0) => {
1057 Expr::TryBlock(full!(f.fold_expr_try_block(_binding_0)))
1058 }
1059 Expr::Tuple(_binding_0) => Expr::Tuple(full!(f.fold_expr_tuple(_binding_0))),
1060 Expr::Unary(_binding_0) => Expr::Unary(f.fold_expr_unary(_binding_0)),
1061 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(f.fold_expr_unsafe(_binding_0))),
1062 Expr::Verbatim(_binding_0) => Expr::Verbatim(_binding_0),
1063 Expr::While(_binding_0) => Expr::While(full!(f.fold_expr_while(_binding_0))),
1064 Expr::Yield(_binding_0) => Expr::Yield(full!(f.fold_expr_yield(_binding_0))),
1065 }
1066 }
1067 #[cfg(feature = "full")]
fold_expr_array<F>(f: &mut F, node: ExprArray) -> ExprArray where F: Fold + ?Sized,1068 pub fn fold_expr_array<F>(f: &mut F, node: ExprArray) -> ExprArray
1069 where
1070 F: Fold + ?Sized,
1071 {
1072 ExprArray {
1073 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1074 bracket_token: node.bracket_token,
1075 elems: FoldHelper::lift(node.elems, |it| f.fold_expr(it)),
1076 }
1077 }
1078 #[cfg(feature = "full")]
fold_expr_assign<F>(f: &mut F, node: ExprAssign) -> ExprAssign where F: Fold + ?Sized,1079 pub fn fold_expr_assign<F>(f: &mut F, node: ExprAssign) -> ExprAssign
1080 where
1081 F: Fold + ?Sized,
1082 {
1083 ExprAssign {
1084 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1085 left: Box::new(f.fold_expr(*node.left)),
1086 eq_token: node.eq_token,
1087 right: Box::new(f.fold_expr(*node.right)),
1088 }
1089 }
1090 #[cfg(feature = "full")]
fold_expr_async<F>(f: &mut F, node: ExprAsync) -> ExprAsync where F: Fold + ?Sized,1091 pub fn fold_expr_async<F>(f: &mut F, node: ExprAsync) -> ExprAsync
1092 where
1093 F: Fold + ?Sized,
1094 {
1095 ExprAsync {
1096 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1097 async_token: node.async_token,
1098 capture: node.capture,
1099 block: f.fold_block(node.block),
1100 }
1101 }
1102 #[cfg(feature = "full")]
fold_expr_await<F>(f: &mut F, node: ExprAwait) -> ExprAwait where F: Fold + ?Sized,1103 pub fn fold_expr_await<F>(f: &mut F, node: ExprAwait) -> ExprAwait
1104 where
1105 F: Fold + ?Sized,
1106 {
1107 ExprAwait {
1108 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1109 base: Box::new(f.fold_expr(*node.base)),
1110 dot_token: node.dot_token,
1111 await_token: node.await_token,
1112 }
1113 }
1114 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_binary<F>(f: &mut F, node: ExprBinary) -> ExprBinary where F: Fold + ?Sized,1115 pub fn fold_expr_binary<F>(f: &mut F, node: ExprBinary) -> ExprBinary
1116 where
1117 F: Fold + ?Sized,
1118 {
1119 ExprBinary {
1120 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1121 left: Box::new(f.fold_expr(*node.left)),
1122 op: f.fold_bin_op(node.op),
1123 right: Box::new(f.fold_expr(*node.right)),
1124 }
1125 }
1126 #[cfg(feature = "full")]
fold_expr_block<F>(f: &mut F, node: ExprBlock) -> ExprBlock where F: Fold + ?Sized,1127 pub fn fold_expr_block<F>(f: &mut F, node: ExprBlock) -> ExprBlock
1128 where
1129 F: Fold + ?Sized,
1130 {
1131 ExprBlock {
1132 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1133 label: (node.label).map(|it| f.fold_label(it)),
1134 block: f.fold_block(node.block),
1135 }
1136 }
1137 #[cfg(feature = "full")]
fold_expr_break<F>(f: &mut F, node: ExprBreak) -> ExprBreak where F: Fold + ?Sized,1138 pub fn fold_expr_break<F>(f: &mut F, node: ExprBreak) -> ExprBreak
1139 where
1140 F: Fold + ?Sized,
1141 {
1142 ExprBreak {
1143 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1144 break_token: node.break_token,
1145 label: (node.label).map(|it| f.fold_lifetime(it)),
1146 expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))),
1147 }
1148 }
1149 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_call<F>(f: &mut F, node: ExprCall) -> ExprCall where F: Fold + ?Sized,1150 pub fn fold_expr_call<F>(f: &mut F, node: ExprCall) -> ExprCall
1151 where
1152 F: Fold + ?Sized,
1153 {
1154 ExprCall {
1155 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1156 func: Box::new(f.fold_expr(*node.func)),
1157 paren_token: node.paren_token,
1158 args: FoldHelper::lift(node.args, |it| f.fold_expr(it)),
1159 }
1160 }
1161 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_cast<F>(f: &mut F, node: ExprCast) -> ExprCast where F: Fold + ?Sized,1162 pub fn fold_expr_cast<F>(f: &mut F, node: ExprCast) -> ExprCast
1163 where
1164 F: Fold + ?Sized,
1165 {
1166 ExprCast {
1167 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1168 expr: Box::new(f.fold_expr(*node.expr)),
1169 as_token: node.as_token,
1170 ty: Box::new(f.fold_type(*node.ty)),
1171 }
1172 }
1173 #[cfg(feature = "full")]
fold_expr_closure<F>(f: &mut F, node: ExprClosure) -> ExprClosure where F: Fold + ?Sized,1174 pub fn fold_expr_closure<F>(f: &mut F, node: ExprClosure) -> ExprClosure
1175 where
1176 F: Fold + ?Sized,
1177 {
1178 ExprClosure {
1179 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1180 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
1181 constness: node.constness,
1182 movability: node.movability,
1183 asyncness: node.asyncness,
1184 capture: node.capture,
1185 or1_token: node.or1_token,
1186 inputs: FoldHelper::lift(node.inputs, |it| f.fold_pat(it)),
1187 or2_token: node.or2_token,
1188 output: f.fold_return_type(node.output),
1189 body: Box::new(f.fold_expr(*node.body)),
1190 }
1191 }
1192 #[cfg(feature = "full")]
fold_expr_const<F>(f: &mut F, node: ExprConst) -> ExprConst where F: Fold + ?Sized,1193 pub fn fold_expr_const<F>(f: &mut F, node: ExprConst) -> ExprConst
1194 where
1195 F: Fold + ?Sized,
1196 {
1197 ExprConst {
1198 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1199 const_token: node.const_token,
1200 block: f.fold_block(node.block),
1201 }
1202 }
1203 #[cfg(feature = "full")]
fold_expr_continue<F>(f: &mut F, node: ExprContinue) -> ExprContinue where F: Fold + ?Sized,1204 pub fn fold_expr_continue<F>(f: &mut F, node: ExprContinue) -> ExprContinue
1205 where
1206 F: Fold + ?Sized,
1207 {
1208 ExprContinue {
1209 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1210 continue_token: node.continue_token,
1211 label: (node.label).map(|it| f.fold_lifetime(it)),
1212 }
1213 }
1214 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_field<F>(f: &mut F, node: ExprField) -> ExprField where F: Fold + ?Sized,1215 pub fn fold_expr_field<F>(f: &mut F, node: ExprField) -> ExprField
1216 where
1217 F: Fold + ?Sized,
1218 {
1219 ExprField {
1220 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1221 base: Box::new(f.fold_expr(*node.base)),
1222 dot_token: node.dot_token,
1223 member: f.fold_member(node.member),
1224 }
1225 }
1226 #[cfg(feature = "full")]
fold_expr_for_loop<F>(f: &mut F, node: ExprForLoop) -> ExprForLoop where F: Fold + ?Sized,1227 pub fn fold_expr_for_loop<F>(f: &mut F, node: ExprForLoop) -> ExprForLoop
1228 where
1229 F: Fold + ?Sized,
1230 {
1231 ExprForLoop {
1232 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1233 label: (node.label).map(|it| f.fold_label(it)),
1234 for_token: node.for_token,
1235 pat: Box::new(f.fold_pat(*node.pat)),
1236 in_token: node.in_token,
1237 expr: Box::new(f.fold_expr(*node.expr)),
1238 body: f.fold_block(node.body),
1239 }
1240 }
1241 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_group<F>(f: &mut F, node: ExprGroup) -> ExprGroup where F: Fold + ?Sized,1242 pub fn fold_expr_group<F>(f: &mut F, node: ExprGroup) -> ExprGroup
1243 where
1244 F: Fold + ?Sized,
1245 {
1246 ExprGroup {
1247 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1248 group_token: node.group_token,
1249 expr: Box::new(f.fold_expr(*node.expr)),
1250 }
1251 }
1252 #[cfg(feature = "full")]
fold_expr_if<F>(f: &mut F, node: ExprIf) -> ExprIf where F: Fold + ?Sized,1253 pub fn fold_expr_if<F>(f: &mut F, node: ExprIf) -> ExprIf
1254 where
1255 F: Fold + ?Sized,
1256 {
1257 ExprIf {
1258 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1259 if_token: node.if_token,
1260 cond: Box::new(f.fold_expr(*node.cond)),
1261 then_branch: f.fold_block(node.then_branch),
1262 else_branch: (node.else_branch)
1263 .map(|it| ((it).0, Box::new(f.fold_expr(*(it).1)))),
1264 }
1265 }
1266 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_index<F>(f: &mut F, node: ExprIndex) -> ExprIndex where F: Fold + ?Sized,1267 pub fn fold_expr_index<F>(f: &mut F, node: ExprIndex) -> ExprIndex
1268 where
1269 F: Fold + ?Sized,
1270 {
1271 ExprIndex {
1272 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1273 expr: Box::new(f.fold_expr(*node.expr)),
1274 bracket_token: node.bracket_token,
1275 index: Box::new(f.fold_expr(*node.index)),
1276 }
1277 }
1278 #[cfg(feature = "full")]
fold_expr_infer<F>(f: &mut F, node: ExprInfer) -> ExprInfer where F: Fold + ?Sized,1279 pub fn fold_expr_infer<F>(f: &mut F, node: ExprInfer) -> ExprInfer
1280 where
1281 F: Fold + ?Sized,
1282 {
1283 ExprInfer {
1284 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1285 underscore_token: node.underscore_token,
1286 }
1287 }
1288 #[cfg(feature = "full")]
fold_expr_let<F>(f: &mut F, node: ExprLet) -> ExprLet where F: Fold + ?Sized,1289 pub fn fold_expr_let<F>(f: &mut F, node: ExprLet) -> ExprLet
1290 where
1291 F: Fold + ?Sized,
1292 {
1293 ExprLet {
1294 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1295 let_token: node.let_token,
1296 pat: Box::new(f.fold_pat(*node.pat)),
1297 eq_token: node.eq_token,
1298 expr: Box::new(f.fold_expr(*node.expr)),
1299 }
1300 }
1301 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_lit<F>(f: &mut F, node: ExprLit) -> ExprLit where F: Fold + ?Sized,1302 pub fn fold_expr_lit<F>(f: &mut F, node: ExprLit) -> ExprLit
1303 where
1304 F: Fold + ?Sized,
1305 {
1306 ExprLit {
1307 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1308 lit: f.fold_lit(node.lit),
1309 }
1310 }
1311 #[cfg(feature = "full")]
fold_expr_loop<F>(f: &mut F, node: ExprLoop) -> ExprLoop where F: Fold + ?Sized,1312 pub fn fold_expr_loop<F>(f: &mut F, node: ExprLoop) -> ExprLoop
1313 where
1314 F: Fold + ?Sized,
1315 {
1316 ExprLoop {
1317 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1318 label: (node.label).map(|it| f.fold_label(it)),
1319 loop_token: node.loop_token,
1320 body: f.fold_block(node.body),
1321 }
1322 }
1323 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_macro<F>(f: &mut F, node: ExprMacro) -> ExprMacro where F: Fold + ?Sized,1324 pub fn fold_expr_macro<F>(f: &mut F, node: ExprMacro) -> ExprMacro
1325 where
1326 F: Fold + ?Sized,
1327 {
1328 ExprMacro {
1329 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1330 mac: f.fold_macro(node.mac),
1331 }
1332 }
1333 #[cfg(feature = "full")]
fold_expr_match<F>(f: &mut F, node: ExprMatch) -> ExprMatch where F: Fold + ?Sized,1334 pub fn fold_expr_match<F>(f: &mut F, node: ExprMatch) -> ExprMatch
1335 where
1336 F: Fold + ?Sized,
1337 {
1338 ExprMatch {
1339 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1340 match_token: node.match_token,
1341 expr: Box::new(f.fold_expr(*node.expr)),
1342 brace_token: node.brace_token,
1343 arms: FoldHelper::lift(node.arms, |it| f.fold_arm(it)),
1344 }
1345 }
1346 #[cfg(feature = "full")]
fold_expr_method_call<F>(f: &mut F, node: ExprMethodCall) -> ExprMethodCall where F: Fold + ?Sized,1347 pub fn fold_expr_method_call<F>(f: &mut F, node: ExprMethodCall) -> ExprMethodCall
1348 where
1349 F: Fold + ?Sized,
1350 {
1351 ExprMethodCall {
1352 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1353 receiver: Box::new(f.fold_expr(*node.receiver)),
1354 dot_token: node.dot_token,
1355 method: f.fold_ident(node.method),
1356 turbofish: (node.turbofish)
1357 .map(|it| f.fold_angle_bracketed_generic_arguments(it)),
1358 paren_token: node.paren_token,
1359 args: FoldHelper::lift(node.args, |it| f.fold_expr(it)),
1360 }
1361 }
1362 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_paren<F>(f: &mut F, node: ExprParen) -> ExprParen where F: Fold + ?Sized,1363 pub fn fold_expr_paren<F>(f: &mut F, node: ExprParen) -> ExprParen
1364 where
1365 F: Fold + ?Sized,
1366 {
1367 ExprParen {
1368 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1369 paren_token: node.paren_token,
1370 expr: Box::new(f.fold_expr(*node.expr)),
1371 }
1372 }
1373 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_path<F>(f: &mut F, node: ExprPath) -> ExprPath where F: Fold + ?Sized,1374 pub fn fold_expr_path<F>(f: &mut F, node: ExprPath) -> ExprPath
1375 where
1376 F: Fold + ?Sized,
1377 {
1378 ExprPath {
1379 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1380 qself: (node.qself).map(|it| f.fold_qself(it)),
1381 path: f.fold_path(node.path),
1382 }
1383 }
1384 #[cfg(feature = "full")]
fold_expr_range<F>(f: &mut F, node: ExprRange) -> ExprRange where F: Fold + ?Sized,1385 pub fn fold_expr_range<F>(f: &mut F, node: ExprRange) -> ExprRange
1386 where
1387 F: Fold + ?Sized,
1388 {
1389 ExprRange {
1390 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1391 start: (node.start).map(|it| Box::new(f.fold_expr(*it))),
1392 limits: f.fold_range_limits(node.limits),
1393 end: (node.end).map(|it| Box::new(f.fold_expr(*it))),
1394 }
1395 }
1396 #[cfg(feature = "full")]
fold_expr_reference<F>(f: &mut F, node: ExprReference) -> ExprReference where F: Fold + ?Sized,1397 pub fn fold_expr_reference<F>(f: &mut F, node: ExprReference) -> ExprReference
1398 where
1399 F: Fold + ?Sized,
1400 {
1401 ExprReference {
1402 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1403 and_token: node.and_token,
1404 mutability: node.mutability,
1405 expr: Box::new(f.fold_expr(*node.expr)),
1406 }
1407 }
1408 #[cfg(feature = "full")]
fold_expr_repeat<F>(f: &mut F, node: ExprRepeat) -> ExprRepeat where F: Fold + ?Sized,1409 pub fn fold_expr_repeat<F>(f: &mut F, node: ExprRepeat) -> ExprRepeat
1410 where
1411 F: Fold + ?Sized,
1412 {
1413 ExprRepeat {
1414 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1415 bracket_token: node.bracket_token,
1416 expr: Box::new(f.fold_expr(*node.expr)),
1417 semi_token: node.semi_token,
1418 len: Box::new(f.fold_expr(*node.len)),
1419 }
1420 }
1421 #[cfg(feature = "full")]
fold_expr_return<F>(f: &mut F, node: ExprReturn) -> ExprReturn where F: Fold + ?Sized,1422 pub fn fold_expr_return<F>(f: &mut F, node: ExprReturn) -> ExprReturn
1423 where
1424 F: Fold + ?Sized,
1425 {
1426 ExprReturn {
1427 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1428 return_token: node.return_token,
1429 expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))),
1430 }
1431 }
1432 #[cfg(feature = "full")]
fold_expr_struct<F>(f: &mut F, node: ExprStruct) -> ExprStruct where F: Fold + ?Sized,1433 pub fn fold_expr_struct<F>(f: &mut F, node: ExprStruct) -> ExprStruct
1434 where
1435 F: Fold + ?Sized,
1436 {
1437 ExprStruct {
1438 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1439 qself: (node.qself).map(|it| f.fold_qself(it)),
1440 path: f.fold_path(node.path),
1441 brace_token: node.brace_token,
1442 fields: FoldHelper::lift(node.fields, |it| f.fold_field_value(it)),
1443 dot2_token: node.dot2_token,
1444 rest: (node.rest).map(|it| Box::new(f.fold_expr(*it))),
1445 }
1446 }
1447 #[cfg(feature = "full")]
fold_expr_try<F>(f: &mut F, node: ExprTry) -> ExprTry where F: Fold + ?Sized,1448 pub fn fold_expr_try<F>(f: &mut F, node: ExprTry) -> ExprTry
1449 where
1450 F: Fold + ?Sized,
1451 {
1452 ExprTry {
1453 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1454 expr: Box::new(f.fold_expr(*node.expr)),
1455 question_token: node.question_token,
1456 }
1457 }
1458 #[cfg(feature = "full")]
fold_expr_try_block<F>(f: &mut F, node: ExprTryBlock) -> ExprTryBlock where F: Fold + ?Sized,1459 pub fn fold_expr_try_block<F>(f: &mut F, node: ExprTryBlock) -> ExprTryBlock
1460 where
1461 F: Fold + ?Sized,
1462 {
1463 ExprTryBlock {
1464 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1465 try_token: node.try_token,
1466 block: f.fold_block(node.block),
1467 }
1468 }
1469 #[cfg(feature = "full")]
fold_expr_tuple<F>(f: &mut F, node: ExprTuple) -> ExprTuple where F: Fold + ?Sized,1470 pub fn fold_expr_tuple<F>(f: &mut F, node: ExprTuple) -> ExprTuple
1471 where
1472 F: Fold + ?Sized,
1473 {
1474 ExprTuple {
1475 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1476 paren_token: node.paren_token,
1477 elems: FoldHelper::lift(node.elems, |it| f.fold_expr(it)),
1478 }
1479 }
1480 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_unary<F>(f: &mut F, node: ExprUnary) -> ExprUnary where F: Fold + ?Sized,1481 pub fn fold_expr_unary<F>(f: &mut F, node: ExprUnary) -> ExprUnary
1482 where
1483 F: Fold + ?Sized,
1484 {
1485 ExprUnary {
1486 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1487 op: f.fold_un_op(node.op),
1488 expr: Box::new(f.fold_expr(*node.expr)),
1489 }
1490 }
1491 #[cfg(feature = "full")]
fold_expr_unsafe<F>(f: &mut F, node: ExprUnsafe) -> ExprUnsafe where F: Fold + ?Sized,1492 pub fn fold_expr_unsafe<F>(f: &mut F, node: ExprUnsafe) -> ExprUnsafe
1493 where
1494 F: Fold + ?Sized,
1495 {
1496 ExprUnsafe {
1497 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1498 unsafe_token: node.unsafe_token,
1499 block: f.fold_block(node.block),
1500 }
1501 }
1502 #[cfg(feature = "full")]
fold_expr_while<F>(f: &mut F, node: ExprWhile) -> ExprWhile where F: Fold + ?Sized,1503 pub fn fold_expr_while<F>(f: &mut F, node: ExprWhile) -> ExprWhile
1504 where
1505 F: Fold + ?Sized,
1506 {
1507 ExprWhile {
1508 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1509 label: (node.label).map(|it| f.fold_label(it)),
1510 while_token: node.while_token,
1511 cond: Box::new(f.fold_expr(*node.cond)),
1512 body: f.fold_block(node.body),
1513 }
1514 }
1515 #[cfg(feature = "full")]
fold_expr_yield<F>(f: &mut F, node: ExprYield) -> ExprYield where F: Fold + ?Sized,1516 pub fn fold_expr_yield<F>(f: &mut F, node: ExprYield) -> ExprYield
1517 where
1518 F: Fold + ?Sized,
1519 {
1520 ExprYield {
1521 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1522 yield_token: node.yield_token,
1523 expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))),
1524 }
1525 }
1526 #[cfg(any(feature = "derive", feature = "full"))]
fold_field<F>(f: &mut F, node: Field) -> Field where F: Fold + ?Sized,1527 pub fn fold_field<F>(f: &mut F, node: Field) -> Field
1528 where
1529 F: Fold + ?Sized,
1530 {
1531 Field {
1532 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1533 vis: f.fold_visibility(node.vis),
1534 mutability: f.fold_field_mutability(node.mutability),
1535 ident: (node.ident).map(|it| f.fold_ident(it)),
1536 colon_token: node.colon_token,
1537 ty: f.fold_type(node.ty),
1538 }
1539 }
1540 #[cfg(any(feature = "derive", feature = "full"))]
fold_field_mutability<F>(f: &mut F, node: FieldMutability) -> FieldMutability where F: Fold + ?Sized,1541 pub fn fold_field_mutability<F>(f: &mut F, node: FieldMutability) -> FieldMutability
1542 where
1543 F: Fold + ?Sized,
1544 {
1545 match node {
1546 FieldMutability::None => FieldMutability::None,
1547 }
1548 }
1549 #[cfg(feature = "full")]
fold_field_pat<F>(f: &mut F, node: FieldPat) -> FieldPat where F: Fold + ?Sized,1550 pub fn fold_field_pat<F>(f: &mut F, node: FieldPat) -> FieldPat
1551 where
1552 F: Fold + ?Sized,
1553 {
1554 FieldPat {
1555 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1556 member: f.fold_member(node.member),
1557 colon_token: node.colon_token,
1558 pat: Box::new(f.fold_pat(*node.pat)),
1559 }
1560 }
1561 #[cfg(feature = "full")]
fold_field_value<F>(f: &mut F, node: FieldValue) -> FieldValue where F: Fold + ?Sized,1562 pub fn fold_field_value<F>(f: &mut F, node: FieldValue) -> FieldValue
1563 where
1564 F: Fold + ?Sized,
1565 {
1566 FieldValue {
1567 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1568 member: f.fold_member(node.member),
1569 colon_token: node.colon_token,
1570 expr: f.fold_expr(node.expr),
1571 }
1572 }
1573 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields<F>(f: &mut F, node: Fields) -> Fields where F: Fold + ?Sized,1574 pub fn fold_fields<F>(f: &mut F, node: Fields) -> Fields
1575 where
1576 F: Fold + ?Sized,
1577 {
1578 match node {
1579 Fields::Named(_binding_0) => Fields::Named(f.fold_fields_named(_binding_0)),
1580 Fields::Unnamed(_binding_0) => Fields::Unnamed(f.fold_fields_unnamed(_binding_0)),
1581 Fields::Unit => Fields::Unit,
1582 }
1583 }
1584 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields_named<F>(f: &mut F, node: FieldsNamed) -> FieldsNamed where F: Fold + ?Sized,1585 pub fn fold_fields_named<F>(f: &mut F, node: FieldsNamed) -> FieldsNamed
1586 where
1587 F: Fold + ?Sized,
1588 {
1589 FieldsNamed {
1590 brace_token: node.brace_token,
1591 named: FoldHelper::lift(node.named, |it| f.fold_field(it)),
1592 }
1593 }
1594 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields_unnamed<F>(f: &mut F, node: FieldsUnnamed) -> FieldsUnnamed where F: Fold + ?Sized,1595 pub fn fold_fields_unnamed<F>(f: &mut F, node: FieldsUnnamed) -> FieldsUnnamed
1596 where
1597 F: Fold + ?Sized,
1598 {
1599 FieldsUnnamed {
1600 paren_token: node.paren_token,
1601 unnamed: FoldHelper::lift(node.unnamed, |it| f.fold_field(it)),
1602 }
1603 }
1604 #[cfg(feature = "full")]
fold_file<F>(f: &mut F, node: File) -> File where F: Fold + ?Sized,1605 pub fn fold_file<F>(f: &mut F, node: File) -> File
1606 where
1607 F: Fold + ?Sized,
1608 {
1609 File {
1610 shebang: node.shebang,
1611 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1612 items: FoldHelper::lift(node.items, |it| f.fold_item(it)),
1613 }
1614 }
1615 #[cfg(feature = "full")]
fold_fn_arg<F>(f: &mut F, node: FnArg) -> FnArg where F: Fold + ?Sized,1616 pub fn fold_fn_arg<F>(f: &mut F, node: FnArg) -> FnArg
1617 where
1618 F: Fold + ?Sized,
1619 {
1620 match node {
1621 FnArg::Receiver(_binding_0) => FnArg::Receiver(f.fold_receiver(_binding_0)),
1622 FnArg::Typed(_binding_0) => FnArg::Typed(f.fold_pat_type(_binding_0)),
1623 }
1624 }
1625 #[cfg(feature = "full")]
fold_foreign_item<F>(f: &mut F, node: ForeignItem) -> ForeignItem where F: Fold + ?Sized,1626 pub fn fold_foreign_item<F>(f: &mut F, node: ForeignItem) -> ForeignItem
1627 where
1628 F: Fold + ?Sized,
1629 {
1630 match node {
1631 ForeignItem::Fn(_binding_0) => {
1632 ForeignItem::Fn(f.fold_foreign_item_fn(_binding_0))
1633 }
1634 ForeignItem::Static(_binding_0) => {
1635 ForeignItem::Static(f.fold_foreign_item_static(_binding_0))
1636 }
1637 ForeignItem::Type(_binding_0) => {
1638 ForeignItem::Type(f.fold_foreign_item_type(_binding_0))
1639 }
1640 ForeignItem::Macro(_binding_0) => {
1641 ForeignItem::Macro(f.fold_foreign_item_macro(_binding_0))
1642 }
1643 ForeignItem::Verbatim(_binding_0) => ForeignItem::Verbatim(_binding_0),
1644 }
1645 }
1646 #[cfg(feature = "full")]
fold_foreign_item_fn<F>(f: &mut F, node: ForeignItemFn) -> ForeignItemFn where F: Fold + ?Sized,1647 pub fn fold_foreign_item_fn<F>(f: &mut F, node: ForeignItemFn) -> ForeignItemFn
1648 where
1649 F: Fold + ?Sized,
1650 {
1651 ForeignItemFn {
1652 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1653 vis: f.fold_visibility(node.vis),
1654 sig: f.fold_signature(node.sig),
1655 semi_token: node.semi_token,
1656 }
1657 }
1658 #[cfg(feature = "full")]
fold_foreign_item_macro<F>(f: &mut F, node: ForeignItemMacro) -> ForeignItemMacro where F: Fold + ?Sized,1659 pub fn fold_foreign_item_macro<F>(f: &mut F, node: ForeignItemMacro) -> ForeignItemMacro
1660 where
1661 F: Fold + ?Sized,
1662 {
1663 ForeignItemMacro {
1664 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1665 mac: f.fold_macro(node.mac),
1666 semi_token: node.semi_token,
1667 }
1668 }
1669 #[cfg(feature = "full")]
fold_foreign_item_static<F>( f: &mut F, node: ForeignItemStatic, ) -> ForeignItemStatic where F: Fold + ?Sized,1670 pub fn fold_foreign_item_static<F>(
1671 f: &mut F,
1672 node: ForeignItemStatic,
1673 ) -> ForeignItemStatic
1674 where
1675 F: Fold + ?Sized,
1676 {
1677 ForeignItemStatic {
1678 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1679 vis: f.fold_visibility(node.vis),
1680 static_token: node.static_token,
1681 mutability: f.fold_static_mutability(node.mutability),
1682 ident: f.fold_ident(node.ident),
1683 colon_token: node.colon_token,
1684 ty: Box::new(f.fold_type(*node.ty)),
1685 semi_token: node.semi_token,
1686 }
1687 }
1688 #[cfg(feature = "full")]
fold_foreign_item_type<F>(f: &mut F, node: ForeignItemType) -> ForeignItemType where F: Fold + ?Sized,1689 pub fn fold_foreign_item_type<F>(f: &mut F, node: ForeignItemType) -> ForeignItemType
1690 where
1691 F: Fold + ?Sized,
1692 {
1693 ForeignItemType {
1694 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1695 vis: f.fold_visibility(node.vis),
1696 type_token: node.type_token,
1697 ident: f.fold_ident(node.ident),
1698 generics: f.fold_generics(node.generics),
1699 semi_token: node.semi_token,
1700 }
1701 }
1702 #[cfg(any(feature = "derive", feature = "full"))]
fold_generic_argument<F>(f: &mut F, node: GenericArgument) -> GenericArgument where F: Fold + ?Sized,1703 pub fn fold_generic_argument<F>(f: &mut F, node: GenericArgument) -> GenericArgument
1704 where
1705 F: Fold + ?Sized,
1706 {
1707 match node {
1708 GenericArgument::Lifetime(_binding_0) => {
1709 GenericArgument::Lifetime(f.fold_lifetime(_binding_0))
1710 }
1711 GenericArgument::Type(_binding_0) => {
1712 GenericArgument::Type(f.fold_type(_binding_0))
1713 }
1714 GenericArgument::Const(_binding_0) => {
1715 GenericArgument::Const(f.fold_expr(_binding_0))
1716 }
1717 GenericArgument::AssocType(_binding_0) => {
1718 GenericArgument::AssocType(f.fold_assoc_type(_binding_0))
1719 }
1720 GenericArgument::AssocConst(_binding_0) => {
1721 GenericArgument::AssocConst(f.fold_assoc_const(_binding_0))
1722 }
1723 GenericArgument::Constraint(_binding_0) => {
1724 GenericArgument::Constraint(f.fold_constraint(_binding_0))
1725 }
1726 }
1727 }
1728 #[cfg(any(feature = "derive", feature = "full"))]
fold_generic_param<F>(f: &mut F, node: GenericParam) -> GenericParam where F: Fold + ?Sized,1729 pub fn fold_generic_param<F>(f: &mut F, node: GenericParam) -> GenericParam
1730 where
1731 F: Fold + ?Sized,
1732 {
1733 match node {
1734 GenericParam::Lifetime(_binding_0) => {
1735 GenericParam::Lifetime(f.fold_lifetime_param(_binding_0))
1736 }
1737 GenericParam::Type(_binding_0) => {
1738 GenericParam::Type(f.fold_type_param(_binding_0))
1739 }
1740 GenericParam::Const(_binding_0) => {
1741 GenericParam::Const(f.fold_const_param(_binding_0))
1742 }
1743 }
1744 }
1745 #[cfg(any(feature = "derive", feature = "full"))]
fold_generics<F>(f: &mut F, node: Generics) -> Generics where F: Fold + ?Sized,1746 pub fn fold_generics<F>(f: &mut F, node: Generics) -> Generics
1747 where
1748 F: Fold + ?Sized,
1749 {
1750 Generics {
1751 lt_token: node.lt_token,
1752 params: FoldHelper::lift(node.params, |it| f.fold_generic_param(it)),
1753 gt_token: node.gt_token,
1754 where_clause: (node.where_clause).map(|it| f.fold_where_clause(it)),
1755 }
1756 }
fold_ident<F>(f: &mut F, node: Ident) -> Ident where F: Fold + ?Sized,1757 pub fn fold_ident<F>(f: &mut F, node: Ident) -> Ident
1758 where
1759 F: Fold + ?Sized,
1760 {
1761 let mut node = node;
1762 let span = f.fold_span(node.span());
1763 node.set_span(span);
1764 node
1765 }
1766 #[cfg(feature = "full")]
fold_impl_item<F>(f: &mut F, node: ImplItem) -> ImplItem where F: Fold + ?Sized,1767 pub fn fold_impl_item<F>(f: &mut F, node: ImplItem) -> ImplItem
1768 where
1769 F: Fold + ?Sized,
1770 {
1771 match node {
1772 ImplItem::Const(_binding_0) => {
1773 ImplItem::Const(f.fold_impl_item_const(_binding_0))
1774 }
1775 ImplItem::Fn(_binding_0) => ImplItem::Fn(f.fold_impl_item_fn(_binding_0)),
1776 ImplItem::Type(_binding_0) => ImplItem::Type(f.fold_impl_item_type(_binding_0)),
1777 ImplItem::Macro(_binding_0) => {
1778 ImplItem::Macro(f.fold_impl_item_macro(_binding_0))
1779 }
1780 ImplItem::Verbatim(_binding_0) => ImplItem::Verbatim(_binding_0),
1781 }
1782 }
1783 #[cfg(feature = "full")]
fold_impl_item_const<F>(f: &mut F, node: ImplItemConst) -> ImplItemConst where F: Fold + ?Sized,1784 pub fn fold_impl_item_const<F>(f: &mut F, node: ImplItemConst) -> ImplItemConst
1785 where
1786 F: Fold + ?Sized,
1787 {
1788 ImplItemConst {
1789 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1790 vis: f.fold_visibility(node.vis),
1791 defaultness: node.defaultness,
1792 const_token: node.const_token,
1793 ident: f.fold_ident(node.ident),
1794 generics: f.fold_generics(node.generics),
1795 colon_token: node.colon_token,
1796 ty: f.fold_type(node.ty),
1797 eq_token: node.eq_token,
1798 expr: f.fold_expr(node.expr),
1799 semi_token: node.semi_token,
1800 }
1801 }
1802 #[cfg(feature = "full")]
fold_impl_item_fn<F>(f: &mut F, node: ImplItemFn) -> ImplItemFn where F: Fold + ?Sized,1803 pub fn fold_impl_item_fn<F>(f: &mut F, node: ImplItemFn) -> ImplItemFn
1804 where
1805 F: Fold + ?Sized,
1806 {
1807 ImplItemFn {
1808 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1809 vis: f.fold_visibility(node.vis),
1810 defaultness: node.defaultness,
1811 sig: f.fold_signature(node.sig),
1812 block: f.fold_block(node.block),
1813 }
1814 }
1815 #[cfg(feature = "full")]
fold_impl_item_macro<F>(f: &mut F, node: ImplItemMacro) -> ImplItemMacro where F: Fold + ?Sized,1816 pub fn fold_impl_item_macro<F>(f: &mut F, node: ImplItemMacro) -> ImplItemMacro
1817 where
1818 F: Fold + ?Sized,
1819 {
1820 ImplItemMacro {
1821 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1822 mac: f.fold_macro(node.mac),
1823 semi_token: node.semi_token,
1824 }
1825 }
1826 #[cfg(feature = "full")]
fold_impl_item_type<F>(f: &mut F, node: ImplItemType) -> ImplItemType where F: Fold + ?Sized,1827 pub fn fold_impl_item_type<F>(f: &mut F, node: ImplItemType) -> ImplItemType
1828 where
1829 F: Fold + ?Sized,
1830 {
1831 ImplItemType {
1832 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1833 vis: f.fold_visibility(node.vis),
1834 defaultness: node.defaultness,
1835 type_token: node.type_token,
1836 ident: f.fold_ident(node.ident),
1837 generics: f.fold_generics(node.generics),
1838 eq_token: node.eq_token,
1839 ty: f.fold_type(node.ty),
1840 semi_token: node.semi_token,
1841 }
1842 }
1843 #[cfg(feature = "full")]
fold_impl_restriction<F>(f: &mut F, node: ImplRestriction) -> ImplRestriction where F: Fold + ?Sized,1844 pub fn fold_impl_restriction<F>(f: &mut F, node: ImplRestriction) -> ImplRestriction
1845 where
1846 F: Fold + ?Sized,
1847 {
1848 match node {}
1849 }
1850 #[cfg(any(feature = "derive", feature = "full"))]
fold_index<F>(f: &mut F, node: Index) -> Index where F: Fold + ?Sized,1851 pub fn fold_index<F>(f: &mut F, node: Index) -> Index
1852 where
1853 F: Fold + ?Sized,
1854 {
1855 Index {
1856 index: node.index,
1857 span: f.fold_span(node.span),
1858 }
1859 }
1860 #[cfg(feature = "full")]
fold_item<F>(f: &mut F, node: Item) -> Item where F: Fold + ?Sized,1861 pub fn fold_item<F>(f: &mut F, node: Item) -> Item
1862 where
1863 F: Fold + ?Sized,
1864 {
1865 match node {
1866 Item::Const(_binding_0) => Item::Const(f.fold_item_const(_binding_0)),
1867 Item::Enum(_binding_0) => Item::Enum(f.fold_item_enum(_binding_0)),
1868 Item::ExternCrate(_binding_0) => {
1869 Item::ExternCrate(f.fold_item_extern_crate(_binding_0))
1870 }
1871 Item::Fn(_binding_0) => Item::Fn(f.fold_item_fn(_binding_0)),
1872 Item::ForeignMod(_binding_0) => {
1873 Item::ForeignMod(f.fold_item_foreign_mod(_binding_0))
1874 }
1875 Item::Impl(_binding_0) => Item::Impl(f.fold_item_impl(_binding_0)),
1876 Item::Macro(_binding_0) => Item::Macro(f.fold_item_macro(_binding_0)),
1877 Item::Mod(_binding_0) => Item::Mod(f.fold_item_mod(_binding_0)),
1878 Item::Static(_binding_0) => Item::Static(f.fold_item_static(_binding_0)),
1879 Item::Struct(_binding_0) => Item::Struct(f.fold_item_struct(_binding_0)),
1880 Item::Trait(_binding_0) => Item::Trait(f.fold_item_trait(_binding_0)),
1881 Item::TraitAlias(_binding_0) => {
1882 Item::TraitAlias(f.fold_item_trait_alias(_binding_0))
1883 }
1884 Item::Type(_binding_0) => Item::Type(f.fold_item_type(_binding_0)),
1885 Item::Union(_binding_0) => Item::Union(f.fold_item_union(_binding_0)),
1886 Item::Use(_binding_0) => Item::Use(f.fold_item_use(_binding_0)),
1887 Item::Verbatim(_binding_0) => Item::Verbatim(_binding_0),
1888 }
1889 }
1890 #[cfg(feature = "full")]
fold_item_const<F>(f: &mut F, node: ItemConst) -> ItemConst where F: Fold + ?Sized,1891 pub fn fold_item_const<F>(f: &mut F, node: ItemConst) -> ItemConst
1892 where
1893 F: Fold + ?Sized,
1894 {
1895 ItemConst {
1896 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1897 vis: f.fold_visibility(node.vis),
1898 const_token: node.const_token,
1899 ident: f.fold_ident(node.ident),
1900 generics: f.fold_generics(node.generics),
1901 colon_token: node.colon_token,
1902 ty: Box::new(f.fold_type(*node.ty)),
1903 eq_token: node.eq_token,
1904 expr: Box::new(f.fold_expr(*node.expr)),
1905 semi_token: node.semi_token,
1906 }
1907 }
1908 #[cfg(feature = "full")]
fold_item_enum<F>(f: &mut F, node: ItemEnum) -> ItemEnum where F: Fold + ?Sized,1909 pub fn fold_item_enum<F>(f: &mut F, node: ItemEnum) -> ItemEnum
1910 where
1911 F: Fold + ?Sized,
1912 {
1913 ItemEnum {
1914 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1915 vis: f.fold_visibility(node.vis),
1916 enum_token: node.enum_token,
1917 ident: f.fold_ident(node.ident),
1918 generics: f.fold_generics(node.generics),
1919 brace_token: node.brace_token,
1920 variants: FoldHelper::lift(node.variants, |it| f.fold_variant(it)),
1921 }
1922 }
1923 #[cfg(feature = "full")]
fold_item_extern_crate<F>(f: &mut F, node: ItemExternCrate) -> ItemExternCrate where F: Fold + ?Sized,1924 pub fn fold_item_extern_crate<F>(f: &mut F, node: ItemExternCrate) -> ItemExternCrate
1925 where
1926 F: Fold + ?Sized,
1927 {
1928 ItemExternCrate {
1929 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1930 vis: f.fold_visibility(node.vis),
1931 extern_token: node.extern_token,
1932 crate_token: node.crate_token,
1933 ident: f.fold_ident(node.ident),
1934 rename: (node.rename).map(|it| ((it).0, f.fold_ident((it).1))),
1935 semi_token: node.semi_token,
1936 }
1937 }
1938 #[cfg(feature = "full")]
fold_item_fn<F>(f: &mut F, node: ItemFn) -> ItemFn where F: Fold + ?Sized,1939 pub fn fold_item_fn<F>(f: &mut F, node: ItemFn) -> ItemFn
1940 where
1941 F: Fold + ?Sized,
1942 {
1943 ItemFn {
1944 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1945 vis: f.fold_visibility(node.vis),
1946 sig: f.fold_signature(node.sig),
1947 block: Box::new(f.fold_block(*node.block)),
1948 }
1949 }
1950 #[cfg(feature = "full")]
fold_item_foreign_mod<F>(f: &mut F, node: ItemForeignMod) -> ItemForeignMod where F: Fold + ?Sized,1951 pub fn fold_item_foreign_mod<F>(f: &mut F, node: ItemForeignMod) -> ItemForeignMod
1952 where
1953 F: Fold + ?Sized,
1954 {
1955 ItemForeignMod {
1956 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1957 unsafety: node.unsafety,
1958 abi: f.fold_abi(node.abi),
1959 brace_token: node.brace_token,
1960 items: FoldHelper::lift(node.items, |it| f.fold_foreign_item(it)),
1961 }
1962 }
1963 #[cfg(feature = "full")]
fold_item_impl<F>(f: &mut F, node: ItemImpl) -> ItemImpl where F: Fold + ?Sized,1964 pub fn fold_item_impl<F>(f: &mut F, node: ItemImpl) -> ItemImpl
1965 where
1966 F: Fold + ?Sized,
1967 {
1968 ItemImpl {
1969 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1970 defaultness: node.defaultness,
1971 unsafety: node.unsafety,
1972 impl_token: node.impl_token,
1973 generics: f.fold_generics(node.generics),
1974 trait_: (node.trait_).map(|it| ((it).0, f.fold_path((it).1), (it).2)),
1975 self_ty: Box::new(f.fold_type(*node.self_ty)),
1976 brace_token: node.brace_token,
1977 items: FoldHelper::lift(node.items, |it| f.fold_impl_item(it)),
1978 }
1979 }
1980 #[cfg(feature = "full")]
fold_item_macro<F>(f: &mut F, node: ItemMacro) -> ItemMacro where F: Fold + ?Sized,1981 pub fn fold_item_macro<F>(f: &mut F, node: ItemMacro) -> ItemMacro
1982 where
1983 F: Fold + ?Sized,
1984 {
1985 ItemMacro {
1986 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1987 ident: (node.ident).map(|it| f.fold_ident(it)),
1988 mac: f.fold_macro(node.mac),
1989 semi_token: node.semi_token,
1990 }
1991 }
1992 #[cfg(feature = "full")]
fold_item_mod<F>(f: &mut F, node: ItemMod) -> ItemMod where F: Fold + ?Sized,1993 pub fn fold_item_mod<F>(f: &mut F, node: ItemMod) -> ItemMod
1994 where
1995 F: Fold + ?Sized,
1996 {
1997 ItemMod {
1998 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1999 vis: f.fold_visibility(node.vis),
2000 unsafety: node.unsafety,
2001 mod_token: node.mod_token,
2002 ident: f.fold_ident(node.ident),
2003 content: (node.content)
2004 .map(|it| ((it).0, FoldHelper::lift((it).1, |it| f.fold_item(it)))),
2005 semi: node.semi,
2006 }
2007 }
2008 #[cfg(feature = "full")]
fold_item_static<F>(f: &mut F, node: ItemStatic) -> ItemStatic where F: Fold + ?Sized,2009 pub fn fold_item_static<F>(f: &mut F, node: ItemStatic) -> ItemStatic
2010 where
2011 F: Fold + ?Sized,
2012 {
2013 ItemStatic {
2014 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2015 vis: f.fold_visibility(node.vis),
2016 static_token: node.static_token,
2017 mutability: f.fold_static_mutability(node.mutability),
2018 ident: f.fold_ident(node.ident),
2019 colon_token: node.colon_token,
2020 ty: Box::new(f.fold_type(*node.ty)),
2021 eq_token: node.eq_token,
2022 expr: Box::new(f.fold_expr(*node.expr)),
2023 semi_token: node.semi_token,
2024 }
2025 }
2026 #[cfg(feature = "full")]
fold_item_struct<F>(f: &mut F, node: ItemStruct) -> ItemStruct where F: Fold + ?Sized,2027 pub fn fold_item_struct<F>(f: &mut F, node: ItemStruct) -> ItemStruct
2028 where
2029 F: Fold + ?Sized,
2030 {
2031 ItemStruct {
2032 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2033 vis: f.fold_visibility(node.vis),
2034 struct_token: node.struct_token,
2035 ident: f.fold_ident(node.ident),
2036 generics: f.fold_generics(node.generics),
2037 fields: f.fold_fields(node.fields),
2038 semi_token: node.semi_token,
2039 }
2040 }
2041 #[cfg(feature = "full")]
fold_item_trait<F>(f: &mut F, node: ItemTrait) -> ItemTrait where F: Fold + ?Sized,2042 pub fn fold_item_trait<F>(f: &mut F, node: ItemTrait) -> ItemTrait
2043 where
2044 F: Fold + ?Sized,
2045 {
2046 ItemTrait {
2047 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2048 vis: f.fold_visibility(node.vis),
2049 unsafety: node.unsafety,
2050 auto_token: node.auto_token,
2051 restriction: (node.restriction).map(|it| f.fold_impl_restriction(it)),
2052 trait_token: node.trait_token,
2053 ident: f.fold_ident(node.ident),
2054 generics: f.fold_generics(node.generics),
2055 colon_token: node.colon_token,
2056 supertraits: FoldHelper::lift(
2057 node.supertraits,
2058 |it| f.fold_type_param_bound(it),
2059 ),
2060 brace_token: node.brace_token,
2061 items: FoldHelper::lift(node.items, |it| f.fold_trait_item(it)),
2062 }
2063 }
2064 #[cfg(feature = "full")]
fold_item_trait_alias<F>(f: &mut F, node: ItemTraitAlias) -> ItemTraitAlias where F: Fold + ?Sized,2065 pub fn fold_item_trait_alias<F>(f: &mut F, node: ItemTraitAlias) -> ItemTraitAlias
2066 where
2067 F: Fold + ?Sized,
2068 {
2069 ItemTraitAlias {
2070 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2071 vis: f.fold_visibility(node.vis),
2072 trait_token: node.trait_token,
2073 ident: f.fold_ident(node.ident),
2074 generics: f.fold_generics(node.generics),
2075 eq_token: node.eq_token,
2076 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
2077 semi_token: node.semi_token,
2078 }
2079 }
2080 #[cfg(feature = "full")]
fold_item_type<F>(f: &mut F, node: ItemType) -> ItemType where F: Fold + ?Sized,2081 pub fn fold_item_type<F>(f: &mut F, node: ItemType) -> ItemType
2082 where
2083 F: Fold + ?Sized,
2084 {
2085 ItemType {
2086 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2087 vis: f.fold_visibility(node.vis),
2088 type_token: node.type_token,
2089 ident: f.fold_ident(node.ident),
2090 generics: f.fold_generics(node.generics),
2091 eq_token: node.eq_token,
2092 ty: Box::new(f.fold_type(*node.ty)),
2093 semi_token: node.semi_token,
2094 }
2095 }
2096 #[cfg(feature = "full")]
fold_item_union<F>(f: &mut F, node: ItemUnion) -> ItemUnion where F: Fold + ?Sized,2097 pub fn fold_item_union<F>(f: &mut F, node: ItemUnion) -> ItemUnion
2098 where
2099 F: Fold + ?Sized,
2100 {
2101 ItemUnion {
2102 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2103 vis: f.fold_visibility(node.vis),
2104 union_token: node.union_token,
2105 ident: f.fold_ident(node.ident),
2106 generics: f.fold_generics(node.generics),
2107 fields: f.fold_fields_named(node.fields),
2108 }
2109 }
2110 #[cfg(feature = "full")]
fold_item_use<F>(f: &mut F, node: ItemUse) -> ItemUse where F: Fold + ?Sized,2111 pub fn fold_item_use<F>(f: &mut F, node: ItemUse) -> ItemUse
2112 where
2113 F: Fold + ?Sized,
2114 {
2115 ItemUse {
2116 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2117 vis: f.fold_visibility(node.vis),
2118 use_token: node.use_token,
2119 leading_colon: node.leading_colon,
2120 tree: f.fold_use_tree(node.tree),
2121 semi_token: node.semi_token,
2122 }
2123 }
2124 #[cfg(feature = "full")]
fold_label<F>(f: &mut F, node: Label) -> Label where F: Fold + ?Sized,2125 pub fn fold_label<F>(f: &mut F, node: Label) -> Label
2126 where
2127 F: Fold + ?Sized,
2128 {
2129 Label {
2130 name: f.fold_lifetime(node.name),
2131 colon_token: node.colon_token,
2132 }
2133 }
fold_lifetime<F>(f: &mut F, node: Lifetime) -> Lifetime where F: Fold + ?Sized,2134 pub fn fold_lifetime<F>(f: &mut F, node: Lifetime) -> Lifetime
2135 where
2136 F: Fold + ?Sized,
2137 {
2138 Lifetime {
2139 apostrophe: f.fold_span(node.apostrophe),
2140 ident: f.fold_ident(node.ident),
2141 }
2142 }
2143 #[cfg(any(feature = "derive", feature = "full"))]
fold_lifetime_param<F>(f: &mut F, node: LifetimeParam) -> LifetimeParam where F: Fold + ?Sized,2144 pub fn fold_lifetime_param<F>(f: &mut F, node: LifetimeParam) -> LifetimeParam
2145 where
2146 F: Fold + ?Sized,
2147 {
2148 LifetimeParam {
2149 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2150 lifetime: f.fold_lifetime(node.lifetime),
2151 colon_token: node.colon_token,
2152 bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)),
2153 }
2154 }
fold_lit<F>(f: &mut F, node: Lit) -> Lit where F: Fold + ?Sized,2155 pub fn fold_lit<F>(f: &mut F, node: Lit) -> Lit
2156 where
2157 F: Fold + ?Sized,
2158 {
2159 match node {
2160 Lit::Str(_binding_0) => Lit::Str(f.fold_lit_str(_binding_0)),
2161 Lit::ByteStr(_binding_0) => Lit::ByteStr(f.fold_lit_byte_str(_binding_0)),
2162 Lit::Byte(_binding_0) => Lit::Byte(f.fold_lit_byte(_binding_0)),
2163 Lit::Char(_binding_0) => Lit::Char(f.fold_lit_char(_binding_0)),
2164 Lit::Int(_binding_0) => Lit::Int(f.fold_lit_int(_binding_0)),
2165 Lit::Float(_binding_0) => Lit::Float(f.fold_lit_float(_binding_0)),
2166 Lit::Bool(_binding_0) => Lit::Bool(f.fold_lit_bool(_binding_0)),
2167 Lit::Verbatim(_binding_0) => Lit::Verbatim(_binding_0),
2168 }
2169 }
fold_lit_bool<F>(f: &mut F, node: LitBool) -> LitBool where F: Fold + ?Sized,2170 pub fn fold_lit_bool<F>(f: &mut F, node: LitBool) -> LitBool
2171 where
2172 F: Fold + ?Sized,
2173 {
2174 LitBool {
2175 value: node.value,
2176 span: f.fold_span(node.span),
2177 }
2178 }
fold_lit_byte<F>(f: &mut F, node: LitByte) -> LitByte where F: Fold + ?Sized,2179 pub fn fold_lit_byte<F>(f: &mut F, node: LitByte) -> LitByte
2180 where
2181 F: Fold + ?Sized,
2182 {
2183 let span = f.fold_span(node.span());
2184 let mut node = node;
2185 node.set_span(span);
2186 node
2187 }
fold_lit_byte_str<F>(f: &mut F, node: LitByteStr) -> LitByteStr where F: Fold + ?Sized,2188 pub fn fold_lit_byte_str<F>(f: &mut F, node: LitByteStr) -> LitByteStr
2189 where
2190 F: Fold + ?Sized,
2191 {
2192 let span = f.fold_span(node.span());
2193 let mut node = node;
2194 node.set_span(span);
2195 node
2196 }
fold_lit_char<F>(f: &mut F, node: LitChar) -> LitChar where F: Fold + ?Sized,2197 pub fn fold_lit_char<F>(f: &mut F, node: LitChar) -> LitChar
2198 where
2199 F: Fold + ?Sized,
2200 {
2201 let span = f.fold_span(node.span());
2202 let mut node = node;
2203 node.set_span(span);
2204 node
2205 }
fold_lit_float<F>(f: &mut F, node: LitFloat) -> LitFloat where F: Fold + ?Sized,2206 pub fn fold_lit_float<F>(f: &mut F, node: LitFloat) -> LitFloat
2207 where
2208 F: Fold + ?Sized,
2209 {
2210 let span = f.fold_span(node.span());
2211 let mut node = node;
2212 node.set_span(span);
2213 node
2214 }
fold_lit_int<F>(f: &mut F, node: LitInt) -> LitInt where F: Fold + ?Sized,2215 pub fn fold_lit_int<F>(f: &mut F, node: LitInt) -> LitInt
2216 where
2217 F: Fold + ?Sized,
2218 {
2219 let span = f.fold_span(node.span());
2220 let mut node = node;
2221 node.set_span(span);
2222 node
2223 }
fold_lit_str<F>(f: &mut F, node: LitStr) -> LitStr where F: Fold + ?Sized,2224 pub fn fold_lit_str<F>(f: &mut F, node: LitStr) -> LitStr
2225 where
2226 F: Fold + ?Sized,
2227 {
2228 let span = f.fold_span(node.span());
2229 let mut node = node;
2230 node.set_span(span);
2231 node
2232 }
2233 #[cfg(feature = "full")]
fold_local<F>(f: &mut F, node: Local) -> Local where F: Fold + ?Sized,2234 pub fn fold_local<F>(f: &mut F, node: Local) -> Local
2235 where
2236 F: Fold + ?Sized,
2237 {
2238 Local {
2239 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2240 let_token: node.let_token,
2241 pat: f.fold_pat(node.pat),
2242 init: (node.init).map(|it| f.fold_local_init(it)),
2243 semi_token: node.semi_token,
2244 }
2245 }
2246 #[cfg(feature = "full")]
fold_local_init<F>(f: &mut F, node: LocalInit) -> LocalInit where F: Fold + ?Sized,2247 pub fn fold_local_init<F>(f: &mut F, node: LocalInit) -> LocalInit
2248 where
2249 F: Fold + ?Sized,
2250 {
2251 LocalInit {
2252 eq_token: node.eq_token,
2253 expr: Box::new(f.fold_expr(*node.expr)),
2254 diverge: (node.diverge).map(|it| ((it).0, Box::new(f.fold_expr(*(it).1)))),
2255 }
2256 }
2257 #[cfg(any(feature = "derive", feature = "full"))]
fold_macro<F>(f: &mut F, node: Macro) -> Macro where F: Fold + ?Sized,2258 pub fn fold_macro<F>(f: &mut F, node: Macro) -> Macro
2259 where
2260 F: Fold + ?Sized,
2261 {
2262 Macro {
2263 path: f.fold_path(node.path),
2264 bang_token: node.bang_token,
2265 delimiter: f.fold_macro_delimiter(node.delimiter),
2266 tokens: node.tokens,
2267 }
2268 }
2269 #[cfg(any(feature = "derive", feature = "full"))]
fold_macro_delimiter<F>(f: &mut F, node: MacroDelimiter) -> MacroDelimiter where F: Fold + ?Sized,2270 pub fn fold_macro_delimiter<F>(f: &mut F, node: MacroDelimiter) -> MacroDelimiter
2271 where
2272 F: Fold + ?Sized,
2273 {
2274 match node {
2275 MacroDelimiter::Paren(_binding_0) => MacroDelimiter::Paren(_binding_0),
2276 MacroDelimiter::Brace(_binding_0) => MacroDelimiter::Brace(_binding_0),
2277 MacroDelimiter::Bracket(_binding_0) => MacroDelimiter::Bracket(_binding_0),
2278 }
2279 }
2280 #[cfg(any(feature = "derive", feature = "full"))]
fold_member<F>(f: &mut F, node: Member) -> Member where F: Fold + ?Sized,2281 pub fn fold_member<F>(f: &mut F, node: Member) -> Member
2282 where
2283 F: Fold + ?Sized,
2284 {
2285 match node {
2286 Member::Named(_binding_0) => Member::Named(f.fold_ident(_binding_0)),
2287 Member::Unnamed(_binding_0) => Member::Unnamed(f.fold_index(_binding_0)),
2288 }
2289 }
2290 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta<F>(f: &mut F, node: Meta) -> Meta where F: Fold + ?Sized,2291 pub fn fold_meta<F>(f: &mut F, node: Meta) -> Meta
2292 where
2293 F: Fold + ?Sized,
2294 {
2295 match node {
2296 Meta::Path(_binding_0) => Meta::Path(f.fold_path(_binding_0)),
2297 Meta::List(_binding_0) => Meta::List(f.fold_meta_list(_binding_0)),
2298 Meta::NameValue(_binding_0) => {
2299 Meta::NameValue(f.fold_meta_name_value(_binding_0))
2300 }
2301 }
2302 }
2303 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta_list<F>(f: &mut F, node: MetaList) -> MetaList where F: Fold + ?Sized,2304 pub fn fold_meta_list<F>(f: &mut F, node: MetaList) -> MetaList
2305 where
2306 F: Fold + ?Sized,
2307 {
2308 MetaList {
2309 path: f.fold_path(node.path),
2310 delimiter: f.fold_macro_delimiter(node.delimiter),
2311 tokens: node.tokens,
2312 }
2313 }
2314 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta_name_value<F>(f: &mut F, node: MetaNameValue) -> MetaNameValue where F: Fold + ?Sized,2315 pub fn fold_meta_name_value<F>(f: &mut F, node: MetaNameValue) -> MetaNameValue
2316 where
2317 F: Fold + ?Sized,
2318 {
2319 MetaNameValue {
2320 path: f.fold_path(node.path),
2321 eq_token: node.eq_token,
2322 value: f.fold_expr(node.value),
2323 }
2324 }
2325 #[cfg(any(feature = "derive", feature = "full"))]
fold_parenthesized_generic_arguments<F>( f: &mut F, node: ParenthesizedGenericArguments, ) -> ParenthesizedGenericArguments where F: Fold + ?Sized,2326 pub fn fold_parenthesized_generic_arguments<F>(
2327 f: &mut F,
2328 node: ParenthesizedGenericArguments,
2329 ) -> ParenthesizedGenericArguments
2330 where
2331 F: Fold + ?Sized,
2332 {
2333 ParenthesizedGenericArguments {
2334 paren_token: node.paren_token,
2335 inputs: FoldHelper::lift(node.inputs, |it| f.fold_type(it)),
2336 output: f.fold_return_type(node.output),
2337 }
2338 }
2339 #[cfg(feature = "full")]
fold_pat<F>(f: &mut F, node: Pat) -> Pat where F: Fold + ?Sized,2340 pub fn fold_pat<F>(f: &mut F, node: Pat) -> Pat
2341 where
2342 F: Fold + ?Sized,
2343 {
2344 match node {
2345 Pat::Const(_binding_0) => Pat::Const(f.fold_expr_const(_binding_0)),
2346 Pat::Ident(_binding_0) => Pat::Ident(f.fold_pat_ident(_binding_0)),
2347 Pat::Lit(_binding_0) => Pat::Lit(f.fold_expr_lit(_binding_0)),
2348 Pat::Macro(_binding_0) => Pat::Macro(f.fold_expr_macro(_binding_0)),
2349 Pat::Or(_binding_0) => Pat::Or(f.fold_pat_or(_binding_0)),
2350 Pat::Paren(_binding_0) => Pat::Paren(f.fold_pat_paren(_binding_0)),
2351 Pat::Path(_binding_0) => Pat::Path(f.fold_expr_path(_binding_0)),
2352 Pat::Range(_binding_0) => Pat::Range(f.fold_expr_range(_binding_0)),
2353 Pat::Reference(_binding_0) => Pat::Reference(f.fold_pat_reference(_binding_0)),
2354 Pat::Rest(_binding_0) => Pat::Rest(f.fold_pat_rest(_binding_0)),
2355 Pat::Slice(_binding_0) => Pat::Slice(f.fold_pat_slice(_binding_0)),
2356 Pat::Struct(_binding_0) => Pat::Struct(f.fold_pat_struct(_binding_0)),
2357 Pat::Tuple(_binding_0) => Pat::Tuple(f.fold_pat_tuple(_binding_0)),
2358 Pat::TupleStruct(_binding_0) => {
2359 Pat::TupleStruct(f.fold_pat_tuple_struct(_binding_0))
2360 }
2361 Pat::Type(_binding_0) => Pat::Type(f.fold_pat_type(_binding_0)),
2362 Pat::Verbatim(_binding_0) => Pat::Verbatim(_binding_0),
2363 Pat::Wild(_binding_0) => Pat::Wild(f.fold_pat_wild(_binding_0)),
2364 }
2365 }
2366 #[cfg(feature = "full")]
fold_pat_ident<F>(f: &mut F, node: PatIdent) -> PatIdent where F: Fold + ?Sized,2367 pub fn fold_pat_ident<F>(f: &mut F, node: PatIdent) -> PatIdent
2368 where
2369 F: Fold + ?Sized,
2370 {
2371 PatIdent {
2372 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2373 by_ref: node.by_ref,
2374 mutability: node.mutability,
2375 ident: f.fold_ident(node.ident),
2376 subpat: (node.subpat).map(|it| ((it).0, Box::new(f.fold_pat(*(it).1)))),
2377 }
2378 }
2379 #[cfg(feature = "full")]
fold_pat_or<F>(f: &mut F, node: PatOr) -> PatOr where F: Fold + ?Sized,2380 pub fn fold_pat_or<F>(f: &mut F, node: PatOr) -> PatOr
2381 where
2382 F: Fold + ?Sized,
2383 {
2384 PatOr {
2385 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2386 leading_vert: node.leading_vert,
2387 cases: FoldHelper::lift(node.cases, |it| f.fold_pat(it)),
2388 }
2389 }
2390 #[cfg(feature = "full")]
fold_pat_paren<F>(f: &mut F, node: PatParen) -> PatParen where F: Fold + ?Sized,2391 pub fn fold_pat_paren<F>(f: &mut F, node: PatParen) -> PatParen
2392 where
2393 F: Fold + ?Sized,
2394 {
2395 PatParen {
2396 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2397 paren_token: node.paren_token,
2398 pat: Box::new(f.fold_pat(*node.pat)),
2399 }
2400 }
2401 #[cfg(feature = "full")]
fold_pat_reference<F>(f: &mut F, node: PatReference) -> PatReference where F: Fold + ?Sized,2402 pub fn fold_pat_reference<F>(f: &mut F, node: PatReference) -> PatReference
2403 where
2404 F: Fold + ?Sized,
2405 {
2406 PatReference {
2407 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2408 and_token: node.and_token,
2409 mutability: node.mutability,
2410 pat: Box::new(f.fold_pat(*node.pat)),
2411 }
2412 }
2413 #[cfg(feature = "full")]
fold_pat_rest<F>(f: &mut F, node: PatRest) -> PatRest where F: Fold + ?Sized,2414 pub fn fold_pat_rest<F>(f: &mut F, node: PatRest) -> PatRest
2415 where
2416 F: Fold + ?Sized,
2417 {
2418 PatRest {
2419 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2420 dot2_token: node.dot2_token,
2421 }
2422 }
2423 #[cfg(feature = "full")]
fold_pat_slice<F>(f: &mut F, node: PatSlice) -> PatSlice where F: Fold + ?Sized,2424 pub fn fold_pat_slice<F>(f: &mut F, node: PatSlice) -> PatSlice
2425 where
2426 F: Fold + ?Sized,
2427 {
2428 PatSlice {
2429 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2430 bracket_token: node.bracket_token,
2431 elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)),
2432 }
2433 }
2434 #[cfg(feature = "full")]
fold_pat_struct<F>(f: &mut F, node: PatStruct) -> PatStruct where F: Fold + ?Sized,2435 pub fn fold_pat_struct<F>(f: &mut F, node: PatStruct) -> PatStruct
2436 where
2437 F: Fold + ?Sized,
2438 {
2439 PatStruct {
2440 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2441 qself: (node.qself).map(|it| f.fold_qself(it)),
2442 path: f.fold_path(node.path),
2443 brace_token: node.brace_token,
2444 fields: FoldHelper::lift(node.fields, |it| f.fold_field_pat(it)),
2445 rest: (node.rest).map(|it| f.fold_pat_rest(it)),
2446 }
2447 }
2448 #[cfg(feature = "full")]
fold_pat_tuple<F>(f: &mut F, node: PatTuple) -> PatTuple where F: Fold + ?Sized,2449 pub fn fold_pat_tuple<F>(f: &mut F, node: PatTuple) -> PatTuple
2450 where
2451 F: Fold + ?Sized,
2452 {
2453 PatTuple {
2454 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2455 paren_token: node.paren_token,
2456 elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)),
2457 }
2458 }
2459 #[cfg(feature = "full")]
fold_pat_tuple_struct<F>(f: &mut F, node: PatTupleStruct) -> PatTupleStruct where F: Fold + ?Sized,2460 pub fn fold_pat_tuple_struct<F>(f: &mut F, node: PatTupleStruct) -> PatTupleStruct
2461 where
2462 F: Fold + ?Sized,
2463 {
2464 PatTupleStruct {
2465 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2466 qself: (node.qself).map(|it| f.fold_qself(it)),
2467 path: f.fold_path(node.path),
2468 paren_token: node.paren_token,
2469 elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)),
2470 }
2471 }
2472 #[cfg(feature = "full")]
fold_pat_type<F>(f: &mut F, node: PatType) -> PatType where F: Fold + ?Sized,2473 pub fn fold_pat_type<F>(f: &mut F, node: PatType) -> PatType
2474 where
2475 F: Fold + ?Sized,
2476 {
2477 PatType {
2478 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2479 pat: Box::new(f.fold_pat(*node.pat)),
2480 colon_token: node.colon_token,
2481 ty: Box::new(f.fold_type(*node.ty)),
2482 }
2483 }
2484 #[cfg(feature = "full")]
fold_pat_wild<F>(f: &mut F, node: PatWild) -> PatWild where F: Fold + ?Sized,2485 pub fn fold_pat_wild<F>(f: &mut F, node: PatWild) -> PatWild
2486 where
2487 F: Fold + ?Sized,
2488 {
2489 PatWild {
2490 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2491 underscore_token: node.underscore_token,
2492 }
2493 }
2494 #[cfg(any(feature = "derive", feature = "full"))]
fold_path<F>(f: &mut F, node: Path) -> Path where F: Fold + ?Sized,2495 pub fn fold_path<F>(f: &mut F, node: Path) -> Path
2496 where
2497 F: Fold + ?Sized,
2498 {
2499 Path {
2500 leading_colon: node.leading_colon,
2501 segments: FoldHelper::lift(node.segments, |it| f.fold_path_segment(it)),
2502 }
2503 }
2504 #[cfg(any(feature = "derive", feature = "full"))]
fold_path_arguments<F>(f: &mut F, node: PathArguments) -> PathArguments where F: Fold + ?Sized,2505 pub fn fold_path_arguments<F>(f: &mut F, node: PathArguments) -> PathArguments
2506 where
2507 F: Fold + ?Sized,
2508 {
2509 match node {
2510 PathArguments::None => PathArguments::None,
2511 PathArguments::AngleBracketed(_binding_0) => {
2512 PathArguments::AngleBracketed(
2513 f.fold_angle_bracketed_generic_arguments(_binding_0),
2514 )
2515 }
2516 PathArguments::Parenthesized(_binding_0) => {
2517 PathArguments::Parenthesized(
2518 f.fold_parenthesized_generic_arguments(_binding_0),
2519 )
2520 }
2521 }
2522 }
2523 #[cfg(any(feature = "derive", feature = "full"))]
fold_path_segment<F>(f: &mut F, node: PathSegment) -> PathSegment where F: Fold + ?Sized,2524 pub fn fold_path_segment<F>(f: &mut F, node: PathSegment) -> PathSegment
2525 where
2526 F: Fold + ?Sized,
2527 {
2528 PathSegment {
2529 ident: f.fold_ident(node.ident),
2530 arguments: f.fold_path_arguments(node.arguments),
2531 }
2532 }
2533 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_lifetime<F>( f: &mut F, node: PredicateLifetime, ) -> PredicateLifetime where F: Fold + ?Sized,2534 pub fn fold_predicate_lifetime<F>(
2535 f: &mut F,
2536 node: PredicateLifetime,
2537 ) -> PredicateLifetime
2538 where
2539 F: Fold + ?Sized,
2540 {
2541 PredicateLifetime {
2542 lifetime: f.fold_lifetime(node.lifetime),
2543 colon_token: node.colon_token,
2544 bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)),
2545 }
2546 }
2547 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_type<F>(f: &mut F, node: PredicateType) -> PredicateType where F: Fold + ?Sized,2548 pub fn fold_predicate_type<F>(f: &mut F, node: PredicateType) -> PredicateType
2549 where
2550 F: Fold + ?Sized,
2551 {
2552 PredicateType {
2553 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
2554 bounded_ty: f.fold_type(node.bounded_ty),
2555 colon_token: node.colon_token,
2556 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
2557 }
2558 }
2559 #[cfg(any(feature = "derive", feature = "full"))]
fold_qself<F>(f: &mut F, node: QSelf) -> QSelf where F: Fold + ?Sized,2560 pub fn fold_qself<F>(f: &mut F, node: QSelf) -> QSelf
2561 where
2562 F: Fold + ?Sized,
2563 {
2564 QSelf {
2565 lt_token: node.lt_token,
2566 ty: Box::new(f.fold_type(*node.ty)),
2567 position: node.position,
2568 as_token: node.as_token,
2569 gt_token: node.gt_token,
2570 }
2571 }
2572 #[cfg(feature = "full")]
fold_range_limits<F>(f: &mut F, node: RangeLimits) -> RangeLimits where F: Fold + ?Sized,2573 pub fn fold_range_limits<F>(f: &mut F, node: RangeLimits) -> RangeLimits
2574 where
2575 F: Fold + ?Sized,
2576 {
2577 match node {
2578 RangeLimits::HalfOpen(_binding_0) => RangeLimits::HalfOpen(_binding_0),
2579 RangeLimits::Closed(_binding_0) => RangeLimits::Closed(_binding_0),
2580 }
2581 }
2582 #[cfg(feature = "full")]
fold_receiver<F>(f: &mut F, node: Receiver) -> Receiver where F: Fold + ?Sized,2583 pub fn fold_receiver<F>(f: &mut F, node: Receiver) -> Receiver
2584 where
2585 F: Fold + ?Sized,
2586 {
2587 Receiver {
2588 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2589 reference: (node.reference)
2590 .map(|it| ((it).0, ((it).1).map(|it| f.fold_lifetime(it)))),
2591 mutability: node.mutability,
2592 self_token: node.self_token,
2593 colon_token: node.colon_token,
2594 ty: Box::new(f.fold_type(*node.ty)),
2595 }
2596 }
2597 #[cfg(any(feature = "derive", feature = "full"))]
fold_return_type<F>(f: &mut F, node: ReturnType) -> ReturnType where F: Fold + ?Sized,2598 pub fn fold_return_type<F>(f: &mut F, node: ReturnType) -> ReturnType
2599 where
2600 F: Fold + ?Sized,
2601 {
2602 match node {
2603 ReturnType::Default => ReturnType::Default,
2604 ReturnType::Type(_binding_0, _binding_1) => {
2605 ReturnType::Type(_binding_0, Box::new(f.fold_type(*_binding_1)))
2606 }
2607 }
2608 }
2609 #[cfg(feature = "full")]
fold_signature<F>(f: &mut F, node: Signature) -> Signature where F: Fold + ?Sized,2610 pub fn fold_signature<F>(f: &mut F, node: Signature) -> Signature
2611 where
2612 F: Fold + ?Sized,
2613 {
2614 Signature {
2615 constness: node.constness,
2616 asyncness: node.asyncness,
2617 unsafety: node.unsafety,
2618 abi: (node.abi).map(|it| f.fold_abi(it)),
2619 fn_token: node.fn_token,
2620 ident: f.fold_ident(node.ident),
2621 generics: f.fold_generics(node.generics),
2622 paren_token: node.paren_token,
2623 inputs: FoldHelper::lift(node.inputs, |it| f.fold_fn_arg(it)),
2624 variadic: (node.variadic).map(|it| f.fold_variadic(it)),
2625 output: f.fold_return_type(node.output),
2626 }
2627 }
fold_span<F>(f: &mut F, node: Span) -> Span where F: Fold + ?Sized,2628 pub fn fold_span<F>(f: &mut F, node: Span) -> Span
2629 where
2630 F: Fold + ?Sized,
2631 {
2632 node
2633 }
2634 #[cfg(feature = "full")]
fold_static_mutability<F>(f: &mut F, node: StaticMutability) -> StaticMutability where F: Fold + ?Sized,2635 pub fn fold_static_mutability<F>(f: &mut F, node: StaticMutability) -> StaticMutability
2636 where
2637 F: Fold + ?Sized,
2638 {
2639 match node {
2640 StaticMutability::Mut(_binding_0) => StaticMutability::Mut(_binding_0),
2641 StaticMutability::None => StaticMutability::None,
2642 }
2643 }
2644 #[cfg(feature = "full")]
fold_stmt<F>(f: &mut F, node: Stmt) -> Stmt where F: Fold + ?Sized,2645 pub fn fold_stmt<F>(f: &mut F, node: Stmt) -> Stmt
2646 where
2647 F: Fold + ?Sized,
2648 {
2649 match node {
2650 Stmt::Local(_binding_0) => Stmt::Local(f.fold_local(_binding_0)),
2651 Stmt::Item(_binding_0) => Stmt::Item(f.fold_item(_binding_0)),
2652 Stmt::Expr(_binding_0, _binding_1) => {
2653 Stmt::Expr(f.fold_expr(_binding_0), _binding_1)
2654 }
2655 Stmt::Macro(_binding_0) => Stmt::Macro(f.fold_stmt_macro(_binding_0)),
2656 }
2657 }
2658 #[cfg(feature = "full")]
fold_stmt_macro<F>(f: &mut F, node: StmtMacro) -> StmtMacro where F: Fold + ?Sized,2659 pub fn fold_stmt_macro<F>(f: &mut F, node: StmtMacro) -> StmtMacro
2660 where
2661 F: Fold + ?Sized,
2662 {
2663 StmtMacro {
2664 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2665 mac: f.fold_macro(node.mac),
2666 semi_token: node.semi_token,
2667 }
2668 }
2669 #[cfg(any(feature = "derive", feature = "full"))]
fold_trait_bound<F>(f: &mut F, node: TraitBound) -> TraitBound where F: Fold + ?Sized,2670 pub fn fold_trait_bound<F>(f: &mut F, node: TraitBound) -> TraitBound
2671 where
2672 F: Fold + ?Sized,
2673 {
2674 TraitBound {
2675 paren_token: node.paren_token,
2676 modifier: f.fold_trait_bound_modifier(node.modifier),
2677 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
2678 path: f.fold_path(node.path),
2679 }
2680 }
2681 #[cfg(any(feature = "derive", feature = "full"))]
fold_trait_bound_modifier<F>( f: &mut F, node: TraitBoundModifier, ) -> TraitBoundModifier where F: Fold + ?Sized,2682 pub fn fold_trait_bound_modifier<F>(
2683 f: &mut F,
2684 node: TraitBoundModifier,
2685 ) -> TraitBoundModifier
2686 where
2687 F: Fold + ?Sized,
2688 {
2689 match node {
2690 TraitBoundModifier::None => TraitBoundModifier::None,
2691 TraitBoundModifier::Maybe(_binding_0) => TraitBoundModifier::Maybe(_binding_0),
2692 }
2693 }
2694 #[cfg(feature = "full")]
fold_trait_item<F>(f: &mut F, node: TraitItem) -> TraitItem where F: Fold + ?Sized,2695 pub fn fold_trait_item<F>(f: &mut F, node: TraitItem) -> TraitItem
2696 where
2697 F: Fold + ?Sized,
2698 {
2699 match node {
2700 TraitItem::Const(_binding_0) => {
2701 TraitItem::Const(f.fold_trait_item_const(_binding_0))
2702 }
2703 TraitItem::Fn(_binding_0) => TraitItem::Fn(f.fold_trait_item_fn(_binding_0)),
2704 TraitItem::Type(_binding_0) => {
2705 TraitItem::Type(f.fold_trait_item_type(_binding_0))
2706 }
2707 TraitItem::Macro(_binding_0) => {
2708 TraitItem::Macro(f.fold_trait_item_macro(_binding_0))
2709 }
2710 TraitItem::Verbatim(_binding_0) => TraitItem::Verbatim(_binding_0),
2711 }
2712 }
2713 #[cfg(feature = "full")]
fold_trait_item_const<F>(f: &mut F, node: TraitItemConst) -> TraitItemConst where F: Fold + ?Sized,2714 pub fn fold_trait_item_const<F>(f: &mut F, node: TraitItemConst) -> TraitItemConst
2715 where
2716 F: Fold + ?Sized,
2717 {
2718 TraitItemConst {
2719 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2720 const_token: node.const_token,
2721 ident: f.fold_ident(node.ident),
2722 generics: f.fold_generics(node.generics),
2723 colon_token: node.colon_token,
2724 ty: f.fold_type(node.ty),
2725 default: (node.default).map(|it| ((it).0, f.fold_expr((it).1))),
2726 semi_token: node.semi_token,
2727 }
2728 }
2729 #[cfg(feature = "full")]
fold_trait_item_fn<F>(f: &mut F, node: TraitItemFn) -> TraitItemFn where F: Fold + ?Sized,2730 pub fn fold_trait_item_fn<F>(f: &mut F, node: TraitItemFn) -> TraitItemFn
2731 where
2732 F: Fold + ?Sized,
2733 {
2734 TraitItemFn {
2735 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2736 sig: f.fold_signature(node.sig),
2737 default: (node.default).map(|it| f.fold_block(it)),
2738 semi_token: node.semi_token,
2739 }
2740 }
2741 #[cfg(feature = "full")]
fold_trait_item_macro<F>(f: &mut F, node: TraitItemMacro) -> TraitItemMacro where F: Fold + ?Sized,2742 pub fn fold_trait_item_macro<F>(f: &mut F, node: TraitItemMacro) -> TraitItemMacro
2743 where
2744 F: Fold + ?Sized,
2745 {
2746 TraitItemMacro {
2747 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2748 mac: f.fold_macro(node.mac),
2749 semi_token: node.semi_token,
2750 }
2751 }
2752 #[cfg(feature = "full")]
fold_trait_item_type<F>(f: &mut F, node: TraitItemType) -> TraitItemType where F: Fold + ?Sized,2753 pub fn fold_trait_item_type<F>(f: &mut F, node: TraitItemType) -> TraitItemType
2754 where
2755 F: Fold + ?Sized,
2756 {
2757 TraitItemType {
2758 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2759 type_token: node.type_token,
2760 ident: f.fold_ident(node.ident),
2761 generics: f.fold_generics(node.generics),
2762 colon_token: node.colon_token,
2763 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
2764 default: (node.default).map(|it| ((it).0, f.fold_type((it).1))),
2765 semi_token: node.semi_token,
2766 }
2767 }
2768 #[cfg(any(feature = "derive", feature = "full"))]
fold_type<F>(f: &mut F, node: Type) -> Type where F: Fold + ?Sized,2769 pub fn fold_type<F>(f: &mut F, node: Type) -> Type
2770 where
2771 F: Fold + ?Sized,
2772 {
2773 match node {
2774 Type::Array(_binding_0) => Type::Array(f.fold_type_array(_binding_0)),
2775 Type::BareFn(_binding_0) => Type::BareFn(f.fold_type_bare_fn(_binding_0)),
2776 Type::Group(_binding_0) => Type::Group(f.fold_type_group(_binding_0)),
2777 Type::ImplTrait(_binding_0) => {
2778 Type::ImplTrait(f.fold_type_impl_trait(_binding_0))
2779 }
2780 Type::Infer(_binding_0) => Type::Infer(f.fold_type_infer(_binding_0)),
2781 Type::Macro(_binding_0) => Type::Macro(f.fold_type_macro(_binding_0)),
2782 Type::Never(_binding_0) => Type::Never(f.fold_type_never(_binding_0)),
2783 Type::Paren(_binding_0) => Type::Paren(f.fold_type_paren(_binding_0)),
2784 Type::Path(_binding_0) => Type::Path(f.fold_type_path(_binding_0)),
2785 Type::Ptr(_binding_0) => Type::Ptr(f.fold_type_ptr(_binding_0)),
2786 Type::Reference(_binding_0) => Type::Reference(f.fold_type_reference(_binding_0)),
2787 Type::Slice(_binding_0) => Type::Slice(f.fold_type_slice(_binding_0)),
2788 Type::TraitObject(_binding_0) => {
2789 Type::TraitObject(f.fold_type_trait_object(_binding_0))
2790 }
2791 Type::Tuple(_binding_0) => Type::Tuple(f.fold_type_tuple(_binding_0)),
2792 Type::Verbatim(_binding_0) => Type::Verbatim(_binding_0),
2793 }
2794 }
2795 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_array<F>(f: &mut F, node: TypeArray) -> TypeArray where F: Fold + ?Sized,2796 pub fn fold_type_array<F>(f: &mut F, node: TypeArray) -> TypeArray
2797 where
2798 F: Fold + ?Sized,
2799 {
2800 TypeArray {
2801 bracket_token: node.bracket_token,
2802 elem: Box::new(f.fold_type(*node.elem)),
2803 semi_token: node.semi_token,
2804 len: f.fold_expr(node.len),
2805 }
2806 }
2807 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_bare_fn<F>(f: &mut F, node: TypeBareFn) -> TypeBareFn where F: Fold + ?Sized,2808 pub fn fold_type_bare_fn<F>(f: &mut F, node: TypeBareFn) -> TypeBareFn
2809 where
2810 F: Fold + ?Sized,
2811 {
2812 TypeBareFn {
2813 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
2814 unsafety: node.unsafety,
2815 abi: (node.abi).map(|it| f.fold_abi(it)),
2816 fn_token: node.fn_token,
2817 paren_token: node.paren_token,
2818 inputs: FoldHelper::lift(node.inputs, |it| f.fold_bare_fn_arg(it)),
2819 variadic: (node.variadic).map(|it| f.fold_bare_variadic(it)),
2820 output: f.fold_return_type(node.output),
2821 }
2822 }
2823 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_group<F>(f: &mut F, node: TypeGroup) -> TypeGroup where F: Fold + ?Sized,2824 pub fn fold_type_group<F>(f: &mut F, node: TypeGroup) -> TypeGroup
2825 where
2826 F: Fold + ?Sized,
2827 {
2828 TypeGroup {
2829 group_token: node.group_token,
2830 elem: Box::new(f.fold_type(*node.elem)),
2831 }
2832 }
2833 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_impl_trait<F>(f: &mut F, node: TypeImplTrait) -> TypeImplTrait where F: Fold + ?Sized,2834 pub fn fold_type_impl_trait<F>(f: &mut F, node: TypeImplTrait) -> TypeImplTrait
2835 where
2836 F: Fold + ?Sized,
2837 {
2838 TypeImplTrait {
2839 impl_token: node.impl_token,
2840 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
2841 }
2842 }
2843 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_infer<F>(f: &mut F, node: TypeInfer) -> TypeInfer where F: Fold + ?Sized,2844 pub fn fold_type_infer<F>(f: &mut F, node: TypeInfer) -> TypeInfer
2845 where
2846 F: Fold + ?Sized,
2847 {
2848 TypeInfer {
2849 underscore_token: node.underscore_token,
2850 }
2851 }
2852 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_macro<F>(f: &mut F, node: TypeMacro) -> TypeMacro where F: Fold + ?Sized,2853 pub fn fold_type_macro<F>(f: &mut F, node: TypeMacro) -> TypeMacro
2854 where
2855 F: Fold + ?Sized,
2856 {
2857 TypeMacro {
2858 mac: f.fold_macro(node.mac),
2859 }
2860 }
2861 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_never<F>(f: &mut F, node: TypeNever) -> TypeNever where F: Fold + ?Sized,2862 pub fn fold_type_never<F>(f: &mut F, node: TypeNever) -> TypeNever
2863 where
2864 F: Fold + ?Sized,
2865 {
2866 TypeNever {
2867 bang_token: node.bang_token,
2868 }
2869 }
2870 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_param<F>(f: &mut F, node: TypeParam) -> TypeParam where F: Fold + ?Sized,2871 pub fn fold_type_param<F>(f: &mut F, node: TypeParam) -> TypeParam
2872 where
2873 F: Fold + ?Sized,
2874 {
2875 TypeParam {
2876 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2877 ident: f.fold_ident(node.ident),
2878 colon_token: node.colon_token,
2879 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
2880 eq_token: node.eq_token,
2881 default: (node.default).map(|it| f.fold_type(it)),
2882 }
2883 }
2884 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_param_bound<F>(f: &mut F, node: TypeParamBound) -> TypeParamBound where F: Fold + ?Sized,2885 pub fn fold_type_param_bound<F>(f: &mut F, node: TypeParamBound) -> TypeParamBound
2886 where
2887 F: Fold + ?Sized,
2888 {
2889 match node {
2890 TypeParamBound::Trait(_binding_0) => {
2891 TypeParamBound::Trait(f.fold_trait_bound(_binding_0))
2892 }
2893 TypeParamBound::Lifetime(_binding_0) => {
2894 TypeParamBound::Lifetime(f.fold_lifetime(_binding_0))
2895 }
2896 TypeParamBound::Verbatim(_binding_0) => TypeParamBound::Verbatim(_binding_0),
2897 }
2898 }
2899 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_paren<F>(f: &mut F, node: TypeParen) -> TypeParen where F: Fold + ?Sized,2900 pub fn fold_type_paren<F>(f: &mut F, node: TypeParen) -> TypeParen
2901 where
2902 F: Fold + ?Sized,
2903 {
2904 TypeParen {
2905 paren_token: node.paren_token,
2906 elem: Box::new(f.fold_type(*node.elem)),
2907 }
2908 }
2909 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_path<F>(f: &mut F, node: TypePath) -> TypePath where F: Fold + ?Sized,2910 pub fn fold_type_path<F>(f: &mut F, node: TypePath) -> TypePath
2911 where
2912 F: Fold + ?Sized,
2913 {
2914 TypePath {
2915 qself: (node.qself).map(|it| f.fold_qself(it)),
2916 path: f.fold_path(node.path),
2917 }
2918 }
2919 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_ptr<F>(f: &mut F, node: TypePtr) -> TypePtr where F: Fold + ?Sized,2920 pub fn fold_type_ptr<F>(f: &mut F, node: TypePtr) -> TypePtr
2921 where
2922 F: Fold + ?Sized,
2923 {
2924 TypePtr {
2925 star_token: node.star_token,
2926 const_token: node.const_token,
2927 mutability: node.mutability,
2928 elem: Box::new(f.fold_type(*node.elem)),
2929 }
2930 }
2931 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_reference<F>(f: &mut F, node: TypeReference) -> TypeReference where F: Fold + ?Sized,2932 pub fn fold_type_reference<F>(f: &mut F, node: TypeReference) -> TypeReference
2933 where
2934 F: Fold + ?Sized,
2935 {
2936 TypeReference {
2937 and_token: node.and_token,
2938 lifetime: (node.lifetime).map(|it| f.fold_lifetime(it)),
2939 mutability: node.mutability,
2940 elem: Box::new(f.fold_type(*node.elem)),
2941 }
2942 }
2943 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_slice<F>(f: &mut F, node: TypeSlice) -> TypeSlice where F: Fold + ?Sized,2944 pub fn fold_type_slice<F>(f: &mut F, node: TypeSlice) -> TypeSlice
2945 where
2946 F: Fold + ?Sized,
2947 {
2948 TypeSlice {
2949 bracket_token: node.bracket_token,
2950 elem: Box::new(f.fold_type(*node.elem)),
2951 }
2952 }
2953 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_trait_object<F>(f: &mut F, node: TypeTraitObject) -> TypeTraitObject where F: Fold + ?Sized,2954 pub fn fold_type_trait_object<F>(f: &mut F, node: TypeTraitObject) -> TypeTraitObject
2955 where
2956 F: Fold + ?Sized,
2957 {
2958 TypeTraitObject {
2959 dyn_token: node.dyn_token,
2960 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
2961 }
2962 }
2963 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_tuple<F>(f: &mut F, node: TypeTuple) -> TypeTuple where F: Fold + ?Sized,2964 pub fn fold_type_tuple<F>(f: &mut F, node: TypeTuple) -> TypeTuple
2965 where
2966 F: Fold + ?Sized,
2967 {
2968 TypeTuple {
2969 paren_token: node.paren_token,
2970 elems: FoldHelper::lift(node.elems, |it| f.fold_type(it)),
2971 }
2972 }
2973 #[cfg(any(feature = "derive", feature = "full"))]
fold_un_op<F>(f: &mut F, node: UnOp) -> UnOp where F: Fold + ?Sized,2974 pub fn fold_un_op<F>(f: &mut F, node: UnOp) -> UnOp
2975 where
2976 F: Fold + ?Sized,
2977 {
2978 match node {
2979 UnOp::Deref(_binding_0) => UnOp::Deref(_binding_0),
2980 UnOp::Not(_binding_0) => UnOp::Not(_binding_0),
2981 UnOp::Neg(_binding_0) => UnOp::Neg(_binding_0),
2982 }
2983 }
2984 #[cfg(feature = "full")]
fold_use_glob<F>(f: &mut F, node: UseGlob) -> UseGlob where F: Fold + ?Sized,2985 pub fn fold_use_glob<F>(f: &mut F, node: UseGlob) -> UseGlob
2986 where
2987 F: Fold + ?Sized,
2988 {
2989 UseGlob {
2990 star_token: node.star_token,
2991 }
2992 }
2993 #[cfg(feature = "full")]
fold_use_group<F>(f: &mut F, node: UseGroup) -> UseGroup where F: Fold + ?Sized,2994 pub fn fold_use_group<F>(f: &mut F, node: UseGroup) -> UseGroup
2995 where
2996 F: Fold + ?Sized,
2997 {
2998 UseGroup {
2999 brace_token: node.brace_token,
3000 items: FoldHelper::lift(node.items, |it| f.fold_use_tree(it)),
3001 }
3002 }
3003 #[cfg(feature = "full")]
fold_use_name<F>(f: &mut F, node: UseName) -> UseName where F: Fold + ?Sized,3004 pub fn fold_use_name<F>(f: &mut F, node: UseName) -> UseName
3005 where
3006 F: Fold + ?Sized,
3007 {
3008 UseName {
3009 ident: f.fold_ident(node.ident),
3010 }
3011 }
3012 #[cfg(feature = "full")]
fold_use_path<F>(f: &mut F, node: UsePath) -> UsePath where F: Fold + ?Sized,3013 pub fn fold_use_path<F>(f: &mut F, node: UsePath) -> UsePath
3014 where
3015 F: Fold + ?Sized,
3016 {
3017 UsePath {
3018 ident: f.fold_ident(node.ident),
3019 colon2_token: node.colon2_token,
3020 tree: Box::new(f.fold_use_tree(*node.tree)),
3021 }
3022 }
3023 #[cfg(feature = "full")]
fold_use_rename<F>(f: &mut F, node: UseRename) -> UseRename where F: Fold + ?Sized,3024 pub fn fold_use_rename<F>(f: &mut F, node: UseRename) -> UseRename
3025 where
3026 F: Fold + ?Sized,
3027 {
3028 UseRename {
3029 ident: f.fold_ident(node.ident),
3030 as_token: node.as_token,
3031 rename: f.fold_ident(node.rename),
3032 }
3033 }
3034 #[cfg(feature = "full")]
fold_use_tree<F>(f: &mut F, node: UseTree) -> UseTree where F: Fold + ?Sized,3035 pub fn fold_use_tree<F>(f: &mut F, node: UseTree) -> UseTree
3036 where
3037 F: Fold + ?Sized,
3038 {
3039 match node {
3040 UseTree::Path(_binding_0) => UseTree::Path(f.fold_use_path(_binding_0)),
3041 UseTree::Name(_binding_0) => UseTree::Name(f.fold_use_name(_binding_0)),
3042 UseTree::Rename(_binding_0) => UseTree::Rename(f.fold_use_rename(_binding_0)),
3043 UseTree::Glob(_binding_0) => UseTree::Glob(f.fold_use_glob(_binding_0)),
3044 UseTree::Group(_binding_0) => UseTree::Group(f.fold_use_group(_binding_0)),
3045 }
3046 }
3047 #[cfg(feature = "full")]
fold_variadic<F>(f: &mut F, node: Variadic) -> Variadic where F: Fold + ?Sized,3048 pub fn fold_variadic<F>(f: &mut F, node: Variadic) -> Variadic
3049 where
3050 F: Fold + ?Sized,
3051 {
3052 Variadic {
3053 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
3054 pat: (node.pat).map(|it| (Box::new(f.fold_pat(*(it).0)), (it).1)),
3055 dots: node.dots,
3056 comma: node.comma,
3057 }
3058 }
3059 #[cfg(any(feature = "derive", feature = "full"))]
fold_variant<F>(f: &mut F, node: Variant) -> Variant where F: Fold + ?Sized,3060 pub fn fold_variant<F>(f: &mut F, node: Variant) -> Variant
3061 where
3062 F: Fold + ?Sized,
3063 {
3064 Variant {
3065 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
3066 ident: f.fold_ident(node.ident),
3067 fields: f.fold_fields(node.fields),
3068 discriminant: (node.discriminant).map(|it| ((it).0, f.fold_expr((it).1))),
3069 }
3070 }
3071 #[cfg(any(feature = "derive", feature = "full"))]
fold_vis_restricted<F>(f: &mut F, node: VisRestricted) -> VisRestricted where F: Fold + ?Sized,3072 pub fn fold_vis_restricted<F>(f: &mut F, node: VisRestricted) -> VisRestricted
3073 where
3074 F: Fold + ?Sized,
3075 {
3076 VisRestricted {
3077 pub_token: node.pub_token,
3078 paren_token: node.paren_token,
3079 in_token: node.in_token,
3080 path: Box::new(f.fold_path(*node.path)),
3081 }
3082 }
3083 #[cfg(any(feature = "derive", feature = "full"))]
fold_visibility<F>(f: &mut F, node: Visibility) -> Visibility where F: Fold + ?Sized,3084 pub fn fold_visibility<F>(f: &mut F, node: Visibility) -> Visibility
3085 where
3086 F: Fold + ?Sized,
3087 {
3088 match node {
3089 Visibility::Public(_binding_0) => Visibility::Public(_binding_0),
3090 Visibility::Restricted(_binding_0) => {
3091 Visibility::Restricted(f.fold_vis_restricted(_binding_0))
3092 }
3093 Visibility::Inherited => Visibility::Inherited,
3094 }
3095 }
3096 #[cfg(any(feature = "derive", feature = "full"))]
fold_where_clause<F>(f: &mut F, node: WhereClause) -> WhereClause where F: Fold + ?Sized,3097 pub fn fold_where_clause<F>(f: &mut F, node: WhereClause) -> WhereClause
3098 where
3099 F: Fold + ?Sized,
3100 {
3101 WhereClause {
3102 where_token: node.where_token,
3103 predicates: FoldHelper::lift(node.predicates, |it| f.fold_where_predicate(it)),
3104 }
3105 }
3106 #[cfg(any(feature = "derive", feature = "full"))]
fold_where_predicate<F>(f: &mut F, node: WherePredicate) -> WherePredicate where F: Fold + ?Sized,3107 pub fn fold_where_predicate<F>(f: &mut F, node: WherePredicate) -> WherePredicate
3108 where
3109 F: Fold + ?Sized,
3110 {
3111 match node {
3112 WherePredicate::Lifetime(_binding_0) => {
3113 WherePredicate::Lifetime(f.fold_predicate_lifetime(_binding_0))
3114 }
3115 WherePredicate::Type(_binding_0) => {
3116 WherePredicate::Type(f.fold_predicate_type(_binding_0))
3117 }
3118 }
3119 }
3120