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(clippy::match_wildcard_for_single_variants)]
6 #[cfg(any(feature = "full", feature = "derive"))]
7 use crate::gen::helper::fold::*;
8 #[cfg(any(feature = "full", feature = "derive"))]
9 use crate::token::{Brace, Bracket, Group, Paren};
10 use crate::*;
11 use proc_macro2::Span;
12 #[cfg(feature = "full")]
13 macro_rules! full {
14 ($e:expr) => {
15 $e
16 };
17 }
18 #[cfg(all(feature = "derive", not(feature = "full")))]
19 macro_rules! full {
20 ($e:expr) => {
21 unreachable!()
22 };
23 }
24 /// Syntax tree traversal to transform the nodes of an owned syntax tree.
25 ///
26 /// See the [module documentation] for details.
27 ///
28 /// [module documentation]: self
29 ///
30 /// *This trait is available only if Syn is built with the `"fold"` feature.*
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_attr_style(&mut self, i: AttrStyle) -> AttrStyle48 fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle {
49 fold_attr_style(self, i)
50 }
51 #[cfg(any(feature = "derive", feature = "full"))]
fold_attribute(&mut self, i: Attribute) -> Attribute52 fn fold_attribute(&mut self, i: Attribute) -> Attribute {
53 fold_attribute(self, i)
54 }
55 #[cfg(any(feature = "derive", feature = "full"))]
fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg56 fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg {
57 fold_bare_fn_arg(self, i)
58 }
59 #[cfg(any(feature = "derive", feature = "full"))]
fold_bin_op(&mut self, i: BinOp) -> BinOp60 fn fold_bin_op(&mut self, i: BinOp) -> BinOp {
61 fold_bin_op(self, i)
62 }
63 #[cfg(any(feature = "derive", feature = "full"))]
fold_binding(&mut self, i: Binding) -> Binding64 fn fold_binding(&mut self, i: Binding) -> Binding {
65 fold_binding(self, i)
66 }
67 #[cfg(feature = "full")]
fold_block(&mut self, i: Block) -> Block68 fn fold_block(&mut self, i: Block) -> Block {
69 fold_block(self, i)
70 }
71 #[cfg(any(feature = "derive", feature = "full"))]
fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes72 fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes {
73 fold_bound_lifetimes(self, i)
74 }
75 #[cfg(any(feature = "derive", feature = "full"))]
fold_const_param(&mut self, i: ConstParam) -> ConstParam76 fn fold_const_param(&mut self, i: ConstParam) -> ConstParam {
77 fold_const_param(self, i)
78 }
79 #[cfg(any(feature = "derive", feature = "full"))]
fold_constraint(&mut self, i: Constraint) -> Constraint80 fn fold_constraint(&mut self, i: Constraint) -> Constraint {
81 fold_constraint(self, i)
82 }
83 #[cfg(feature = "derive")]
fold_data(&mut self, i: Data) -> Data84 fn fold_data(&mut self, i: Data) -> Data {
85 fold_data(self, i)
86 }
87 #[cfg(feature = "derive")]
fold_data_enum(&mut self, i: DataEnum) -> DataEnum88 fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum {
89 fold_data_enum(self, i)
90 }
91 #[cfg(feature = "derive")]
fold_data_struct(&mut self, i: DataStruct) -> DataStruct92 fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct {
93 fold_data_struct(self, i)
94 }
95 #[cfg(feature = "derive")]
fold_data_union(&mut self, i: DataUnion) -> DataUnion96 fn fold_data_union(&mut self, i: DataUnion) -> DataUnion {
97 fold_data_union(self, i)
98 }
99 #[cfg(feature = "derive")]
fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput100 fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput {
101 fold_derive_input(self, i)
102 }
103 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr(&mut self, i: Expr) -> Expr104 fn fold_expr(&mut self, i: Expr) -> Expr {
105 fold_expr(self, i)
106 }
107 #[cfg(feature = "full")]
fold_expr_array(&mut self, i: ExprArray) -> ExprArray108 fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray {
109 fold_expr_array(self, i)
110 }
111 #[cfg(feature = "full")]
fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign112 fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign {
113 fold_expr_assign(self, i)
114 }
115 #[cfg(feature = "full")]
fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp116 fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp {
117 fold_expr_assign_op(self, i)
118 }
119 #[cfg(feature = "full")]
fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync120 fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync {
121 fold_expr_async(self, i)
122 }
123 #[cfg(feature = "full")]
fold_expr_await(&mut self, i: ExprAwait) -> ExprAwait124 fn fold_expr_await(&mut self, i: ExprAwait) -> ExprAwait {
125 fold_expr_await(self, i)
126 }
127 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary128 fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary {
129 fold_expr_binary(self, i)
130 }
131 #[cfg(feature = "full")]
fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock132 fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock {
133 fold_expr_block(self, i)
134 }
135 #[cfg(feature = "full")]
fold_expr_box(&mut self, i: ExprBox) -> ExprBox136 fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox {
137 fold_expr_box(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_continue(&mut self, i: ExprContinue) -> ExprContinue156 fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue {
157 fold_expr_continue(self, i)
158 }
159 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_field(&mut self, i: ExprField) -> ExprField160 fn fold_expr_field(&mut self, i: ExprField) -> ExprField {
161 fold_expr_field(self, i)
162 }
163 #[cfg(feature = "full")]
fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop164 fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop {
165 fold_expr_for_loop(self, i)
166 }
167 #[cfg(feature = "full")]
fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup168 fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup {
169 fold_expr_group(self, i)
170 }
171 #[cfg(feature = "full")]
fold_expr_if(&mut self, i: ExprIf) -> ExprIf172 fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf {
173 fold_expr_if(self, i)
174 }
175 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex176 fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex {
177 fold_expr_index(self, i)
178 }
179 #[cfg(feature = "full")]
fold_expr_let(&mut self, i: ExprLet) -> ExprLet180 fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet {
181 fold_expr_let(self, i)
182 }
183 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_lit(&mut self, i: ExprLit) -> ExprLit184 fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit {
185 fold_expr_lit(self, i)
186 }
187 #[cfg(feature = "full")]
fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop188 fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop {
189 fold_expr_loop(self, i)
190 }
191 #[cfg(feature = "full")]
fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro192 fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro {
193 fold_expr_macro(self, i)
194 }
195 #[cfg(feature = "full")]
fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch196 fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch {
197 fold_expr_match(self, i)
198 }
199 #[cfg(feature = "full")]
fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall200 fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall {
201 fold_expr_method_call(self, i)
202 }
203 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_paren(&mut self, i: ExprParen) -> ExprParen204 fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen {
205 fold_expr_paren(self, i)
206 }
207 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_path(&mut self, i: ExprPath) -> ExprPath208 fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath {
209 fold_expr_path(self, i)
210 }
211 #[cfg(feature = "full")]
fold_expr_range(&mut self, i: ExprRange) -> ExprRange212 fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange {
213 fold_expr_range(self, i)
214 }
215 #[cfg(feature = "full")]
fold_expr_reference(&mut self, i: ExprReference) -> ExprReference216 fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference {
217 fold_expr_reference(self, i)
218 }
219 #[cfg(feature = "full")]
fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat220 fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat {
221 fold_expr_repeat(self, i)
222 }
223 #[cfg(feature = "full")]
fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn224 fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn {
225 fold_expr_return(self, i)
226 }
227 #[cfg(feature = "full")]
fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct228 fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct {
229 fold_expr_struct(self, i)
230 }
231 #[cfg(feature = "full")]
fold_expr_try(&mut self, i: ExprTry) -> ExprTry232 fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry {
233 fold_expr_try(self, i)
234 }
235 #[cfg(feature = "full")]
fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock236 fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock {
237 fold_expr_try_block(self, i)
238 }
239 #[cfg(feature = "full")]
fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple240 fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple {
241 fold_expr_tuple(self, i)
242 }
243 #[cfg(feature = "full")]
fold_expr_type(&mut self, i: ExprType) -> ExprType244 fn fold_expr_type(&mut self, i: ExprType) -> ExprType {
245 fold_expr_type(self, i)
246 }
247 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary248 fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary {
249 fold_expr_unary(self, i)
250 }
251 #[cfg(feature = "full")]
fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe252 fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe {
253 fold_expr_unsafe(self, i)
254 }
255 #[cfg(feature = "full")]
fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile256 fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile {
257 fold_expr_while(self, i)
258 }
259 #[cfg(feature = "full")]
fold_expr_yield(&mut self, i: ExprYield) -> ExprYield260 fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield {
261 fold_expr_yield(self, i)
262 }
263 #[cfg(any(feature = "derive", feature = "full"))]
fold_field(&mut self, i: Field) -> Field264 fn fold_field(&mut self, i: Field) -> Field {
265 fold_field(self, i)
266 }
267 #[cfg(feature = "full")]
fold_field_pat(&mut self, i: FieldPat) -> FieldPat268 fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat {
269 fold_field_pat(self, i)
270 }
271 #[cfg(feature = "full")]
fold_field_value(&mut self, i: FieldValue) -> FieldValue272 fn fold_field_value(&mut self, i: FieldValue) -> FieldValue {
273 fold_field_value(self, i)
274 }
275 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields(&mut self, i: Fields) -> Fields276 fn fold_fields(&mut self, i: Fields) -> Fields {
277 fold_fields(self, i)
278 }
279 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed280 fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed {
281 fold_fields_named(self, i)
282 }
283 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed284 fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed {
285 fold_fields_unnamed(self, i)
286 }
287 #[cfg(feature = "full")]
fold_file(&mut self, i: File) -> File288 fn fold_file(&mut self, i: File) -> File {
289 fold_file(self, i)
290 }
291 #[cfg(feature = "full")]
fold_fn_arg(&mut self, i: FnArg) -> FnArg292 fn fold_fn_arg(&mut self, i: FnArg) -> FnArg {
293 fold_fn_arg(self, i)
294 }
295 #[cfg(feature = "full")]
fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem296 fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem {
297 fold_foreign_item(self, i)
298 }
299 #[cfg(feature = "full")]
fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn300 fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn {
301 fold_foreign_item_fn(self, i)
302 }
303 #[cfg(feature = "full")]
fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro304 fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro {
305 fold_foreign_item_macro(self, i)
306 }
307 #[cfg(feature = "full")]
fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic308 fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic {
309 fold_foreign_item_static(self, i)
310 }
311 #[cfg(feature = "full")]
fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType312 fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType {
313 fold_foreign_item_type(self, i)
314 }
315 #[cfg(any(feature = "derive", feature = "full"))]
fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument316 fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument {
317 fold_generic_argument(self, i)
318 }
319 #[cfg(feature = "full")]
fold_generic_method_argument( &mut self, i: GenericMethodArgument, ) -> GenericMethodArgument320 fn fold_generic_method_argument(
321 &mut self,
322 i: GenericMethodArgument,
323 ) -> GenericMethodArgument {
324 fold_generic_method_argument(self, i)
325 }
326 #[cfg(any(feature = "derive", feature = "full"))]
fold_generic_param(&mut self, i: GenericParam) -> GenericParam327 fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam {
328 fold_generic_param(self, i)
329 }
330 #[cfg(any(feature = "derive", feature = "full"))]
fold_generics(&mut self, i: Generics) -> Generics331 fn fold_generics(&mut self, i: Generics) -> Generics {
332 fold_generics(self, i)
333 }
fold_ident(&mut self, i: Ident) -> Ident334 fn fold_ident(&mut self, i: Ident) -> Ident {
335 fold_ident(self, i)
336 }
337 #[cfg(feature = "full")]
fold_impl_item(&mut self, i: ImplItem) -> ImplItem338 fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem {
339 fold_impl_item(self, i)
340 }
341 #[cfg(feature = "full")]
fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst342 fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst {
343 fold_impl_item_const(self, i)
344 }
345 #[cfg(feature = "full")]
fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro346 fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro {
347 fold_impl_item_macro(self, i)
348 }
349 #[cfg(feature = "full")]
fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod350 fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod {
351 fold_impl_item_method(self, i)
352 }
353 #[cfg(feature = "full")]
fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType354 fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType {
355 fold_impl_item_type(self, i)
356 }
357 #[cfg(any(feature = "derive", feature = "full"))]
fold_index(&mut self, i: Index) -> Index358 fn fold_index(&mut self, i: Index) -> Index {
359 fold_index(self, i)
360 }
361 #[cfg(feature = "full")]
fold_item(&mut self, i: Item) -> Item362 fn fold_item(&mut self, i: Item) -> Item {
363 fold_item(self, i)
364 }
365 #[cfg(feature = "full")]
fold_item_const(&mut self, i: ItemConst) -> ItemConst366 fn fold_item_const(&mut self, i: ItemConst) -> ItemConst {
367 fold_item_const(self, i)
368 }
369 #[cfg(feature = "full")]
fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum370 fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum {
371 fold_item_enum(self, i)
372 }
373 #[cfg(feature = "full")]
fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate374 fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate {
375 fold_item_extern_crate(self, i)
376 }
377 #[cfg(feature = "full")]
fold_item_fn(&mut self, i: ItemFn) -> ItemFn378 fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn {
379 fold_item_fn(self, i)
380 }
381 #[cfg(feature = "full")]
fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod382 fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod {
383 fold_item_foreign_mod(self, i)
384 }
385 #[cfg(feature = "full")]
fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl386 fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl {
387 fold_item_impl(self, i)
388 }
389 #[cfg(feature = "full")]
fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro390 fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro {
391 fold_item_macro(self, i)
392 }
393 #[cfg(feature = "full")]
fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2394 fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 {
395 fold_item_macro2(self, i)
396 }
397 #[cfg(feature = "full")]
fold_item_mod(&mut self, i: ItemMod) -> ItemMod398 fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod {
399 fold_item_mod(self, i)
400 }
401 #[cfg(feature = "full")]
fold_item_static(&mut self, i: ItemStatic) -> ItemStatic402 fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic {
403 fold_item_static(self, i)
404 }
405 #[cfg(feature = "full")]
fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct406 fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct {
407 fold_item_struct(self, i)
408 }
409 #[cfg(feature = "full")]
fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait410 fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait {
411 fold_item_trait(self, i)
412 }
413 #[cfg(feature = "full")]
fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias414 fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias {
415 fold_item_trait_alias(self, i)
416 }
417 #[cfg(feature = "full")]
fold_item_type(&mut self, i: ItemType) -> ItemType418 fn fold_item_type(&mut self, i: ItemType) -> ItemType {
419 fold_item_type(self, i)
420 }
421 #[cfg(feature = "full")]
fold_item_union(&mut self, i: ItemUnion) -> ItemUnion422 fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion {
423 fold_item_union(self, i)
424 }
425 #[cfg(feature = "full")]
fold_item_use(&mut self, i: ItemUse) -> ItemUse426 fn fold_item_use(&mut self, i: ItemUse) -> ItemUse {
427 fold_item_use(self, i)
428 }
429 #[cfg(feature = "full")]
fold_label(&mut self, i: Label) -> Label430 fn fold_label(&mut self, i: Label) -> Label {
431 fold_label(self, i)
432 }
fold_lifetime(&mut self, i: Lifetime) -> Lifetime433 fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime {
434 fold_lifetime(self, i)
435 }
436 #[cfg(any(feature = "derive", feature = "full"))]
fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef437 fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef {
438 fold_lifetime_def(self, i)
439 }
fold_lit(&mut self, i: Lit) -> Lit440 fn fold_lit(&mut self, i: Lit) -> Lit {
441 fold_lit(self, i)
442 }
fold_lit_bool(&mut self, i: LitBool) -> LitBool443 fn fold_lit_bool(&mut self, i: LitBool) -> LitBool {
444 fold_lit_bool(self, i)
445 }
fold_lit_byte(&mut self, i: LitByte) -> LitByte446 fn fold_lit_byte(&mut self, i: LitByte) -> LitByte {
447 fold_lit_byte(self, i)
448 }
fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr449 fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr {
450 fold_lit_byte_str(self, i)
451 }
fold_lit_char(&mut self, i: LitChar) -> LitChar452 fn fold_lit_char(&mut self, i: LitChar) -> LitChar {
453 fold_lit_char(self, i)
454 }
fold_lit_float(&mut self, i: LitFloat) -> LitFloat455 fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat {
456 fold_lit_float(self, i)
457 }
fold_lit_int(&mut self, i: LitInt) -> LitInt458 fn fold_lit_int(&mut self, i: LitInt) -> LitInt {
459 fold_lit_int(self, i)
460 }
fold_lit_str(&mut self, i: LitStr) -> LitStr461 fn fold_lit_str(&mut self, i: LitStr) -> LitStr {
462 fold_lit_str(self, i)
463 }
464 #[cfg(feature = "full")]
fold_local(&mut self, i: Local) -> Local465 fn fold_local(&mut self, i: Local) -> Local {
466 fold_local(self, i)
467 }
468 #[cfg(any(feature = "derive", feature = "full"))]
fold_macro(&mut self, i: Macro) -> Macro469 fn fold_macro(&mut self, i: Macro) -> Macro {
470 fold_macro(self, i)
471 }
472 #[cfg(any(feature = "derive", feature = "full"))]
fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter473 fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter {
474 fold_macro_delimiter(self, i)
475 }
476 #[cfg(any(feature = "derive", feature = "full"))]
fold_member(&mut self, i: Member) -> Member477 fn fold_member(&mut self, i: Member) -> Member {
478 fold_member(self, i)
479 }
480 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta(&mut self, i: Meta) -> Meta481 fn fold_meta(&mut self, i: Meta) -> Meta {
482 fold_meta(self, i)
483 }
484 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta_list(&mut self, i: MetaList) -> MetaList485 fn fold_meta_list(&mut self, i: MetaList) -> MetaList {
486 fold_meta_list(self, i)
487 }
488 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue489 fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue {
490 fold_meta_name_value(self, i)
491 }
492 #[cfg(feature = "full")]
fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish493 fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish {
494 fold_method_turbofish(self, i)
495 }
496 #[cfg(any(feature = "derive", feature = "full"))]
fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta497 fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta {
498 fold_nested_meta(self, i)
499 }
500 #[cfg(any(feature = "derive", feature = "full"))]
fold_parenthesized_generic_arguments( &mut self, i: ParenthesizedGenericArguments, ) -> ParenthesizedGenericArguments501 fn fold_parenthesized_generic_arguments(
502 &mut self,
503 i: ParenthesizedGenericArguments,
504 ) -> ParenthesizedGenericArguments {
505 fold_parenthesized_generic_arguments(self, i)
506 }
507 #[cfg(feature = "full")]
fold_pat(&mut self, i: Pat) -> Pat508 fn fold_pat(&mut self, i: Pat) -> Pat {
509 fold_pat(self, i)
510 }
511 #[cfg(feature = "full")]
fold_pat_box(&mut self, i: PatBox) -> PatBox512 fn fold_pat_box(&mut self, i: PatBox) -> PatBox {
513 fold_pat_box(self, i)
514 }
515 #[cfg(feature = "full")]
fold_pat_ident(&mut self, i: PatIdent) -> PatIdent516 fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent {
517 fold_pat_ident(self, i)
518 }
519 #[cfg(feature = "full")]
fold_pat_lit(&mut self, i: PatLit) -> PatLit520 fn fold_pat_lit(&mut self, i: PatLit) -> PatLit {
521 fold_pat_lit(self, i)
522 }
523 #[cfg(feature = "full")]
fold_pat_macro(&mut self, i: PatMacro) -> PatMacro524 fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro {
525 fold_pat_macro(self, i)
526 }
527 #[cfg(feature = "full")]
fold_pat_or(&mut self, i: PatOr) -> PatOr528 fn fold_pat_or(&mut self, i: PatOr) -> PatOr {
529 fold_pat_or(self, i)
530 }
531 #[cfg(feature = "full")]
fold_pat_path(&mut self, i: PatPath) -> PatPath532 fn fold_pat_path(&mut self, i: PatPath) -> PatPath {
533 fold_pat_path(self, i)
534 }
535 #[cfg(feature = "full")]
fold_pat_range(&mut self, i: PatRange) -> PatRange536 fn fold_pat_range(&mut self, i: PatRange) -> PatRange {
537 fold_pat_range(self, i)
538 }
539 #[cfg(feature = "full")]
fold_pat_reference(&mut self, i: PatReference) -> PatReference540 fn fold_pat_reference(&mut self, i: PatReference) -> PatReference {
541 fold_pat_reference(self, i)
542 }
543 #[cfg(feature = "full")]
fold_pat_rest(&mut self, i: PatRest) -> PatRest544 fn fold_pat_rest(&mut self, i: PatRest) -> PatRest {
545 fold_pat_rest(self, i)
546 }
547 #[cfg(feature = "full")]
fold_pat_slice(&mut self, i: PatSlice) -> PatSlice548 fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice {
549 fold_pat_slice(self, i)
550 }
551 #[cfg(feature = "full")]
fold_pat_struct(&mut self, i: PatStruct) -> PatStruct552 fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct {
553 fold_pat_struct(self, i)
554 }
555 #[cfg(feature = "full")]
fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple556 fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple {
557 fold_pat_tuple(self, i)
558 }
559 #[cfg(feature = "full")]
fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct560 fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct {
561 fold_pat_tuple_struct(self, i)
562 }
563 #[cfg(feature = "full")]
fold_pat_type(&mut self, i: PatType) -> PatType564 fn fold_pat_type(&mut self, i: PatType) -> PatType {
565 fold_pat_type(self, i)
566 }
567 #[cfg(feature = "full")]
fold_pat_wild(&mut self, i: PatWild) -> PatWild568 fn fold_pat_wild(&mut self, i: PatWild) -> PatWild {
569 fold_pat_wild(self, i)
570 }
571 #[cfg(any(feature = "derive", feature = "full"))]
fold_path(&mut self, i: Path) -> Path572 fn fold_path(&mut self, i: Path) -> Path {
573 fold_path(self, i)
574 }
575 #[cfg(any(feature = "derive", feature = "full"))]
fold_path_arguments(&mut self, i: PathArguments) -> PathArguments576 fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments {
577 fold_path_arguments(self, i)
578 }
579 #[cfg(any(feature = "derive", feature = "full"))]
fold_path_segment(&mut self, i: PathSegment) -> PathSegment580 fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment {
581 fold_path_segment(self, i)
582 }
583 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq584 fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq {
585 fold_predicate_eq(self, i)
586 }
587 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime588 fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime {
589 fold_predicate_lifetime(self, i)
590 }
591 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_type(&mut self, i: PredicateType) -> PredicateType592 fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType {
593 fold_predicate_type(self, i)
594 }
595 #[cfg(any(feature = "derive", feature = "full"))]
fold_qself(&mut self, i: QSelf) -> QSelf596 fn fold_qself(&mut self, i: QSelf) -> QSelf {
597 fold_qself(self, i)
598 }
599 #[cfg(feature = "full")]
fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits600 fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits {
601 fold_range_limits(self, i)
602 }
603 #[cfg(feature = "full")]
fold_receiver(&mut self, i: Receiver) -> Receiver604 fn fold_receiver(&mut self, i: Receiver) -> Receiver {
605 fold_receiver(self, i)
606 }
607 #[cfg(any(feature = "derive", feature = "full"))]
fold_return_type(&mut self, i: ReturnType) -> ReturnType608 fn fold_return_type(&mut self, i: ReturnType) -> ReturnType {
609 fold_return_type(self, i)
610 }
611 #[cfg(feature = "full")]
fold_signature(&mut self, i: Signature) -> Signature612 fn fold_signature(&mut self, i: Signature) -> Signature {
613 fold_signature(self, i)
614 }
fold_span(&mut self, i: Span) -> Span615 fn fold_span(&mut self, i: Span) -> Span {
616 fold_span(self, i)
617 }
618 #[cfg(feature = "full")]
fold_stmt(&mut self, i: Stmt) -> Stmt619 fn fold_stmt(&mut self, i: Stmt) -> Stmt {
620 fold_stmt(self, i)
621 }
622 #[cfg(any(feature = "derive", feature = "full"))]
fold_trait_bound(&mut self, i: TraitBound) -> TraitBound623 fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound {
624 fold_trait_bound(self, i)
625 }
626 #[cfg(any(feature = "derive", feature = "full"))]
fold_trait_bound_modifier( &mut self, i: TraitBoundModifier, ) -> TraitBoundModifier627 fn fold_trait_bound_modifier(
628 &mut self,
629 i: TraitBoundModifier,
630 ) -> TraitBoundModifier {
631 fold_trait_bound_modifier(self, i)
632 }
633 #[cfg(feature = "full")]
fold_trait_item(&mut self, i: TraitItem) -> TraitItem634 fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem {
635 fold_trait_item(self, i)
636 }
637 #[cfg(feature = "full")]
fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst638 fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst {
639 fold_trait_item_const(self, i)
640 }
641 #[cfg(feature = "full")]
fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro642 fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro {
643 fold_trait_item_macro(self, i)
644 }
645 #[cfg(feature = "full")]
fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod646 fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod {
647 fold_trait_item_method(self, i)
648 }
649 #[cfg(feature = "full")]
fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType650 fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType {
651 fold_trait_item_type(self, i)
652 }
653 #[cfg(any(feature = "derive", feature = "full"))]
fold_type(&mut self, i: Type) -> Type654 fn fold_type(&mut self, i: Type) -> Type {
655 fold_type(self, i)
656 }
657 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_array(&mut self, i: TypeArray) -> TypeArray658 fn fold_type_array(&mut self, i: TypeArray) -> TypeArray {
659 fold_type_array(self, i)
660 }
661 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn662 fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn {
663 fold_type_bare_fn(self, i)
664 }
665 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_group(&mut self, i: TypeGroup) -> TypeGroup666 fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup {
667 fold_type_group(self, i)
668 }
669 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait670 fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait {
671 fold_type_impl_trait(self, i)
672 }
673 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer674 fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer {
675 fold_type_infer(self, i)
676 }
677 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro678 fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro {
679 fold_type_macro(self, i)
680 }
681 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_never(&mut self, i: TypeNever) -> TypeNever682 fn fold_type_never(&mut self, i: TypeNever) -> TypeNever {
683 fold_type_never(self, i)
684 }
685 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_param(&mut self, i: TypeParam) -> TypeParam686 fn fold_type_param(&mut self, i: TypeParam) -> TypeParam {
687 fold_type_param(self, i)
688 }
689 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound690 fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound {
691 fold_type_param_bound(self, i)
692 }
693 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_paren(&mut self, i: TypeParen) -> TypeParen694 fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen {
695 fold_type_paren(self, i)
696 }
697 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_path(&mut self, i: TypePath) -> TypePath698 fn fold_type_path(&mut self, i: TypePath) -> TypePath {
699 fold_type_path(self, i)
700 }
701 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_ptr(&mut self, i: TypePtr) -> TypePtr702 fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr {
703 fold_type_ptr(self, i)
704 }
705 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_reference(&mut self, i: TypeReference) -> TypeReference706 fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference {
707 fold_type_reference(self, i)
708 }
709 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice710 fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice {
711 fold_type_slice(self, i)
712 }
713 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject714 fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject {
715 fold_type_trait_object(self, i)
716 }
717 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple718 fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple {
719 fold_type_tuple(self, i)
720 }
721 #[cfg(any(feature = "derive", feature = "full"))]
fold_un_op(&mut self, i: UnOp) -> UnOp722 fn fold_un_op(&mut self, i: UnOp) -> UnOp {
723 fold_un_op(self, i)
724 }
725 #[cfg(feature = "full")]
fold_use_glob(&mut self, i: UseGlob) -> UseGlob726 fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob {
727 fold_use_glob(self, i)
728 }
729 #[cfg(feature = "full")]
fold_use_group(&mut self, i: UseGroup) -> UseGroup730 fn fold_use_group(&mut self, i: UseGroup) -> UseGroup {
731 fold_use_group(self, i)
732 }
733 #[cfg(feature = "full")]
fold_use_name(&mut self, i: UseName) -> UseName734 fn fold_use_name(&mut self, i: UseName) -> UseName {
735 fold_use_name(self, i)
736 }
737 #[cfg(feature = "full")]
fold_use_path(&mut self, i: UsePath) -> UsePath738 fn fold_use_path(&mut self, i: UsePath) -> UsePath {
739 fold_use_path(self, i)
740 }
741 #[cfg(feature = "full")]
fold_use_rename(&mut self, i: UseRename) -> UseRename742 fn fold_use_rename(&mut self, i: UseRename) -> UseRename {
743 fold_use_rename(self, i)
744 }
745 #[cfg(feature = "full")]
fold_use_tree(&mut self, i: UseTree) -> UseTree746 fn fold_use_tree(&mut self, i: UseTree) -> UseTree {
747 fold_use_tree(self, i)
748 }
749 #[cfg(any(feature = "derive", feature = "full"))]
fold_variadic(&mut self, i: Variadic) -> Variadic750 fn fold_variadic(&mut self, i: Variadic) -> Variadic {
751 fold_variadic(self, i)
752 }
753 #[cfg(any(feature = "derive", feature = "full"))]
fold_variant(&mut self, i: Variant) -> Variant754 fn fold_variant(&mut self, i: Variant) -> Variant {
755 fold_variant(self, i)
756 }
757 #[cfg(any(feature = "derive", feature = "full"))]
fold_vis_crate(&mut self, i: VisCrate) -> VisCrate758 fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate {
759 fold_vis_crate(self, i)
760 }
761 #[cfg(any(feature = "derive", feature = "full"))]
fold_vis_public(&mut self, i: VisPublic) -> VisPublic762 fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic {
763 fold_vis_public(self, i)
764 }
765 #[cfg(any(feature = "derive", feature = "full"))]
fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted766 fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted {
767 fold_vis_restricted(self, i)
768 }
769 #[cfg(any(feature = "derive", feature = "full"))]
fold_visibility(&mut self, i: Visibility) -> Visibility770 fn fold_visibility(&mut self, i: Visibility) -> Visibility {
771 fold_visibility(self, i)
772 }
773 #[cfg(any(feature = "derive", feature = "full"))]
fold_where_clause(&mut self, i: WhereClause) -> WhereClause774 fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause {
775 fold_where_clause(self, i)
776 }
777 #[cfg(any(feature = "derive", feature = "full"))]
fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate778 fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate {
779 fold_where_predicate(self, i)
780 }
781 }
782 #[cfg(any(feature = "derive", feature = "full"))]
fold_abi<F>(f: &mut F, node: Abi) -> Abi where F: Fold + ?Sized,783 pub fn fold_abi<F>(f: &mut F, node: Abi) -> Abi
784 where
785 F: Fold + ?Sized,
786 {
787 Abi {
788 extern_token: Token![extern](tokens_helper(f, &node.extern_token.span)),
789 name: (node.name).map(|it| f.fold_lit_str(it)),
790 }
791 }
792 #[cfg(any(feature = "derive", feature = "full"))]
fold_angle_bracketed_generic_arguments<F>( f: &mut F, node: AngleBracketedGenericArguments, ) -> AngleBracketedGenericArguments where F: Fold + ?Sized,793 pub fn fold_angle_bracketed_generic_arguments<F>(
794 f: &mut F,
795 node: AngleBracketedGenericArguments,
796 ) -> AngleBracketedGenericArguments
797 where
798 F: Fold + ?Sized,
799 {
800 AngleBracketedGenericArguments {
801 colon2_token: (node.colon2_token)
802 .map(|it| Token![::](tokens_helper(f, &it.spans))),
803 lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)),
804 args: FoldHelper::lift(node.args, |it| f.fold_generic_argument(it)),
805 gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)),
806 }
807 }
808 #[cfg(feature = "full")]
fold_arm<F>(f: &mut F, node: Arm) -> Arm where F: Fold + ?Sized,809 pub fn fold_arm<F>(f: &mut F, node: Arm) -> Arm
810 where
811 F: Fold + ?Sized,
812 {
813 Arm {
814 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
815 pat: f.fold_pat(node.pat),
816 guard: (node.guard)
817 .map(|it| (
818 Token![if](tokens_helper(f, &(it).0.span)),
819 Box::new(f.fold_expr(*(it).1)),
820 )),
821 fat_arrow_token: Token![=>](tokens_helper(f, &node.fat_arrow_token.spans)),
822 body: Box::new(f.fold_expr(*node.body)),
823 comma: (node.comma).map(|it| Token![,](tokens_helper(f, &it.spans))),
824 }
825 }
826 #[cfg(any(feature = "derive", feature = "full"))]
fold_attr_style<F>(f: &mut F, node: AttrStyle) -> AttrStyle where F: Fold + ?Sized,827 pub fn fold_attr_style<F>(f: &mut F, node: AttrStyle) -> AttrStyle
828 where
829 F: Fold + ?Sized,
830 {
831 match node {
832 AttrStyle::Outer => AttrStyle::Outer,
833 AttrStyle::Inner(_binding_0) => {
834 AttrStyle::Inner(Token![!](tokens_helper(f, &_binding_0.spans)))
835 }
836 }
837 }
838 #[cfg(any(feature = "derive", feature = "full"))]
fold_attribute<F>(f: &mut F, node: Attribute) -> Attribute where F: Fold + ?Sized,839 pub fn fold_attribute<F>(f: &mut F, node: Attribute) -> Attribute
840 where
841 F: Fold + ?Sized,
842 {
843 Attribute {
844 pound_token: Token![#](tokens_helper(f, &node.pound_token.spans)),
845 style: f.fold_attr_style(node.style),
846 bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
847 path: f.fold_path(node.path),
848 tokens: node.tokens,
849 }
850 }
851 #[cfg(any(feature = "derive", feature = "full"))]
fold_bare_fn_arg<F>(f: &mut F, node: BareFnArg) -> BareFnArg where F: Fold + ?Sized,852 pub fn fold_bare_fn_arg<F>(f: &mut F, node: BareFnArg) -> BareFnArg
853 where
854 F: Fold + ?Sized,
855 {
856 BareFnArg {
857 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
858 name: (node.name)
859 .map(|it| (
860 f.fold_ident((it).0),
861 Token![:](tokens_helper(f, &(it).1.spans)),
862 )),
863 ty: f.fold_type(node.ty),
864 }
865 }
866 #[cfg(any(feature = "derive", feature = "full"))]
fold_bin_op<F>(f: &mut F, node: BinOp) -> BinOp where F: Fold + ?Sized,867 pub fn fold_bin_op<F>(f: &mut F, node: BinOp) -> BinOp
868 where
869 F: Fold + ?Sized,
870 {
871 match node {
872 BinOp::Add(_binding_0) => {
873 BinOp::Add(Token![+](tokens_helper(f, &_binding_0.spans)))
874 }
875 BinOp::Sub(_binding_0) => {
876 BinOp::Sub(Token![-](tokens_helper(f, &_binding_0.spans)))
877 }
878 BinOp::Mul(_binding_0) => {
879 BinOp::Mul(Token![*](tokens_helper(f, &_binding_0.spans)))
880 }
881 BinOp::Div(_binding_0) => {
882 BinOp::Div(Token![/](tokens_helper(f, &_binding_0.spans)))
883 }
884 BinOp::Rem(_binding_0) => {
885 BinOp::Rem(Token![%](tokens_helper(f, &_binding_0.spans)))
886 }
887 BinOp::And(_binding_0) => {
888 BinOp::And(Token![&&](tokens_helper(f, &_binding_0.spans)))
889 }
890 BinOp::Or(_binding_0) => {
891 BinOp::Or(Token![||](tokens_helper(f, &_binding_0.spans)))
892 }
893 BinOp::BitXor(_binding_0) => {
894 BinOp::BitXor(Token![^](tokens_helper(f, &_binding_0.spans)))
895 }
896 BinOp::BitAnd(_binding_0) => {
897 BinOp::BitAnd(Token![&](tokens_helper(f, &_binding_0.spans)))
898 }
899 BinOp::BitOr(_binding_0) => {
900 BinOp::BitOr(Token![|](tokens_helper(f, &_binding_0.spans)))
901 }
902 BinOp::Shl(_binding_0) => {
903 BinOp::Shl(Token![<<](tokens_helper(f, &_binding_0.spans)))
904 }
905 BinOp::Shr(_binding_0) => {
906 BinOp::Shr(Token![>>](tokens_helper(f, &_binding_0.spans)))
907 }
908 BinOp::Eq(_binding_0) => {
909 BinOp::Eq(Token![==](tokens_helper(f, &_binding_0.spans)))
910 }
911 BinOp::Lt(_binding_0) => {
912 BinOp::Lt(Token![<](tokens_helper(f, &_binding_0.spans)))
913 }
914 BinOp::Le(_binding_0) => {
915 BinOp::Le(Token![<=](tokens_helper(f, &_binding_0.spans)))
916 }
917 BinOp::Ne(_binding_0) => {
918 BinOp::Ne(Token![!=](tokens_helper(f, &_binding_0.spans)))
919 }
920 BinOp::Ge(_binding_0) => {
921 BinOp::Ge(Token![>=](tokens_helper(f, &_binding_0.spans)))
922 }
923 BinOp::Gt(_binding_0) => {
924 BinOp::Gt(Token![>](tokens_helper(f, &_binding_0.spans)))
925 }
926 BinOp::AddEq(_binding_0) => {
927 BinOp::AddEq(Token![+=](tokens_helper(f, &_binding_0.spans)))
928 }
929 BinOp::SubEq(_binding_0) => {
930 BinOp::SubEq(Token![-=](tokens_helper(f, &_binding_0.spans)))
931 }
932 BinOp::MulEq(_binding_0) => {
933 BinOp::MulEq(Token![*=](tokens_helper(f, &_binding_0.spans)))
934 }
935 BinOp::DivEq(_binding_0) => {
936 BinOp::DivEq(Token![/=](tokens_helper(f, &_binding_0.spans)))
937 }
938 BinOp::RemEq(_binding_0) => {
939 BinOp::RemEq(Token![%=](tokens_helper(f, &_binding_0.spans)))
940 }
941 BinOp::BitXorEq(_binding_0) => {
942 BinOp::BitXorEq(Token![^=](tokens_helper(f, &_binding_0.spans)))
943 }
944 BinOp::BitAndEq(_binding_0) => {
945 BinOp::BitAndEq(Token![&=](tokens_helper(f, &_binding_0.spans)))
946 }
947 BinOp::BitOrEq(_binding_0) => {
948 BinOp::BitOrEq(Token![|=](tokens_helper(f, &_binding_0.spans)))
949 }
950 BinOp::ShlEq(_binding_0) => {
951 BinOp::ShlEq(Token![<<=](tokens_helper(f, &_binding_0.spans)))
952 }
953 BinOp::ShrEq(_binding_0) => {
954 BinOp::ShrEq(Token![>>=](tokens_helper(f, &_binding_0.spans)))
955 }
956 }
957 }
958 #[cfg(any(feature = "derive", feature = "full"))]
fold_binding<F>(f: &mut F, node: Binding) -> Binding where F: Fold + ?Sized,959 pub fn fold_binding<F>(f: &mut F, node: Binding) -> Binding
960 where
961 F: Fold + ?Sized,
962 {
963 Binding {
964 ident: f.fold_ident(node.ident),
965 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
966 ty: f.fold_type(node.ty),
967 }
968 }
969 #[cfg(feature = "full")]
fold_block<F>(f: &mut F, node: Block) -> Block where F: Fold + ?Sized,970 pub fn fold_block<F>(f: &mut F, node: Block) -> Block
971 where
972 F: Fold + ?Sized,
973 {
974 Block {
975 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
976 stmts: FoldHelper::lift(node.stmts, |it| f.fold_stmt(it)),
977 }
978 }
979 #[cfg(any(feature = "derive", feature = "full"))]
fold_bound_lifetimes<F>(f: &mut F, node: BoundLifetimes) -> BoundLifetimes where F: Fold + ?Sized,980 pub fn fold_bound_lifetimes<F>(f: &mut F, node: BoundLifetimes) -> BoundLifetimes
981 where
982 F: Fold + ?Sized,
983 {
984 BoundLifetimes {
985 for_token: Token![for](tokens_helper(f, &node.for_token.span)),
986 lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)),
987 lifetimes: FoldHelper::lift(node.lifetimes, |it| f.fold_lifetime_def(it)),
988 gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)),
989 }
990 }
991 #[cfg(any(feature = "derive", feature = "full"))]
fold_const_param<F>(f: &mut F, node: ConstParam) -> ConstParam where F: Fold + ?Sized,992 pub fn fold_const_param<F>(f: &mut F, node: ConstParam) -> ConstParam
993 where
994 F: Fold + ?Sized,
995 {
996 ConstParam {
997 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
998 const_token: Token![const](tokens_helper(f, &node.const_token.span)),
999 ident: f.fold_ident(node.ident),
1000 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
1001 ty: f.fold_type(node.ty),
1002 eq_token: (node.eq_token).map(|it| Token![=](tokens_helper(f, &it.spans))),
1003 default: (node.default).map(|it| f.fold_expr(it)),
1004 }
1005 }
1006 #[cfg(any(feature = "derive", feature = "full"))]
fold_constraint<F>(f: &mut F, node: Constraint) -> Constraint where F: Fold + ?Sized,1007 pub fn fold_constraint<F>(f: &mut F, node: Constraint) -> Constraint
1008 where
1009 F: Fold + ?Sized,
1010 {
1011 Constraint {
1012 ident: f.fold_ident(node.ident),
1013 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
1014 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
1015 }
1016 }
1017 #[cfg(feature = "derive")]
fold_data<F>(f: &mut F, node: Data) -> Data where F: Fold + ?Sized,1018 pub fn fold_data<F>(f: &mut F, node: Data) -> Data
1019 where
1020 F: Fold + ?Sized,
1021 {
1022 match node {
1023 Data::Struct(_binding_0) => Data::Struct(f.fold_data_struct(_binding_0)),
1024 Data::Enum(_binding_0) => Data::Enum(f.fold_data_enum(_binding_0)),
1025 Data::Union(_binding_0) => Data::Union(f.fold_data_union(_binding_0)),
1026 }
1027 }
1028 #[cfg(feature = "derive")]
fold_data_enum<F>(f: &mut F, node: DataEnum) -> DataEnum where F: Fold + ?Sized,1029 pub fn fold_data_enum<F>(f: &mut F, node: DataEnum) -> DataEnum
1030 where
1031 F: Fold + ?Sized,
1032 {
1033 DataEnum {
1034 enum_token: Token![enum](tokens_helper(f, &node.enum_token.span)),
1035 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
1036 variants: FoldHelper::lift(node.variants, |it| f.fold_variant(it)),
1037 }
1038 }
1039 #[cfg(feature = "derive")]
fold_data_struct<F>(f: &mut F, node: DataStruct) -> DataStruct where F: Fold + ?Sized,1040 pub fn fold_data_struct<F>(f: &mut F, node: DataStruct) -> DataStruct
1041 where
1042 F: Fold + ?Sized,
1043 {
1044 DataStruct {
1045 struct_token: Token![struct](tokens_helper(f, &node.struct_token.span)),
1046 fields: f.fold_fields(node.fields),
1047 semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
1048 }
1049 }
1050 #[cfg(feature = "derive")]
fold_data_union<F>(f: &mut F, node: DataUnion) -> DataUnion where F: Fold + ?Sized,1051 pub fn fold_data_union<F>(f: &mut F, node: DataUnion) -> DataUnion
1052 where
1053 F: Fold + ?Sized,
1054 {
1055 DataUnion {
1056 union_token: Token![union](tokens_helper(f, &node.union_token.span)),
1057 fields: f.fold_fields_named(node.fields),
1058 }
1059 }
1060 #[cfg(feature = "derive")]
fold_derive_input<F>(f: &mut F, node: DeriveInput) -> DeriveInput where F: Fold + ?Sized,1061 pub fn fold_derive_input<F>(f: &mut F, node: DeriveInput) -> DeriveInput
1062 where
1063 F: Fold + ?Sized,
1064 {
1065 DeriveInput {
1066 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1067 vis: f.fold_visibility(node.vis),
1068 ident: f.fold_ident(node.ident),
1069 generics: f.fold_generics(node.generics),
1070 data: f.fold_data(node.data),
1071 }
1072 }
1073 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr<F>(f: &mut F, node: Expr) -> Expr where F: Fold + ?Sized,1074 pub fn fold_expr<F>(f: &mut F, node: Expr) -> Expr
1075 where
1076 F: Fold + ?Sized,
1077 {
1078 match node {
1079 Expr::Array(_binding_0) => Expr::Array(full!(f.fold_expr_array(_binding_0))),
1080 Expr::Assign(_binding_0) => Expr::Assign(full!(f.fold_expr_assign(_binding_0))),
1081 Expr::AssignOp(_binding_0) => {
1082 Expr::AssignOp(full!(f.fold_expr_assign_op(_binding_0)))
1083 }
1084 Expr::Async(_binding_0) => Expr::Async(full!(f.fold_expr_async(_binding_0))),
1085 Expr::Await(_binding_0) => Expr::Await(full!(f.fold_expr_await(_binding_0))),
1086 Expr::Binary(_binding_0) => Expr::Binary(f.fold_expr_binary(_binding_0)),
1087 Expr::Block(_binding_0) => Expr::Block(full!(f.fold_expr_block(_binding_0))),
1088 Expr::Box(_binding_0) => Expr::Box(full!(f.fold_expr_box(_binding_0))),
1089 Expr::Break(_binding_0) => Expr::Break(full!(f.fold_expr_break(_binding_0))),
1090 Expr::Call(_binding_0) => Expr::Call(f.fold_expr_call(_binding_0)),
1091 Expr::Cast(_binding_0) => Expr::Cast(f.fold_expr_cast(_binding_0)),
1092 Expr::Closure(_binding_0) => {
1093 Expr::Closure(full!(f.fold_expr_closure(_binding_0)))
1094 }
1095 Expr::Continue(_binding_0) => {
1096 Expr::Continue(full!(f.fold_expr_continue(_binding_0)))
1097 }
1098 Expr::Field(_binding_0) => Expr::Field(f.fold_expr_field(_binding_0)),
1099 Expr::ForLoop(_binding_0) => {
1100 Expr::ForLoop(full!(f.fold_expr_for_loop(_binding_0)))
1101 }
1102 Expr::Group(_binding_0) => Expr::Group(full!(f.fold_expr_group(_binding_0))),
1103 Expr::If(_binding_0) => Expr::If(full!(f.fold_expr_if(_binding_0))),
1104 Expr::Index(_binding_0) => Expr::Index(f.fold_expr_index(_binding_0)),
1105 Expr::Let(_binding_0) => Expr::Let(full!(f.fold_expr_let(_binding_0))),
1106 Expr::Lit(_binding_0) => Expr::Lit(f.fold_expr_lit(_binding_0)),
1107 Expr::Loop(_binding_0) => Expr::Loop(full!(f.fold_expr_loop(_binding_0))),
1108 Expr::Macro(_binding_0) => Expr::Macro(full!(f.fold_expr_macro(_binding_0))),
1109 Expr::Match(_binding_0) => Expr::Match(full!(f.fold_expr_match(_binding_0))),
1110 Expr::MethodCall(_binding_0) => {
1111 Expr::MethodCall(full!(f.fold_expr_method_call(_binding_0)))
1112 }
1113 Expr::Paren(_binding_0) => Expr::Paren(f.fold_expr_paren(_binding_0)),
1114 Expr::Path(_binding_0) => Expr::Path(f.fold_expr_path(_binding_0)),
1115 Expr::Range(_binding_0) => Expr::Range(full!(f.fold_expr_range(_binding_0))),
1116 Expr::Reference(_binding_0) => {
1117 Expr::Reference(full!(f.fold_expr_reference(_binding_0)))
1118 }
1119 Expr::Repeat(_binding_0) => Expr::Repeat(full!(f.fold_expr_repeat(_binding_0))),
1120 Expr::Return(_binding_0) => Expr::Return(full!(f.fold_expr_return(_binding_0))),
1121 Expr::Struct(_binding_0) => Expr::Struct(full!(f.fold_expr_struct(_binding_0))),
1122 Expr::Try(_binding_0) => Expr::Try(full!(f.fold_expr_try(_binding_0))),
1123 Expr::TryBlock(_binding_0) => {
1124 Expr::TryBlock(full!(f.fold_expr_try_block(_binding_0)))
1125 }
1126 Expr::Tuple(_binding_0) => Expr::Tuple(full!(f.fold_expr_tuple(_binding_0))),
1127 Expr::Type(_binding_0) => Expr::Type(full!(f.fold_expr_type(_binding_0))),
1128 Expr::Unary(_binding_0) => Expr::Unary(f.fold_expr_unary(_binding_0)),
1129 Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(f.fold_expr_unsafe(_binding_0))),
1130 Expr::Verbatim(_binding_0) => Expr::Verbatim(_binding_0),
1131 Expr::While(_binding_0) => Expr::While(full!(f.fold_expr_while(_binding_0))),
1132 Expr::Yield(_binding_0) => Expr::Yield(full!(f.fold_expr_yield(_binding_0))),
1133 #[cfg(syn_no_non_exhaustive)]
1134 _ => unreachable!(),
1135 }
1136 }
1137 #[cfg(feature = "full")]
fold_expr_array<F>(f: &mut F, node: ExprArray) -> ExprArray where F: Fold + ?Sized,1138 pub fn fold_expr_array<F>(f: &mut F, node: ExprArray) -> ExprArray
1139 where
1140 F: Fold + ?Sized,
1141 {
1142 ExprArray {
1143 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1144 bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
1145 elems: FoldHelper::lift(node.elems, |it| f.fold_expr(it)),
1146 }
1147 }
1148 #[cfg(feature = "full")]
fold_expr_assign<F>(f: &mut F, node: ExprAssign) -> ExprAssign where F: Fold + ?Sized,1149 pub fn fold_expr_assign<F>(f: &mut F, node: ExprAssign) -> ExprAssign
1150 where
1151 F: Fold + ?Sized,
1152 {
1153 ExprAssign {
1154 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1155 left: Box::new(f.fold_expr(*node.left)),
1156 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
1157 right: Box::new(f.fold_expr(*node.right)),
1158 }
1159 }
1160 #[cfg(feature = "full")]
fold_expr_assign_op<F>(f: &mut F, node: ExprAssignOp) -> ExprAssignOp where F: Fold + ?Sized,1161 pub fn fold_expr_assign_op<F>(f: &mut F, node: ExprAssignOp) -> ExprAssignOp
1162 where
1163 F: Fold + ?Sized,
1164 {
1165 ExprAssignOp {
1166 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1167 left: Box::new(f.fold_expr(*node.left)),
1168 op: f.fold_bin_op(node.op),
1169 right: Box::new(f.fold_expr(*node.right)),
1170 }
1171 }
1172 #[cfg(feature = "full")]
fold_expr_async<F>(f: &mut F, node: ExprAsync) -> ExprAsync where F: Fold + ?Sized,1173 pub fn fold_expr_async<F>(f: &mut F, node: ExprAsync) -> ExprAsync
1174 where
1175 F: Fold + ?Sized,
1176 {
1177 ExprAsync {
1178 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1179 async_token: Token![async](tokens_helper(f, &node.async_token.span)),
1180 capture: (node.capture).map(|it| Token![move](tokens_helper(f, &it.span))),
1181 block: f.fold_block(node.block),
1182 }
1183 }
1184 #[cfg(feature = "full")]
fold_expr_await<F>(f: &mut F, node: ExprAwait) -> ExprAwait where F: Fold + ?Sized,1185 pub fn fold_expr_await<F>(f: &mut F, node: ExprAwait) -> ExprAwait
1186 where
1187 F: Fold + ?Sized,
1188 {
1189 ExprAwait {
1190 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1191 base: Box::new(f.fold_expr(*node.base)),
1192 dot_token: Token![.](tokens_helper(f, &node.dot_token.spans)),
1193 await_token: crate::token::Await(tokens_helper(f, &node.await_token.span)),
1194 }
1195 }
1196 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_binary<F>(f: &mut F, node: ExprBinary) -> ExprBinary where F: Fold + ?Sized,1197 pub fn fold_expr_binary<F>(f: &mut F, node: ExprBinary) -> ExprBinary
1198 where
1199 F: Fold + ?Sized,
1200 {
1201 ExprBinary {
1202 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1203 left: Box::new(f.fold_expr(*node.left)),
1204 op: f.fold_bin_op(node.op),
1205 right: Box::new(f.fold_expr(*node.right)),
1206 }
1207 }
1208 #[cfg(feature = "full")]
fold_expr_block<F>(f: &mut F, node: ExprBlock) -> ExprBlock where F: Fold + ?Sized,1209 pub fn fold_expr_block<F>(f: &mut F, node: ExprBlock) -> ExprBlock
1210 where
1211 F: Fold + ?Sized,
1212 {
1213 ExprBlock {
1214 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1215 label: (node.label).map(|it| f.fold_label(it)),
1216 block: f.fold_block(node.block),
1217 }
1218 }
1219 #[cfg(feature = "full")]
fold_expr_box<F>(f: &mut F, node: ExprBox) -> ExprBox where F: Fold + ?Sized,1220 pub fn fold_expr_box<F>(f: &mut F, node: ExprBox) -> ExprBox
1221 where
1222 F: Fold + ?Sized,
1223 {
1224 ExprBox {
1225 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1226 box_token: Token![box](tokens_helper(f, &node.box_token.span)),
1227 expr: Box::new(f.fold_expr(*node.expr)),
1228 }
1229 }
1230 #[cfg(feature = "full")]
fold_expr_break<F>(f: &mut F, node: ExprBreak) -> ExprBreak where F: Fold + ?Sized,1231 pub fn fold_expr_break<F>(f: &mut F, node: ExprBreak) -> ExprBreak
1232 where
1233 F: Fold + ?Sized,
1234 {
1235 ExprBreak {
1236 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1237 break_token: Token![break](tokens_helper(f, &node.break_token.span)),
1238 label: (node.label).map(|it| f.fold_lifetime(it)),
1239 expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))),
1240 }
1241 }
1242 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_call<F>(f: &mut F, node: ExprCall) -> ExprCall where F: Fold + ?Sized,1243 pub fn fold_expr_call<F>(f: &mut F, node: ExprCall) -> ExprCall
1244 where
1245 F: Fold + ?Sized,
1246 {
1247 ExprCall {
1248 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1249 func: Box::new(f.fold_expr(*node.func)),
1250 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
1251 args: FoldHelper::lift(node.args, |it| f.fold_expr(it)),
1252 }
1253 }
1254 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_cast<F>(f: &mut F, node: ExprCast) -> ExprCast where F: Fold + ?Sized,1255 pub fn fold_expr_cast<F>(f: &mut F, node: ExprCast) -> ExprCast
1256 where
1257 F: Fold + ?Sized,
1258 {
1259 ExprCast {
1260 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1261 expr: Box::new(f.fold_expr(*node.expr)),
1262 as_token: Token![as](tokens_helper(f, &node.as_token.span)),
1263 ty: Box::new(f.fold_type(*node.ty)),
1264 }
1265 }
1266 #[cfg(feature = "full")]
fold_expr_closure<F>(f: &mut F, node: ExprClosure) -> ExprClosure where F: Fold + ?Sized,1267 pub fn fold_expr_closure<F>(f: &mut F, node: ExprClosure) -> ExprClosure
1268 where
1269 F: Fold + ?Sized,
1270 {
1271 ExprClosure {
1272 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1273 movability: (node.movability)
1274 .map(|it| Token![static](tokens_helper(f, &it.span))),
1275 asyncness: (node.asyncness).map(|it| Token![async](tokens_helper(f, &it.span))),
1276 capture: (node.capture).map(|it| Token![move](tokens_helper(f, &it.span))),
1277 or1_token: Token![|](tokens_helper(f, &node.or1_token.spans)),
1278 inputs: FoldHelper::lift(node.inputs, |it| f.fold_pat(it)),
1279 or2_token: Token![|](tokens_helper(f, &node.or2_token.spans)),
1280 output: f.fold_return_type(node.output),
1281 body: Box::new(f.fold_expr(*node.body)),
1282 }
1283 }
1284 #[cfg(feature = "full")]
fold_expr_continue<F>(f: &mut F, node: ExprContinue) -> ExprContinue where F: Fold + ?Sized,1285 pub fn fold_expr_continue<F>(f: &mut F, node: ExprContinue) -> ExprContinue
1286 where
1287 F: Fold + ?Sized,
1288 {
1289 ExprContinue {
1290 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1291 continue_token: Token![continue](tokens_helper(f, &node.continue_token.span)),
1292 label: (node.label).map(|it| f.fold_lifetime(it)),
1293 }
1294 }
1295 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_field<F>(f: &mut F, node: ExprField) -> ExprField where F: Fold + ?Sized,1296 pub fn fold_expr_field<F>(f: &mut F, node: ExprField) -> ExprField
1297 where
1298 F: Fold + ?Sized,
1299 {
1300 ExprField {
1301 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1302 base: Box::new(f.fold_expr(*node.base)),
1303 dot_token: Token![.](tokens_helper(f, &node.dot_token.spans)),
1304 member: f.fold_member(node.member),
1305 }
1306 }
1307 #[cfg(feature = "full")]
fold_expr_for_loop<F>(f: &mut F, node: ExprForLoop) -> ExprForLoop where F: Fold + ?Sized,1308 pub fn fold_expr_for_loop<F>(f: &mut F, node: ExprForLoop) -> ExprForLoop
1309 where
1310 F: Fold + ?Sized,
1311 {
1312 ExprForLoop {
1313 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1314 label: (node.label).map(|it| f.fold_label(it)),
1315 for_token: Token![for](tokens_helper(f, &node.for_token.span)),
1316 pat: f.fold_pat(node.pat),
1317 in_token: Token![in](tokens_helper(f, &node.in_token.span)),
1318 expr: Box::new(f.fold_expr(*node.expr)),
1319 body: f.fold_block(node.body),
1320 }
1321 }
1322 #[cfg(feature = "full")]
fold_expr_group<F>(f: &mut F, node: ExprGroup) -> ExprGroup where F: Fold + ?Sized,1323 pub fn fold_expr_group<F>(f: &mut F, node: ExprGroup) -> ExprGroup
1324 where
1325 F: Fold + ?Sized,
1326 {
1327 ExprGroup {
1328 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1329 group_token: Group(tokens_helper(f, &node.group_token.span)),
1330 expr: Box::new(f.fold_expr(*node.expr)),
1331 }
1332 }
1333 #[cfg(feature = "full")]
fold_expr_if<F>(f: &mut F, node: ExprIf) -> ExprIf where F: Fold + ?Sized,1334 pub fn fold_expr_if<F>(f: &mut F, node: ExprIf) -> ExprIf
1335 where
1336 F: Fold + ?Sized,
1337 {
1338 ExprIf {
1339 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1340 if_token: Token![if](tokens_helper(f, &node.if_token.span)),
1341 cond: Box::new(f.fold_expr(*node.cond)),
1342 then_branch: f.fold_block(node.then_branch),
1343 else_branch: (node.else_branch)
1344 .map(|it| (
1345 Token![else](tokens_helper(f, &(it).0.span)),
1346 Box::new(f.fold_expr(*(it).1)),
1347 )),
1348 }
1349 }
1350 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_index<F>(f: &mut F, node: ExprIndex) -> ExprIndex where F: Fold + ?Sized,1351 pub fn fold_expr_index<F>(f: &mut F, node: ExprIndex) -> ExprIndex
1352 where
1353 F: Fold + ?Sized,
1354 {
1355 ExprIndex {
1356 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1357 expr: Box::new(f.fold_expr(*node.expr)),
1358 bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
1359 index: Box::new(f.fold_expr(*node.index)),
1360 }
1361 }
1362 #[cfg(feature = "full")]
fold_expr_let<F>(f: &mut F, node: ExprLet) -> ExprLet where F: Fold + ?Sized,1363 pub fn fold_expr_let<F>(f: &mut F, node: ExprLet) -> ExprLet
1364 where
1365 F: Fold + ?Sized,
1366 {
1367 ExprLet {
1368 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1369 let_token: Token![let](tokens_helper(f, &node.let_token.span)),
1370 pat: f.fold_pat(node.pat),
1371 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
1372 expr: Box::new(f.fold_expr(*node.expr)),
1373 }
1374 }
1375 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_lit<F>(f: &mut F, node: ExprLit) -> ExprLit where F: Fold + ?Sized,1376 pub fn fold_expr_lit<F>(f: &mut F, node: ExprLit) -> ExprLit
1377 where
1378 F: Fold + ?Sized,
1379 {
1380 ExprLit {
1381 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1382 lit: f.fold_lit(node.lit),
1383 }
1384 }
1385 #[cfg(feature = "full")]
fold_expr_loop<F>(f: &mut F, node: ExprLoop) -> ExprLoop where F: Fold + ?Sized,1386 pub fn fold_expr_loop<F>(f: &mut F, node: ExprLoop) -> ExprLoop
1387 where
1388 F: Fold + ?Sized,
1389 {
1390 ExprLoop {
1391 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1392 label: (node.label).map(|it| f.fold_label(it)),
1393 loop_token: Token![loop](tokens_helper(f, &node.loop_token.span)),
1394 body: f.fold_block(node.body),
1395 }
1396 }
1397 #[cfg(feature = "full")]
fold_expr_macro<F>(f: &mut F, node: ExprMacro) -> ExprMacro where F: Fold + ?Sized,1398 pub fn fold_expr_macro<F>(f: &mut F, node: ExprMacro) -> ExprMacro
1399 where
1400 F: Fold + ?Sized,
1401 {
1402 ExprMacro {
1403 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1404 mac: f.fold_macro(node.mac),
1405 }
1406 }
1407 #[cfg(feature = "full")]
fold_expr_match<F>(f: &mut F, node: ExprMatch) -> ExprMatch where F: Fold + ?Sized,1408 pub fn fold_expr_match<F>(f: &mut F, node: ExprMatch) -> ExprMatch
1409 where
1410 F: Fold + ?Sized,
1411 {
1412 ExprMatch {
1413 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1414 match_token: Token![match](tokens_helper(f, &node.match_token.span)),
1415 expr: Box::new(f.fold_expr(*node.expr)),
1416 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
1417 arms: FoldHelper::lift(node.arms, |it| f.fold_arm(it)),
1418 }
1419 }
1420 #[cfg(feature = "full")]
fold_expr_method_call<F>(f: &mut F, node: ExprMethodCall) -> ExprMethodCall where F: Fold + ?Sized,1421 pub fn fold_expr_method_call<F>(f: &mut F, node: ExprMethodCall) -> ExprMethodCall
1422 where
1423 F: Fold + ?Sized,
1424 {
1425 ExprMethodCall {
1426 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1427 receiver: Box::new(f.fold_expr(*node.receiver)),
1428 dot_token: Token![.](tokens_helper(f, &node.dot_token.spans)),
1429 method: f.fold_ident(node.method),
1430 turbofish: (node.turbofish).map(|it| f.fold_method_turbofish(it)),
1431 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
1432 args: FoldHelper::lift(node.args, |it| f.fold_expr(it)),
1433 }
1434 }
1435 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_paren<F>(f: &mut F, node: ExprParen) -> ExprParen where F: Fold + ?Sized,1436 pub fn fold_expr_paren<F>(f: &mut F, node: ExprParen) -> ExprParen
1437 where
1438 F: Fold + ?Sized,
1439 {
1440 ExprParen {
1441 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1442 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
1443 expr: Box::new(f.fold_expr(*node.expr)),
1444 }
1445 }
1446 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_path<F>(f: &mut F, node: ExprPath) -> ExprPath where F: Fold + ?Sized,1447 pub fn fold_expr_path<F>(f: &mut F, node: ExprPath) -> ExprPath
1448 where
1449 F: Fold + ?Sized,
1450 {
1451 ExprPath {
1452 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1453 qself: (node.qself).map(|it| f.fold_qself(it)),
1454 path: f.fold_path(node.path),
1455 }
1456 }
1457 #[cfg(feature = "full")]
fold_expr_range<F>(f: &mut F, node: ExprRange) -> ExprRange where F: Fold + ?Sized,1458 pub fn fold_expr_range<F>(f: &mut F, node: ExprRange) -> ExprRange
1459 where
1460 F: Fold + ?Sized,
1461 {
1462 ExprRange {
1463 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1464 from: (node.from).map(|it| Box::new(f.fold_expr(*it))),
1465 limits: f.fold_range_limits(node.limits),
1466 to: (node.to).map(|it| Box::new(f.fold_expr(*it))),
1467 }
1468 }
1469 #[cfg(feature = "full")]
fold_expr_reference<F>(f: &mut F, node: ExprReference) -> ExprReference where F: Fold + ?Sized,1470 pub fn fold_expr_reference<F>(f: &mut F, node: ExprReference) -> ExprReference
1471 where
1472 F: Fold + ?Sized,
1473 {
1474 ExprReference {
1475 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1476 and_token: Token![&](tokens_helper(f, &node.and_token.spans)),
1477 raw: node.raw,
1478 mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
1479 expr: Box::new(f.fold_expr(*node.expr)),
1480 }
1481 }
1482 #[cfg(feature = "full")]
fold_expr_repeat<F>(f: &mut F, node: ExprRepeat) -> ExprRepeat where F: Fold + ?Sized,1483 pub fn fold_expr_repeat<F>(f: &mut F, node: ExprRepeat) -> ExprRepeat
1484 where
1485 F: Fold + ?Sized,
1486 {
1487 ExprRepeat {
1488 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1489 bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
1490 expr: Box::new(f.fold_expr(*node.expr)),
1491 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
1492 len: Box::new(f.fold_expr(*node.len)),
1493 }
1494 }
1495 #[cfg(feature = "full")]
fold_expr_return<F>(f: &mut F, node: ExprReturn) -> ExprReturn where F: Fold + ?Sized,1496 pub fn fold_expr_return<F>(f: &mut F, node: ExprReturn) -> ExprReturn
1497 where
1498 F: Fold + ?Sized,
1499 {
1500 ExprReturn {
1501 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1502 return_token: Token![return](tokens_helper(f, &node.return_token.span)),
1503 expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))),
1504 }
1505 }
1506 #[cfg(feature = "full")]
fold_expr_struct<F>(f: &mut F, node: ExprStruct) -> ExprStruct where F: Fold + ?Sized,1507 pub fn fold_expr_struct<F>(f: &mut F, node: ExprStruct) -> ExprStruct
1508 where
1509 F: Fold + ?Sized,
1510 {
1511 ExprStruct {
1512 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1513 path: f.fold_path(node.path),
1514 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
1515 fields: FoldHelper::lift(node.fields, |it| f.fold_field_value(it)),
1516 dot2_token: (node.dot2_token).map(|it| Token![..](tokens_helper(f, &it.spans))),
1517 rest: (node.rest).map(|it| Box::new(f.fold_expr(*it))),
1518 }
1519 }
1520 #[cfg(feature = "full")]
fold_expr_try<F>(f: &mut F, node: ExprTry) -> ExprTry where F: Fold + ?Sized,1521 pub fn fold_expr_try<F>(f: &mut F, node: ExprTry) -> ExprTry
1522 where
1523 F: Fold + ?Sized,
1524 {
1525 ExprTry {
1526 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1527 expr: Box::new(f.fold_expr(*node.expr)),
1528 question_token: Token![?](tokens_helper(f, &node.question_token.spans)),
1529 }
1530 }
1531 #[cfg(feature = "full")]
fold_expr_try_block<F>(f: &mut F, node: ExprTryBlock) -> ExprTryBlock where F: Fold + ?Sized,1532 pub fn fold_expr_try_block<F>(f: &mut F, node: ExprTryBlock) -> ExprTryBlock
1533 where
1534 F: Fold + ?Sized,
1535 {
1536 ExprTryBlock {
1537 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1538 try_token: Token![try](tokens_helper(f, &node.try_token.span)),
1539 block: f.fold_block(node.block),
1540 }
1541 }
1542 #[cfg(feature = "full")]
fold_expr_tuple<F>(f: &mut F, node: ExprTuple) -> ExprTuple where F: Fold + ?Sized,1543 pub fn fold_expr_tuple<F>(f: &mut F, node: ExprTuple) -> ExprTuple
1544 where
1545 F: Fold + ?Sized,
1546 {
1547 ExprTuple {
1548 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1549 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
1550 elems: FoldHelper::lift(node.elems, |it| f.fold_expr(it)),
1551 }
1552 }
1553 #[cfg(feature = "full")]
fold_expr_type<F>(f: &mut F, node: ExprType) -> ExprType where F: Fold + ?Sized,1554 pub fn fold_expr_type<F>(f: &mut F, node: ExprType) -> ExprType
1555 where
1556 F: Fold + ?Sized,
1557 {
1558 ExprType {
1559 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1560 expr: Box::new(f.fold_expr(*node.expr)),
1561 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
1562 ty: Box::new(f.fold_type(*node.ty)),
1563 }
1564 }
1565 #[cfg(any(feature = "derive", feature = "full"))]
fold_expr_unary<F>(f: &mut F, node: ExprUnary) -> ExprUnary where F: Fold + ?Sized,1566 pub fn fold_expr_unary<F>(f: &mut F, node: ExprUnary) -> ExprUnary
1567 where
1568 F: Fold + ?Sized,
1569 {
1570 ExprUnary {
1571 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1572 op: f.fold_un_op(node.op),
1573 expr: Box::new(f.fold_expr(*node.expr)),
1574 }
1575 }
1576 #[cfg(feature = "full")]
fold_expr_unsafe<F>(f: &mut F, node: ExprUnsafe) -> ExprUnsafe where F: Fold + ?Sized,1577 pub fn fold_expr_unsafe<F>(f: &mut F, node: ExprUnsafe) -> ExprUnsafe
1578 where
1579 F: Fold + ?Sized,
1580 {
1581 ExprUnsafe {
1582 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1583 unsafe_token: Token![unsafe](tokens_helper(f, &node.unsafe_token.span)),
1584 block: f.fold_block(node.block),
1585 }
1586 }
1587 #[cfg(feature = "full")]
fold_expr_while<F>(f: &mut F, node: ExprWhile) -> ExprWhile where F: Fold + ?Sized,1588 pub fn fold_expr_while<F>(f: &mut F, node: ExprWhile) -> ExprWhile
1589 where
1590 F: Fold + ?Sized,
1591 {
1592 ExprWhile {
1593 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1594 label: (node.label).map(|it| f.fold_label(it)),
1595 while_token: Token![while](tokens_helper(f, &node.while_token.span)),
1596 cond: Box::new(f.fold_expr(*node.cond)),
1597 body: f.fold_block(node.body),
1598 }
1599 }
1600 #[cfg(feature = "full")]
fold_expr_yield<F>(f: &mut F, node: ExprYield) -> ExprYield where F: Fold + ?Sized,1601 pub fn fold_expr_yield<F>(f: &mut F, node: ExprYield) -> ExprYield
1602 where
1603 F: Fold + ?Sized,
1604 {
1605 ExprYield {
1606 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1607 yield_token: Token![yield](tokens_helper(f, &node.yield_token.span)),
1608 expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))),
1609 }
1610 }
1611 #[cfg(any(feature = "derive", feature = "full"))]
fold_field<F>(f: &mut F, node: Field) -> Field where F: Fold + ?Sized,1612 pub fn fold_field<F>(f: &mut F, node: Field) -> Field
1613 where
1614 F: Fold + ?Sized,
1615 {
1616 Field {
1617 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1618 vis: f.fold_visibility(node.vis),
1619 ident: (node.ident).map(|it| f.fold_ident(it)),
1620 colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
1621 ty: f.fold_type(node.ty),
1622 }
1623 }
1624 #[cfg(feature = "full")]
fold_field_pat<F>(f: &mut F, node: FieldPat) -> FieldPat where F: Fold + ?Sized,1625 pub fn fold_field_pat<F>(f: &mut F, node: FieldPat) -> FieldPat
1626 where
1627 F: Fold + ?Sized,
1628 {
1629 FieldPat {
1630 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1631 member: f.fold_member(node.member),
1632 colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
1633 pat: Box::new(f.fold_pat(*node.pat)),
1634 }
1635 }
1636 #[cfg(feature = "full")]
fold_field_value<F>(f: &mut F, node: FieldValue) -> FieldValue where F: Fold + ?Sized,1637 pub fn fold_field_value<F>(f: &mut F, node: FieldValue) -> FieldValue
1638 where
1639 F: Fold + ?Sized,
1640 {
1641 FieldValue {
1642 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1643 member: f.fold_member(node.member),
1644 colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
1645 expr: f.fold_expr(node.expr),
1646 }
1647 }
1648 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields<F>(f: &mut F, node: Fields) -> Fields where F: Fold + ?Sized,1649 pub fn fold_fields<F>(f: &mut F, node: Fields) -> Fields
1650 where
1651 F: Fold + ?Sized,
1652 {
1653 match node {
1654 Fields::Named(_binding_0) => Fields::Named(f.fold_fields_named(_binding_0)),
1655 Fields::Unnamed(_binding_0) => Fields::Unnamed(f.fold_fields_unnamed(_binding_0)),
1656 Fields::Unit => Fields::Unit,
1657 }
1658 }
1659 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields_named<F>(f: &mut F, node: FieldsNamed) -> FieldsNamed where F: Fold + ?Sized,1660 pub fn fold_fields_named<F>(f: &mut F, node: FieldsNamed) -> FieldsNamed
1661 where
1662 F: Fold + ?Sized,
1663 {
1664 FieldsNamed {
1665 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
1666 named: FoldHelper::lift(node.named, |it| f.fold_field(it)),
1667 }
1668 }
1669 #[cfg(any(feature = "derive", feature = "full"))]
fold_fields_unnamed<F>(f: &mut F, node: FieldsUnnamed) -> FieldsUnnamed where F: Fold + ?Sized,1670 pub fn fold_fields_unnamed<F>(f: &mut F, node: FieldsUnnamed) -> FieldsUnnamed
1671 where
1672 F: Fold + ?Sized,
1673 {
1674 FieldsUnnamed {
1675 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
1676 unnamed: FoldHelper::lift(node.unnamed, |it| f.fold_field(it)),
1677 }
1678 }
1679 #[cfg(feature = "full")]
fold_file<F>(f: &mut F, node: File) -> File where F: Fold + ?Sized,1680 pub fn fold_file<F>(f: &mut F, node: File) -> File
1681 where
1682 F: Fold + ?Sized,
1683 {
1684 File {
1685 shebang: node.shebang,
1686 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1687 items: FoldHelper::lift(node.items, |it| f.fold_item(it)),
1688 }
1689 }
1690 #[cfg(feature = "full")]
fold_fn_arg<F>(f: &mut F, node: FnArg) -> FnArg where F: Fold + ?Sized,1691 pub fn fold_fn_arg<F>(f: &mut F, node: FnArg) -> FnArg
1692 where
1693 F: Fold + ?Sized,
1694 {
1695 match node {
1696 FnArg::Receiver(_binding_0) => FnArg::Receiver(f.fold_receiver(_binding_0)),
1697 FnArg::Typed(_binding_0) => FnArg::Typed(f.fold_pat_type(_binding_0)),
1698 }
1699 }
1700 #[cfg(feature = "full")]
fold_foreign_item<F>(f: &mut F, node: ForeignItem) -> ForeignItem where F: Fold + ?Sized,1701 pub fn fold_foreign_item<F>(f: &mut F, node: ForeignItem) -> ForeignItem
1702 where
1703 F: Fold + ?Sized,
1704 {
1705 match node {
1706 ForeignItem::Fn(_binding_0) => {
1707 ForeignItem::Fn(f.fold_foreign_item_fn(_binding_0))
1708 }
1709 ForeignItem::Static(_binding_0) => {
1710 ForeignItem::Static(f.fold_foreign_item_static(_binding_0))
1711 }
1712 ForeignItem::Type(_binding_0) => {
1713 ForeignItem::Type(f.fold_foreign_item_type(_binding_0))
1714 }
1715 ForeignItem::Macro(_binding_0) => {
1716 ForeignItem::Macro(f.fold_foreign_item_macro(_binding_0))
1717 }
1718 ForeignItem::Verbatim(_binding_0) => ForeignItem::Verbatim(_binding_0),
1719 #[cfg(syn_no_non_exhaustive)]
1720 _ => unreachable!(),
1721 }
1722 }
1723 #[cfg(feature = "full")]
fold_foreign_item_fn<F>(f: &mut F, node: ForeignItemFn) -> ForeignItemFn where F: Fold + ?Sized,1724 pub fn fold_foreign_item_fn<F>(f: &mut F, node: ForeignItemFn) -> ForeignItemFn
1725 where
1726 F: Fold + ?Sized,
1727 {
1728 ForeignItemFn {
1729 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1730 vis: f.fold_visibility(node.vis),
1731 sig: f.fold_signature(node.sig),
1732 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
1733 }
1734 }
1735 #[cfg(feature = "full")]
fold_foreign_item_macro<F>(f: &mut F, node: ForeignItemMacro) -> ForeignItemMacro where F: Fold + ?Sized,1736 pub fn fold_foreign_item_macro<F>(f: &mut F, node: ForeignItemMacro) -> ForeignItemMacro
1737 where
1738 F: Fold + ?Sized,
1739 {
1740 ForeignItemMacro {
1741 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1742 mac: f.fold_macro(node.mac),
1743 semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
1744 }
1745 }
1746 #[cfg(feature = "full")]
fold_foreign_item_static<F>( f: &mut F, node: ForeignItemStatic, ) -> ForeignItemStatic where F: Fold + ?Sized,1747 pub fn fold_foreign_item_static<F>(
1748 f: &mut F,
1749 node: ForeignItemStatic,
1750 ) -> ForeignItemStatic
1751 where
1752 F: Fold + ?Sized,
1753 {
1754 ForeignItemStatic {
1755 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1756 vis: f.fold_visibility(node.vis),
1757 static_token: Token![static](tokens_helper(f, &node.static_token.span)),
1758 mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
1759 ident: f.fold_ident(node.ident),
1760 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
1761 ty: Box::new(f.fold_type(*node.ty)),
1762 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
1763 }
1764 }
1765 #[cfg(feature = "full")]
fold_foreign_item_type<F>(f: &mut F, node: ForeignItemType) -> ForeignItemType where F: Fold + ?Sized,1766 pub fn fold_foreign_item_type<F>(f: &mut F, node: ForeignItemType) -> ForeignItemType
1767 where
1768 F: Fold + ?Sized,
1769 {
1770 ForeignItemType {
1771 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1772 vis: f.fold_visibility(node.vis),
1773 type_token: Token![type](tokens_helper(f, &node.type_token.span)),
1774 ident: f.fold_ident(node.ident),
1775 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
1776 }
1777 }
1778 #[cfg(any(feature = "derive", feature = "full"))]
fold_generic_argument<F>(f: &mut F, node: GenericArgument) -> GenericArgument where F: Fold + ?Sized,1779 pub fn fold_generic_argument<F>(f: &mut F, node: GenericArgument) -> GenericArgument
1780 where
1781 F: Fold + ?Sized,
1782 {
1783 match node {
1784 GenericArgument::Lifetime(_binding_0) => {
1785 GenericArgument::Lifetime(f.fold_lifetime(_binding_0))
1786 }
1787 GenericArgument::Type(_binding_0) => {
1788 GenericArgument::Type(f.fold_type(_binding_0))
1789 }
1790 GenericArgument::Const(_binding_0) => {
1791 GenericArgument::Const(f.fold_expr(_binding_0))
1792 }
1793 GenericArgument::Binding(_binding_0) => {
1794 GenericArgument::Binding(f.fold_binding(_binding_0))
1795 }
1796 GenericArgument::Constraint(_binding_0) => {
1797 GenericArgument::Constraint(f.fold_constraint(_binding_0))
1798 }
1799 }
1800 }
1801 #[cfg(feature = "full")]
fold_generic_method_argument<F>( f: &mut F, node: GenericMethodArgument, ) -> GenericMethodArgument where F: Fold + ?Sized,1802 pub fn fold_generic_method_argument<F>(
1803 f: &mut F,
1804 node: GenericMethodArgument,
1805 ) -> GenericMethodArgument
1806 where
1807 F: Fold + ?Sized,
1808 {
1809 match node {
1810 GenericMethodArgument::Type(_binding_0) => {
1811 GenericMethodArgument::Type(f.fold_type(_binding_0))
1812 }
1813 GenericMethodArgument::Const(_binding_0) => {
1814 GenericMethodArgument::Const(f.fold_expr(_binding_0))
1815 }
1816 }
1817 }
1818 #[cfg(any(feature = "derive", feature = "full"))]
fold_generic_param<F>(f: &mut F, node: GenericParam) -> GenericParam where F: Fold + ?Sized,1819 pub fn fold_generic_param<F>(f: &mut F, node: GenericParam) -> GenericParam
1820 where
1821 F: Fold + ?Sized,
1822 {
1823 match node {
1824 GenericParam::Type(_binding_0) => {
1825 GenericParam::Type(f.fold_type_param(_binding_0))
1826 }
1827 GenericParam::Lifetime(_binding_0) => {
1828 GenericParam::Lifetime(f.fold_lifetime_def(_binding_0))
1829 }
1830 GenericParam::Const(_binding_0) => {
1831 GenericParam::Const(f.fold_const_param(_binding_0))
1832 }
1833 }
1834 }
1835 #[cfg(any(feature = "derive", feature = "full"))]
fold_generics<F>(f: &mut F, node: Generics) -> Generics where F: Fold + ?Sized,1836 pub fn fold_generics<F>(f: &mut F, node: Generics) -> Generics
1837 where
1838 F: Fold + ?Sized,
1839 {
1840 Generics {
1841 lt_token: (node.lt_token).map(|it| Token![<](tokens_helper(f, &it.spans))),
1842 params: FoldHelper::lift(node.params, |it| f.fold_generic_param(it)),
1843 gt_token: (node.gt_token).map(|it| Token![>](tokens_helper(f, &it.spans))),
1844 where_clause: (node.where_clause).map(|it| f.fold_where_clause(it)),
1845 }
1846 }
fold_ident<F>(f: &mut F, node: Ident) -> Ident where F: Fold + ?Sized,1847 pub fn fold_ident<F>(f: &mut F, node: Ident) -> Ident
1848 where
1849 F: Fold + ?Sized,
1850 {
1851 let mut node = node;
1852 let span = f.fold_span(node.span());
1853 node.set_span(span);
1854 node
1855 }
1856 #[cfg(feature = "full")]
fold_impl_item<F>(f: &mut F, node: ImplItem) -> ImplItem where F: Fold + ?Sized,1857 pub fn fold_impl_item<F>(f: &mut F, node: ImplItem) -> ImplItem
1858 where
1859 F: Fold + ?Sized,
1860 {
1861 match node {
1862 ImplItem::Const(_binding_0) => {
1863 ImplItem::Const(f.fold_impl_item_const(_binding_0))
1864 }
1865 ImplItem::Method(_binding_0) => {
1866 ImplItem::Method(f.fold_impl_item_method(_binding_0))
1867 }
1868 ImplItem::Type(_binding_0) => ImplItem::Type(f.fold_impl_item_type(_binding_0)),
1869 ImplItem::Macro(_binding_0) => {
1870 ImplItem::Macro(f.fold_impl_item_macro(_binding_0))
1871 }
1872 ImplItem::Verbatim(_binding_0) => ImplItem::Verbatim(_binding_0),
1873 #[cfg(syn_no_non_exhaustive)]
1874 _ => unreachable!(),
1875 }
1876 }
1877 #[cfg(feature = "full")]
fold_impl_item_const<F>(f: &mut F, node: ImplItemConst) -> ImplItemConst where F: Fold + ?Sized,1878 pub fn fold_impl_item_const<F>(f: &mut F, node: ImplItemConst) -> ImplItemConst
1879 where
1880 F: Fold + ?Sized,
1881 {
1882 ImplItemConst {
1883 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1884 vis: f.fold_visibility(node.vis),
1885 defaultness: (node.defaultness)
1886 .map(|it| Token![default](tokens_helper(f, &it.span))),
1887 const_token: Token![const](tokens_helper(f, &node.const_token.span)),
1888 ident: f.fold_ident(node.ident),
1889 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
1890 ty: f.fold_type(node.ty),
1891 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
1892 expr: f.fold_expr(node.expr),
1893 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
1894 }
1895 }
1896 #[cfg(feature = "full")]
fold_impl_item_macro<F>(f: &mut F, node: ImplItemMacro) -> ImplItemMacro where F: Fold + ?Sized,1897 pub fn fold_impl_item_macro<F>(f: &mut F, node: ImplItemMacro) -> ImplItemMacro
1898 where
1899 F: Fold + ?Sized,
1900 {
1901 ImplItemMacro {
1902 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1903 mac: f.fold_macro(node.mac),
1904 semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
1905 }
1906 }
1907 #[cfg(feature = "full")]
fold_impl_item_method<F>(f: &mut F, node: ImplItemMethod) -> ImplItemMethod where F: Fold + ?Sized,1908 pub fn fold_impl_item_method<F>(f: &mut F, node: ImplItemMethod) -> ImplItemMethod
1909 where
1910 F: Fold + ?Sized,
1911 {
1912 ImplItemMethod {
1913 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1914 vis: f.fold_visibility(node.vis),
1915 defaultness: (node.defaultness)
1916 .map(|it| Token![default](tokens_helper(f, &it.span))),
1917 sig: f.fold_signature(node.sig),
1918 block: f.fold_block(node.block),
1919 }
1920 }
1921 #[cfg(feature = "full")]
fold_impl_item_type<F>(f: &mut F, node: ImplItemType) -> ImplItemType where F: Fold + ?Sized,1922 pub fn fold_impl_item_type<F>(f: &mut F, node: ImplItemType) -> ImplItemType
1923 where
1924 F: Fold + ?Sized,
1925 {
1926 ImplItemType {
1927 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1928 vis: f.fold_visibility(node.vis),
1929 defaultness: (node.defaultness)
1930 .map(|it| Token![default](tokens_helper(f, &it.span))),
1931 type_token: Token![type](tokens_helper(f, &node.type_token.span)),
1932 ident: f.fold_ident(node.ident),
1933 generics: f.fold_generics(node.generics),
1934 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
1935 ty: f.fold_type(node.ty),
1936 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
1937 }
1938 }
1939 #[cfg(any(feature = "derive", feature = "full"))]
fold_index<F>(f: &mut F, node: Index) -> Index where F: Fold + ?Sized,1940 pub fn fold_index<F>(f: &mut F, node: Index) -> Index
1941 where
1942 F: Fold + ?Sized,
1943 {
1944 Index {
1945 index: node.index,
1946 span: f.fold_span(node.span),
1947 }
1948 }
1949 #[cfg(feature = "full")]
fold_item<F>(f: &mut F, node: Item) -> Item where F: Fold + ?Sized,1950 pub fn fold_item<F>(f: &mut F, node: Item) -> Item
1951 where
1952 F: Fold + ?Sized,
1953 {
1954 match node {
1955 Item::Const(_binding_0) => Item::Const(f.fold_item_const(_binding_0)),
1956 Item::Enum(_binding_0) => Item::Enum(f.fold_item_enum(_binding_0)),
1957 Item::ExternCrate(_binding_0) => {
1958 Item::ExternCrate(f.fold_item_extern_crate(_binding_0))
1959 }
1960 Item::Fn(_binding_0) => Item::Fn(f.fold_item_fn(_binding_0)),
1961 Item::ForeignMod(_binding_0) => {
1962 Item::ForeignMod(f.fold_item_foreign_mod(_binding_0))
1963 }
1964 Item::Impl(_binding_0) => Item::Impl(f.fold_item_impl(_binding_0)),
1965 Item::Macro(_binding_0) => Item::Macro(f.fold_item_macro(_binding_0)),
1966 Item::Macro2(_binding_0) => Item::Macro2(f.fold_item_macro2(_binding_0)),
1967 Item::Mod(_binding_0) => Item::Mod(f.fold_item_mod(_binding_0)),
1968 Item::Static(_binding_0) => Item::Static(f.fold_item_static(_binding_0)),
1969 Item::Struct(_binding_0) => Item::Struct(f.fold_item_struct(_binding_0)),
1970 Item::Trait(_binding_0) => Item::Trait(f.fold_item_trait(_binding_0)),
1971 Item::TraitAlias(_binding_0) => {
1972 Item::TraitAlias(f.fold_item_trait_alias(_binding_0))
1973 }
1974 Item::Type(_binding_0) => Item::Type(f.fold_item_type(_binding_0)),
1975 Item::Union(_binding_0) => Item::Union(f.fold_item_union(_binding_0)),
1976 Item::Use(_binding_0) => Item::Use(f.fold_item_use(_binding_0)),
1977 Item::Verbatim(_binding_0) => Item::Verbatim(_binding_0),
1978 #[cfg(syn_no_non_exhaustive)]
1979 _ => unreachable!(),
1980 }
1981 }
1982 #[cfg(feature = "full")]
fold_item_const<F>(f: &mut F, node: ItemConst) -> ItemConst where F: Fold + ?Sized,1983 pub fn fold_item_const<F>(f: &mut F, node: ItemConst) -> ItemConst
1984 where
1985 F: Fold + ?Sized,
1986 {
1987 ItemConst {
1988 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
1989 vis: f.fold_visibility(node.vis),
1990 const_token: Token![const](tokens_helper(f, &node.const_token.span)),
1991 ident: f.fold_ident(node.ident),
1992 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
1993 ty: Box::new(f.fold_type(*node.ty)),
1994 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
1995 expr: Box::new(f.fold_expr(*node.expr)),
1996 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
1997 }
1998 }
1999 #[cfg(feature = "full")]
fold_item_enum<F>(f: &mut F, node: ItemEnum) -> ItemEnum where F: Fold + ?Sized,2000 pub fn fold_item_enum<F>(f: &mut F, node: ItemEnum) -> ItemEnum
2001 where
2002 F: Fold + ?Sized,
2003 {
2004 ItemEnum {
2005 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2006 vis: f.fold_visibility(node.vis),
2007 enum_token: Token![enum](tokens_helper(f, &node.enum_token.span)),
2008 ident: f.fold_ident(node.ident),
2009 generics: f.fold_generics(node.generics),
2010 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
2011 variants: FoldHelper::lift(node.variants, |it| f.fold_variant(it)),
2012 }
2013 }
2014 #[cfg(feature = "full")]
fold_item_extern_crate<F>(f: &mut F, node: ItemExternCrate) -> ItemExternCrate where F: Fold + ?Sized,2015 pub fn fold_item_extern_crate<F>(f: &mut F, node: ItemExternCrate) -> ItemExternCrate
2016 where
2017 F: Fold + ?Sized,
2018 {
2019 ItemExternCrate {
2020 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2021 vis: f.fold_visibility(node.vis),
2022 extern_token: Token![extern](tokens_helper(f, &node.extern_token.span)),
2023 crate_token: Token![crate](tokens_helper(f, &node.crate_token.span)),
2024 ident: f.fold_ident(node.ident),
2025 rename: (node.rename)
2026 .map(|it| (
2027 Token![as](tokens_helper(f, &(it).0.span)),
2028 f.fold_ident((it).1),
2029 )),
2030 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
2031 }
2032 }
2033 #[cfg(feature = "full")]
fold_item_fn<F>(f: &mut F, node: ItemFn) -> ItemFn where F: Fold + ?Sized,2034 pub fn fold_item_fn<F>(f: &mut F, node: ItemFn) -> ItemFn
2035 where
2036 F: Fold + ?Sized,
2037 {
2038 ItemFn {
2039 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2040 vis: f.fold_visibility(node.vis),
2041 sig: f.fold_signature(node.sig),
2042 block: Box::new(f.fold_block(*node.block)),
2043 }
2044 }
2045 #[cfg(feature = "full")]
fold_item_foreign_mod<F>(f: &mut F, node: ItemForeignMod) -> ItemForeignMod where F: Fold + ?Sized,2046 pub fn fold_item_foreign_mod<F>(f: &mut F, node: ItemForeignMod) -> ItemForeignMod
2047 where
2048 F: Fold + ?Sized,
2049 {
2050 ItemForeignMod {
2051 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2052 abi: f.fold_abi(node.abi),
2053 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
2054 items: FoldHelper::lift(node.items, |it| f.fold_foreign_item(it)),
2055 }
2056 }
2057 #[cfg(feature = "full")]
fold_item_impl<F>(f: &mut F, node: ItemImpl) -> ItemImpl where F: Fold + ?Sized,2058 pub fn fold_item_impl<F>(f: &mut F, node: ItemImpl) -> ItemImpl
2059 where
2060 F: Fold + ?Sized,
2061 {
2062 ItemImpl {
2063 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2064 defaultness: (node.defaultness)
2065 .map(|it| Token![default](tokens_helper(f, &it.span))),
2066 unsafety: (node.unsafety).map(|it| Token![unsafe](tokens_helper(f, &it.span))),
2067 impl_token: Token![impl](tokens_helper(f, &node.impl_token.span)),
2068 generics: f.fold_generics(node.generics),
2069 trait_: (node.trait_)
2070 .map(|it| (
2071 ((it).0).map(|it| Token![!](tokens_helper(f, &it.spans))),
2072 f.fold_path((it).1),
2073 Token![for](tokens_helper(f, &(it).2.span)),
2074 )),
2075 self_ty: Box::new(f.fold_type(*node.self_ty)),
2076 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
2077 items: FoldHelper::lift(node.items, |it| f.fold_impl_item(it)),
2078 }
2079 }
2080 #[cfg(feature = "full")]
fold_item_macro<F>(f: &mut F, node: ItemMacro) -> ItemMacro where F: Fold + ?Sized,2081 pub fn fold_item_macro<F>(f: &mut F, node: ItemMacro) -> ItemMacro
2082 where
2083 F: Fold + ?Sized,
2084 {
2085 ItemMacro {
2086 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2087 ident: (node.ident).map(|it| f.fold_ident(it)),
2088 mac: f.fold_macro(node.mac),
2089 semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
2090 }
2091 }
2092 #[cfg(feature = "full")]
fold_item_macro2<F>(f: &mut F, node: ItemMacro2) -> ItemMacro2 where F: Fold + ?Sized,2093 pub fn fold_item_macro2<F>(f: &mut F, node: ItemMacro2) -> ItemMacro2
2094 where
2095 F: Fold + ?Sized,
2096 {
2097 ItemMacro2 {
2098 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2099 vis: f.fold_visibility(node.vis),
2100 macro_token: Token![macro](tokens_helper(f, &node.macro_token.span)),
2101 ident: f.fold_ident(node.ident),
2102 rules: node.rules,
2103 }
2104 }
2105 #[cfg(feature = "full")]
fold_item_mod<F>(f: &mut F, node: ItemMod) -> ItemMod where F: Fold + ?Sized,2106 pub fn fold_item_mod<F>(f: &mut F, node: ItemMod) -> ItemMod
2107 where
2108 F: Fold + ?Sized,
2109 {
2110 ItemMod {
2111 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2112 vis: f.fold_visibility(node.vis),
2113 mod_token: Token![mod](tokens_helper(f, &node.mod_token.span)),
2114 ident: f.fold_ident(node.ident),
2115 content: (node.content)
2116 .map(|it| (
2117 Brace(tokens_helper(f, &(it).0.span)),
2118 FoldHelper::lift((it).1, |it| f.fold_item(it)),
2119 )),
2120 semi: (node.semi).map(|it| Token![;](tokens_helper(f, &it.spans))),
2121 }
2122 }
2123 #[cfg(feature = "full")]
fold_item_static<F>(f: &mut F, node: ItemStatic) -> ItemStatic where F: Fold + ?Sized,2124 pub fn fold_item_static<F>(f: &mut F, node: ItemStatic) -> ItemStatic
2125 where
2126 F: Fold + ?Sized,
2127 {
2128 ItemStatic {
2129 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2130 vis: f.fold_visibility(node.vis),
2131 static_token: Token![static](tokens_helper(f, &node.static_token.span)),
2132 mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
2133 ident: f.fold_ident(node.ident),
2134 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
2135 ty: Box::new(f.fold_type(*node.ty)),
2136 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
2137 expr: Box::new(f.fold_expr(*node.expr)),
2138 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
2139 }
2140 }
2141 #[cfg(feature = "full")]
fold_item_struct<F>(f: &mut F, node: ItemStruct) -> ItemStruct where F: Fold + ?Sized,2142 pub fn fold_item_struct<F>(f: &mut F, node: ItemStruct) -> ItemStruct
2143 where
2144 F: Fold + ?Sized,
2145 {
2146 ItemStruct {
2147 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2148 vis: f.fold_visibility(node.vis),
2149 struct_token: Token![struct](tokens_helper(f, &node.struct_token.span)),
2150 ident: f.fold_ident(node.ident),
2151 generics: f.fold_generics(node.generics),
2152 fields: f.fold_fields(node.fields),
2153 semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
2154 }
2155 }
2156 #[cfg(feature = "full")]
fold_item_trait<F>(f: &mut F, node: ItemTrait) -> ItemTrait where F: Fold + ?Sized,2157 pub fn fold_item_trait<F>(f: &mut F, node: ItemTrait) -> ItemTrait
2158 where
2159 F: Fold + ?Sized,
2160 {
2161 ItemTrait {
2162 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2163 vis: f.fold_visibility(node.vis),
2164 unsafety: (node.unsafety).map(|it| Token![unsafe](tokens_helper(f, &it.span))),
2165 auto_token: (node.auto_token).map(|it| Token![auto](tokens_helper(f, &it.span))),
2166 trait_token: Token![trait](tokens_helper(f, &node.trait_token.span)),
2167 ident: f.fold_ident(node.ident),
2168 generics: f.fold_generics(node.generics),
2169 colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
2170 supertraits: FoldHelper::lift(
2171 node.supertraits,
2172 |it| f.fold_type_param_bound(it),
2173 ),
2174 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
2175 items: FoldHelper::lift(node.items, |it| f.fold_trait_item(it)),
2176 }
2177 }
2178 #[cfg(feature = "full")]
fold_item_trait_alias<F>(f: &mut F, node: ItemTraitAlias) -> ItemTraitAlias where F: Fold + ?Sized,2179 pub fn fold_item_trait_alias<F>(f: &mut F, node: ItemTraitAlias) -> ItemTraitAlias
2180 where
2181 F: Fold + ?Sized,
2182 {
2183 ItemTraitAlias {
2184 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2185 vis: f.fold_visibility(node.vis),
2186 trait_token: Token![trait](tokens_helper(f, &node.trait_token.span)),
2187 ident: f.fold_ident(node.ident),
2188 generics: f.fold_generics(node.generics),
2189 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
2190 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
2191 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
2192 }
2193 }
2194 #[cfg(feature = "full")]
fold_item_type<F>(f: &mut F, node: ItemType) -> ItemType where F: Fold + ?Sized,2195 pub fn fold_item_type<F>(f: &mut F, node: ItemType) -> ItemType
2196 where
2197 F: Fold + ?Sized,
2198 {
2199 ItemType {
2200 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2201 vis: f.fold_visibility(node.vis),
2202 type_token: Token![type](tokens_helper(f, &node.type_token.span)),
2203 ident: f.fold_ident(node.ident),
2204 generics: f.fold_generics(node.generics),
2205 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
2206 ty: Box::new(f.fold_type(*node.ty)),
2207 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
2208 }
2209 }
2210 #[cfg(feature = "full")]
fold_item_union<F>(f: &mut F, node: ItemUnion) -> ItemUnion where F: Fold + ?Sized,2211 pub fn fold_item_union<F>(f: &mut F, node: ItemUnion) -> ItemUnion
2212 where
2213 F: Fold + ?Sized,
2214 {
2215 ItemUnion {
2216 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2217 vis: f.fold_visibility(node.vis),
2218 union_token: Token![union](tokens_helper(f, &node.union_token.span)),
2219 ident: f.fold_ident(node.ident),
2220 generics: f.fold_generics(node.generics),
2221 fields: f.fold_fields_named(node.fields),
2222 }
2223 }
2224 #[cfg(feature = "full")]
fold_item_use<F>(f: &mut F, node: ItemUse) -> ItemUse where F: Fold + ?Sized,2225 pub fn fold_item_use<F>(f: &mut F, node: ItemUse) -> ItemUse
2226 where
2227 F: Fold + ?Sized,
2228 {
2229 ItemUse {
2230 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2231 vis: f.fold_visibility(node.vis),
2232 use_token: Token![use](tokens_helper(f, &node.use_token.span)),
2233 leading_colon: (node.leading_colon)
2234 .map(|it| Token![::](tokens_helper(f, &it.spans))),
2235 tree: f.fold_use_tree(node.tree),
2236 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
2237 }
2238 }
2239 #[cfg(feature = "full")]
fold_label<F>(f: &mut F, node: Label) -> Label where F: Fold + ?Sized,2240 pub fn fold_label<F>(f: &mut F, node: Label) -> Label
2241 where
2242 F: Fold + ?Sized,
2243 {
2244 Label {
2245 name: f.fold_lifetime(node.name),
2246 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
2247 }
2248 }
fold_lifetime<F>(f: &mut F, node: Lifetime) -> Lifetime where F: Fold + ?Sized,2249 pub fn fold_lifetime<F>(f: &mut F, node: Lifetime) -> Lifetime
2250 where
2251 F: Fold + ?Sized,
2252 {
2253 Lifetime {
2254 apostrophe: f.fold_span(node.apostrophe),
2255 ident: f.fold_ident(node.ident),
2256 }
2257 }
2258 #[cfg(any(feature = "derive", feature = "full"))]
fold_lifetime_def<F>(f: &mut F, node: LifetimeDef) -> LifetimeDef where F: Fold + ?Sized,2259 pub fn fold_lifetime_def<F>(f: &mut F, node: LifetimeDef) -> LifetimeDef
2260 where
2261 F: Fold + ?Sized,
2262 {
2263 LifetimeDef {
2264 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2265 lifetime: f.fold_lifetime(node.lifetime),
2266 colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
2267 bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)),
2268 }
2269 }
fold_lit<F>(f: &mut F, node: Lit) -> Lit where F: Fold + ?Sized,2270 pub fn fold_lit<F>(f: &mut F, node: Lit) -> Lit
2271 where
2272 F: Fold + ?Sized,
2273 {
2274 match node {
2275 Lit::Str(_binding_0) => Lit::Str(f.fold_lit_str(_binding_0)),
2276 Lit::ByteStr(_binding_0) => Lit::ByteStr(f.fold_lit_byte_str(_binding_0)),
2277 Lit::Byte(_binding_0) => Lit::Byte(f.fold_lit_byte(_binding_0)),
2278 Lit::Char(_binding_0) => Lit::Char(f.fold_lit_char(_binding_0)),
2279 Lit::Int(_binding_0) => Lit::Int(f.fold_lit_int(_binding_0)),
2280 Lit::Float(_binding_0) => Lit::Float(f.fold_lit_float(_binding_0)),
2281 Lit::Bool(_binding_0) => Lit::Bool(f.fold_lit_bool(_binding_0)),
2282 Lit::Verbatim(_binding_0) => Lit::Verbatim(_binding_0),
2283 }
2284 }
fold_lit_bool<F>(f: &mut F, node: LitBool) -> LitBool where F: Fold + ?Sized,2285 pub fn fold_lit_bool<F>(f: &mut F, node: LitBool) -> LitBool
2286 where
2287 F: Fold + ?Sized,
2288 {
2289 LitBool {
2290 value: node.value,
2291 span: f.fold_span(node.span),
2292 }
2293 }
fold_lit_byte<F>(f: &mut F, node: LitByte) -> LitByte where F: Fold + ?Sized,2294 pub fn fold_lit_byte<F>(f: &mut F, node: LitByte) -> LitByte
2295 where
2296 F: Fold + ?Sized,
2297 {
2298 let span = f.fold_span(node.span());
2299 let mut node = node;
2300 node.set_span(span);
2301 node
2302 }
fold_lit_byte_str<F>(f: &mut F, node: LitByteStr) -> LitByteStr where F: Fold + ?Sized,2303 pub fn fold_lit_byte_str<F>(f: &mut F, node: LitByteStr) -> LitByteStr
2304 where
2305 F: Fold + ?Sized,
2306 {
2307 let span = f.fold_span(node.span());
2308 let mut node = node;
2309 node.set_span(span);
2310 node
2311 }
fold_lit_char<F>(f: &mut F, node: LitChar) -> LitChar where F: Fold + ?Sized,2312 pub fn fold_lit_char<F>(f: &mut F, node: LitChar) -> LitChar
2313 where
2314 F: Fold + ?Sized,
2315 {
2316 let span = f.fold_span(node.span());
2317 let mut node = node;
2318 node.set_span(span);
2319 node
2320 }
fold_lit_float<F>(f: &mut F, node: LitFloat) -> LitFloat where F: Fold + ?Sized,2321 pub fn fold_lit_float<F>(f: &mut F, node: LitFloat) -> LitFloat
2322 where
2323 F: Fold + ?Sized,
2324 {
2325 let span = f.fold_span(node.span());
2326 let mut node = node;
2327 node.set_span(span);
2328 node
2329 }
fold_lit_int<F>(f: &mut F, node: LitInt) -> LitInt where F: Fold + ?Sized,2330 pub fn fold_lit_int<F>(f: &mut F, node: LitInt) -> LitInt
2331 where
2332 F: Fold + ?Sized,
2333 {
2334 let span = f.fold_span(node.span());
2335 let mut node = node;
2336 node.set_span(span);
2337 node
2338 }
fold_lit_str<F>(f: &mut F, node: LitStr) -> LitStr where F: Fold + ?Sized,2339 pub fn fold_lit_str<F>(f: &mut F, node: LitStr) -> LitStr
2340 where
2341 F: Fold + ?Sized,
2342 {
2343 let span = f.fold_span(node.span());
2344 let mut node = node;
2345 node.set_span(span);
2346 node
2347 }
2348 #[cfg(feature = "full")]
fold_local<F>(f: &mut F, node: Local) -> Local where F: Fold + ?Sized,2349 pub fn fold_local<F>(f: &mut F, node: Local) -> Local
2350 where
2351 F: Fold + ?Sized,
2352 {
2353 Local {
2354 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2355 let_token: Token![let](tokens_helper(f, &node.let_token.span)),
2356 pat: f.fold_pat(node.pat),
2357 init: (node.init)
2358 .map(|it| (
2359 Token![=](tokens_helper(f, &(it).0.spans)),
2360 Box::new(f.fold_expr(*(it).1)),
2361 )),
2362 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
2363 }
2364 }
2365 #[cfg(any(feature = "derive", feature = "full"))]
fold_macro<F>(f: &mut F, node: Macro) -> Macro where F: Fold + ?Sized,2366 pub fn fold_macro<F>(f: &mut F, node: Macro) -> Macro
2367 where
2368 F: Fold + ?Sized,
2369 {
2370 Macro {
2371 path: f.fold_path(node.path),
2372 bang_token: Token![!](tokens_helper(f, &node.bang_token.spans)),
2373 delimiter: f.fold_macro_delimiter(node.delimiter),
2374 tokens: node.tokens,
2375 }
2376 }
2377 #[cfg(any(feature = "derive", feature = "full"))]
fold_macro_delimiter<F>(f: &mut F, node: MacroDelimiter) -> MacroDelimiter where F: Fold + ?Sized,2378 pub fn fold_macro_delimiter<F>(f: &mut F, node: MacroDelimiter) -> MacroDelimiter
2379 where
2380 F: Fold + ?Sized,
2381 {
2382 match node {
2383 MacroDelimiter::Paren(_binding_0) => {
2384 MacroDelimiter::Paren(Paren(tokens_helper(f, &_binding_0.span)))
2385 }
2386 MacroDelimiter::Brace(_binding_0) => {
2387 MacroDelimiter::Brace(Brace(tokens_helper(f, &_binding_0.span)))
2388 }
2389 MacroDelimiter::Bracket(_binding_0) => {
2390 MacroDelimiter::Bracket(Bracket(tokens_helper(f, &_binding_0.span)))
2391 }
2392 }
2393 }
2394 #[cfg(any(feature = "derive", feature = "full"))]
fold_member<F>(f: &mut F, node: Member) -> Member where F: Fold + ?Sized,2395 pub fn fold_member<F>(f: &mut F, node: Member) -> Member
2396 where
2397 F: Fold + ?Sized,
2398 {
2399 match node {
2400 Member::Named(_binding_0) => Member::Named(f.fold_ident(_binding_0)),
2401 Member::Unnamed(_binding_0) => Member::Unnamed(f.fold_index(_binding_0)),
2402 }
2403 }
2404 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta<F>(f: &mut F, node: Meta) -> Meta where F: Fold + ?Sized,2405 pub fn fold_meta<F>(f: &mut F, node: Meta) -> Meta
2406 where
2407 F: Fold + ?Sized,
2408 {
2409 match node {
2410 Meta::Path(_binding_0) => Meta::Path(f.fold_path(_binding_0)),
2411 Meta::List(_binding_0) => Meta::List(f.fold_meta_list(_binding_0)),
2412 Meta::NameValue(_binding_0) => {
2413 Meta::NameValue(f.fold_meta_name_value(_binding_0))
2414 }
2415 }
2416 }
2417 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta_list<F>(f: &mut F, node: MetaList) -> MetaList where F: Fold + ?Sized,2418 pub fn fold_meta_list<F>(f: &mut F, node: MetaList) -> MetaList
2419 where
2420 F: Fold + ?Sized,
2421 {
2422 MetaList {
2423 path: f.fold_path(node.path),
2424 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
2425 nested: FoldHelper::lift(node.nested, |it| f.fold_nested_meta(it)),
2426 }
2427 }
2428 #[cfg(any(feature = "derive", feature = "full"))]
fold_meta_name_value<F>(f: &mut F, node: MetaNameValue) -> MetaNameValue where F: Fold + ?Sized,2429 pub fn fold_meta_name_value<F>(f: &mut F, node: MetaNameValue) -> MetaNameValue
2430 where
2431 F: Fold + ?Sized,
2432 {
2433 MetaNameValue {
2434 path: f.fold_path(node.path),
2435 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
2436 lit: f.fold_lit(node.lit),
2437 }
2438 }
2439 #[cfg(feature = "full")]
fold_method_turbofish<F>(f: &mut F, node: MethodTurbofish) -> MethodTurbofish where F: Fold + ?Sized,2440 pub fn fold_method_turbofish<F>(f: &mut F, node: MethodTurbofish) -> MethodTurbofish
2441 where
2442 F: Fold + ?Sized,
2443 {
2444 MethodTurbofish {
2445 colon2_token: Token![::](tokens_helper(f, &node.colon2_token.spans)),
2446 lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)),
2447 args: FoldHelper::lift(node.args, |it| f.fold_generic_method_argument(it)),
2448 gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)),
2449 }
2450 }
2451 #[cfg(any(feature = "derive", feature = "full"))]
fold_nested_meta<F>(f: &mut F, node: NestedMeta) -> NestedMeta where F: Fold + ?Sized,2452 pub fn fold_nested_meta<F>(f: &mut F, node: NestedMeta) -> NestedMeta
2453 where
2454 F: Fold + ?Sized,
2455 {
2456 match node {
2457 NestedMeta::Meta(_binding_0) => NestedMeta::Meta(f.fold_meta(_binding_0)),
2458 NestedMeta::Lit(_binding_0) => NestedMeta::Lit(f.fold_lit(_binding_0)),
2459 }
2460 }
2461 #[cfg(any(feature = "derive", feature = "full"))]
fold_parenthesized_generic_arguments<F>( f: &mut F, node: ParenthesizedGenericArguments, ) -> ParenthesizedGenericArguments where F: Fold + ?Sized,2462 pub fn fold_parenthesized_generic_arguments<F>(
2463 f: &mut F,
2464 node: ParenthesizedGenericArguments,
2465 ) -> ParenthesizedGenericArguments
2466 where
2467 F: Fold + ?Sized,
2468 {
2469 ParenthesizedGenericArguments {
2470 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
2471 inputs: FoldHelper::lift(node.inputs, |it| f.fold_type(it)),
2472 output: f.fold_return_type(node.output),
2473 }
2474 }
2475 #[cfg(feature = "full")]
fold_pat<F>(f: &mut F, node: Pat) -> Pat where F: Fold + ?Sized,2476 pub fn fold_pat<F>(f: &mut F, node: Pat) -> Pat
2477 where
2478 F: Fold + ?Sized,
2479 {
2480 match node {
2481 Pat::Box(_binding_0) => Pat::Box(f.fold_pat_box(_binding_0)),
2482 Pat::Ident(_binding_0) => Pat::Ident(f.fold_pat_ident(_binding_0)),
2483 Pat::Lit(_binding_0) => Pat::Lit(f.fold_pat_lit(_binding_0)),
2484 Pat::Macro(_binding_0) => Pat::Macro(f.fold_pat_macro(_binding_0)),
2485 Pat::Or(_binding_0) => Pat::Or(f.fold_pat_or(_binding_0)),
2486 Pat::Path(_binding_0) => Pat::Path(f.fold_pat_path(_binding_0)),
2487 Pat::Range(_binding_0) => Pat::Range(f.fold_pat_range(_binding_0)),
2488 Pat::Reference(_binding_0) => Pat::Reference(f.fold_pat_reference(_binding_0)),
2489 Pat::Rest(_binding_0) => Pat::Rest(f.fold_pat_rest(_binding_0)),
2490 Pat::Slice(_binding_0) => Pat::Slice(f.fold_pat_slice(_binding_0)),
2491 Pat::Struct(_binding_0) => Pat::Struct(f.fold_pat_struct(_binding_0)),
2492 Pat::Tuple(_binding_0) => Pat::Tuple(f.fold_pat_tuple(_binding_0)),
2493 Pat::TupleStruct(_binding_0) => {
2494 Pat::TupleStruct(f.fold_pat_tuple_struct(_binding_0))
2495 }
2496 Pat::Type(_binding_0) => Pat::Type(f.fold_pat_type(_binding_0)),
2497 Pat::Verbatim(_binding_0) => Pat::Verbatim(_binding_0),
2498 Pat::Wild(_binding_0) => Pat::Wild(f.fold_pat_wild(_binding_0)),
2499 #[cfg(syn_no_non_exhaustive)]
2500 _ => unreachable!(),
2501 }
2502 }
2503 #[cfg(feature = "full")]
fold_pat_box<F>(f: &mut F, node: PatBox) -> PatBox where F: Fold + ?Sized,2504 pub fn fold_pat_box<F>(f: &mut F, node: PatBox) -> PatBox
2505 where
2506 F: Fold + ?Sized,
2507 {
2508 PatBox {
2509 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2510 box_token: Token![box](tokens_helper(f, &node.box_token.span)),
2511 pat: Box::new(f.fold_pat(*node.pat)),
2512 }
2513 }
2514 #[cfg(feature = "full")]
fold_pat_ident<F>(f: &mut F, node: PatIdent) -> PatIdent where F: Fold + ?Sized,2515 pub fn fold_pat_ident<F>(f: &mut F, node: PatIdent) -> PatIdent
2516 where
2517 F: Fold + ?Sized,
2518 {
2519 PatIdent {
2520 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2521 by_ref: (node.by_ref).map(|it| Token![ref](tokens_helper(f, &it.span))),
2522 mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
2523 ident: f.fold_ident(node.ident),
2524 subpat: (node.subpat)
2525 .map(|it| (
2526 Token![@](tokens_helper(f, &(it).0.spans)),
2527 Box::new(f.fold_pat(*(it).1)),
2528 )),
2529 }
2530 }
2531 #[cfg(feature = "full")]
fold_pat_lit<F>(f: &mut F, node: PatLit) -> PatLit where F: Fold + ?Sized,2532 pub fn fold_pat_lit<F>(f: &mut F, node: PatLit) -> PatLit
2533 where
2534 F: Fold + ?Sized,
2535 {
2536 PatLit {
2537 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2538 expr: Box::new(f.fold_expr(*node.expr)),
2539 }
2540 }
2541 #[cfg(feature = "full")]
fold_pat_macro<F>(f: &mut F, node: PatMacro) -> PatMacro where F: Fold + ?Sized,2542 pub fn fold_pat_macro<F>(f: &mut F, node: PatMacro) -> PatMacro
2543 where
2544 F: Fold + ?Sized,
2545 {
2546 PatMacro {
2547 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2548 mac: f.fold_macro(node.mac),
2549 }
2550 }
2551 #[cfg(feature = "full")]
fold_pat_or<F>(f: &mut F, node: PatOr) -> PatOr where F: Fold + ?Sized,2552 pub fn fold_pat_or<F>(f: &mut F, node: PatOr) -> PatOr
2553 where
2554 F: Fold + ?Sized,
2555 {
2556 PatOr {
2557 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2558 leading_vert: (node.leading_vert)
2559 .map(|it| Token![|](tokens_helper(f, &it.spans))),
2560 cases: FoldHelper::lift(node.cases, |it| f.fold_pat(it)),
2561 }
2562 }
2563 #[cfg(feature = "full")]
fold_pat_path<F>(f: &mut F, node: PatPath) -> PatPath where F: Fold + ?Sized,2564 pub fn fold_pat_path<F>(f: &mut F, node: PatPath) -> PatPath
2565 where
2566 F: Fold + ?Sized,
2567 {
2568 PatPath {
2569 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2570 qself: (node.qself).map(|it| f.fold_qself(it)),
2571 path: f.fold_path(node.path),
2572 }
2573 }
2574 #[cfg(feature = "full")]
fold_pat_range<F>(f: &mut F, node: PatRange) -> PatRange where F: Fold + ?Sized,2575 pub fn fold_pat_range<F>(f: &mut F, node: PatRange) -> PatRange
2576 where
2577 F: Fold + ?Sized,
2578 {
2579 PatRange {
2580 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2581 lo: Box::new(f.fold_expr(*node.lo)),
2582 limits: f.fold_range_limits(node.limits),
2583 hi: Box::new(f.fold_expr(*node.hi)),
2584 }
2585 }
2586 #[cfg(feature = "full")]
fold_pat_reference<F>(f: &mut F, node: PatReference) -> PatReference where F: Fold + ?Sized,2587 pub fn fold_pat_reference<F>(f: &mut F, node: PatReference) -> PatReference
2588 where
2589 F: Fold + ?Sized,
2590 {
2591 PatReference {
2592 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2593 and_token: Token![&](tokens_helper(f, &node.and_token.spans)),
2594 mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
2595 pat: Box::new(f.fold_pat(*node.pat)),
2596 }
2597 }
2598 #[cfg(feature = "full")]
fold_pat_rest<F>(f: &mut F, node: PatRest) -> PatRest where F: Fold + ?Sized,2599 pub fn fold_pat_rest<F>(f: &mut F, node: PatRest) -> PatRest
2600 where
2601 F: Fold + ?Sized,
2602 {
2603 PatRest {
2604 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2605 dot2_token: Token![..](tokens_helper(f, &node.dot2_token.spans)),
2606 }
2607 }
2608 #[cfg(feature = "full")]
fold_pat_slice<F>(f: &mut F, node: PatSlice) -> PatSlice where F: Fold + ?Sized,2609 pub fn fold_pat_slice<F>(f: &mut F, node: PatSlice) -> PatSlice
2610 where
2611 F: Fold + ?Sized,
2612 {
2613 PatSlice {
2614 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2615 bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
2616 elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)),
2617 }
2618 }
2619 #[cfg(feature = "full")]
fold_pat_struct<F>(f: &mut F, node: PatStruct) -> PatStruct where F: Fold + ?Sized,2620 pub fn fold_pat_struct<F>(f: &mut F, node: PatStruct) -> PatStruct
2621 where
2622 F: Fold + ?Sized,
2623 {
2624 PatStruct {
2625 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2626 path: f.fold_path(node.path),
2627 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
2628 fields: FoldHelper::lift(node.fields, |it| f.fold_field_pat(it)),
2629 dot2_token: (node.dot2_token).map(|it| Token![..](tokens_helper(f, &it.spans))),
2630 }
2631 }
2632 #[cfg(feature = "full")]
fold_pat_tuple<F>(f: &mut F, node: PatTuple) -> PatTuple where F: Fold + ?Sized,2633 pub fn fold_pat_tuple<F>(f: &mut F, node: PatTuple) -> PatTuple
2634 where
2635 F: Fold + ?Sized,
2636 {
2637 PatTuple {
2638 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2639 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
2640 elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)),
2641 }
2642 }
2643 #[cfg(feature = "full")]
fold_pat_tuple_struct<F>(f: &mut F, node: PatTupleStruct) -> PatTupleStruct where F: Fold + ?Sized,2644 pub fn fold_pat_tuple_struct<F>(f: &mut F, node: PatTupleStruct) -> PatTupleStruct
2645 where
2646 F: Fold + ?Sized,
2647 {
2648 PatTupleStruct {
2649 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2650 path: f.fold_path(node.path),
2651 pat: f.fold_pat_tuple(node.pat),
2652 }
2653 }
2654 #[cfg(feature = "full")]
fold_pat_type<F>(f: &mut F, node: PatType) -> PatType where F: Fold + ?Sized,2655 pub fn fold_pat_type<F>(f: &mut F, node: PatType) -> PatType
2656 where
2657 F: Fold + ?Sized,
2658 {
2659 PatType {
2660 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2661 pat: Box::new(f.fold_pat(*node.pat)),
2662 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
2663 ty: Box::new(f.fold_type(*node.ty)),
2664 }
2665 }
2666 #[cfg(feature = "full")]
fold_pat_wild<F>(f: &mut F, node: PatWild) -> PatWild where F: Fold + ?Sized,2667 pub fn fold_pat_wild<F>(f: &mut F, node: PatWild) -> PatWild
2668 where
2669 F: Fold + ?Sized,
2670 {
2671 PatWild {
2672 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2673 underscore_token: Token![_](tokens_helper(f, &node.underscore_token.spans)),
2674 }
2675 }
2676 #[cfg(any(feature = "derive", feature = "full"))]
fold_path<F>(f: &mut F, node: Path) -> Path where F: Fold + ?Sized,2677 pub fn fold_path<F>(f: &mut F, node: Path) -> Path
2678 where
2679 F: Fold + ?Sized,
2680 {
2681 Path {
2682 leading_colon: (node.leading_colon)
2683 .map(|it| Token![::](tokens_helper(f, &it.spans))),
2684 segments: FoldHelper::lift(node.segments, |it| f.fold_path_segment(it)),
2685 }
2686 }
2687 #[cfg(any(feature = "derive", feature = "full"))]
fold_path_arguments<F>(f: &mut F, node: PathArguments) -> PathArguments where F: Fold + ?Sized,2688 pub fn fold_path_arguments<F>(f: &mut F, node: PathArguments) -> PathArguments
2689 where
2690 F: Fold + ?Sized,
2691 {
2692 match node {
2693 PathArguments::None => PathArguments::None,
2694 PathArguments::AngleBracketed(_binding_0) => {
2695 PathArguments::AngleBracketed(
2696 f.fold_angle_bracketed_generic_arguments(_binding_0),
2697 )
2698 }
2699 PathArguments::Parenthesized(_binding_0) => {
2700 PathArguments::Parenthesized(
2701 f.fold_parenthesized_generic_arguments(_binding_0),
2702 )
2703 }
2704 }
2705 }
2706 #[cfg(any(feature = "derive", feature = "full"))]
fold_path_segment<F>(f: &mut F, node: PathSegment) -> PathSegment where F: Fold + ?Sized,2707 pub fn fold_path_segment<F>(f: &mut F, node: PathSegment) -> PathSegment
2708 where
2709 F: Fold + ?Sized,
2710 {
2711 PathSegment {
2712 ident: f.fold_ident(node.ident),
2713 arguments: f.fold_path_arguments(node.arguments),
2714 }
2715 }
2716 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_eq<F>(f: &mut F, node: PredicateEq) -> PredicateEq where F: Fold + ?Sized,2717 pub fn fold_predicate_eq<F>(f: &mut F, node: PredicateEq) -> PredicateEq
2718 where
2719 F: Fold + ?Sized,
2720 {
2721 PredicateEq {
2722 lhs_ty: f.fold_type(node.lhs_ty),
2723 eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)),
2724 rhs_ty: f.fold_type(node.rhs_ty),
2725 }
2726 }
2727 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_lifetime<F>( f: &mut F, node: PredicateLifetime, ) -> PredicateLifetime where F: Fold + ?Sized,2728 pub fn fold_predicate_lifetime<F>(
2729 f: &mut F,
2730 node: PredicateLifetime,
2731 ) -> PredicateLifetime
2732 where
2733 F: Fold + ?Sized,
2734 {
2735 PredicateLifetime {
2736 lifetime: f.fold_lifetime(node.lifetime),
2737 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
2738 bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)),
2739 }
2740 }
2741 #[cfg(any(feature = "derive", feature = "full"))]
fold_predicate_type<F>(f: &mut F, node: PredicateType) -> PredicateType where F: Fold + ?Sized,2742 pub fn fold_predicate_type<F>(f: &mut F, node: PredicateType) -> PredicateType
2743 where
2744 F: Fold + ?Sized,
2745 {
2746 PredicateType {
2747 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
2748 bounded_ty: f.fold_type(node.bounded_ty),
2749 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
2750 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
2751 }
2752 }
2753 #[cfg(any(feature = "derive", feature = "full"))]
fold_qself<F>(f: &mut F, node: QSelf) -> QSelf where F: Fold + ?Sized,2754 pub fn fold_qself<F>(f: &mut F, node: QSelf) -> QSelf
2755 where
2756 F: Fold + ?Sized,
2757 {
2758 QSelf {
2759 lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)),
2760 ty: Box::new(f.fold_type(*node.ty)),
2761 position: node.position,
2762 as_token: (node.as_token).map(|it| Token![as](tokens_helper(f, &it.span))),
2763 gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)),
2764 }
2765 }
2766 #[cfg(feature = "full")]
fold_range_limits<F>(f: &mut F, node: RangeLimits) -> RangeLimits where F: Fold + ?Sized,2767 pub fn fold_range_limits<F>(f: &mut F, node: RangeLimits) -> RangeLimits
2768 where
2769 F: Fold + ?Sized,
2770 {
2771 match node {
2772 RangeLimits::HalfOpen(_binding_0) => {
2773 RangeLimits::HalfOpen(Token![..](tokens_helper(f, &_binding_0.spans)))
2774 }
2775 RangeLimits::Closed(_binding_0) => {
2776 RangeLimits::Closed(Token![..=](tokens_helper(f, &_binding_0.spans)))
2777 }
2778 }
2779 }
2780 #[cfg(feature = "full")]
fold_receiver<F>(f: &mut F, node: Receiver) -> Receiver where F: Fold + ?Sized,2781 pub fn fold_receiver<F>(f: &mut F, node: Receiver) -> Receiver
2782 where
2783 F: Fold + ?Sized,
2784 {
2785 Receiver {
2786 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2787 reference: (node.reference)
2788 .map(|it| (
2789 Token![&](tokens_helper(f, &(it).0.spans)),
2790 ((it).1).map(|it| f.fold_lifetime(it)),
2791 )),
2792 mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
2793 self_token: Token![self](tokens_helper(f, &node.self_token.span)),
2794 }
2795 }
2796 #[cfg(any(feature = "derive", feature = "full"))]
fold_return_type<F>(f: &mut F, node: ReturnType) -> ReturnType where F: Fold + ?Sized,2797 pub fn fold_return_type<F>(f: &mut F, node: ReturnType) -> ReturnType
2798 where
2799 F: Fold + ?Sized,
2800 {
2801 match node {
2802 ReturnType::Default => ReturnType::Default,
2803 ReturnType::Type(_binding_0, _binding_1) => {
2804 ReturnType::Type(
2805 Token![->](tokens_helper(f, &_binding_0.spans)),
2806 Box::new(f.fold_type(*_binding_1)),
2807 )
2808 }
2809 }
2810 }
2811 #[cfg(feature = "full")]
fold_signature<F>(f: &mut F, node: Signature) -> Signature where F: Fold + ?Sized,2812 pub fn fold_signature<F>(f: &mut F, node: Signature) -> Signature
2813 where
2814 F: Fold + ?Sized,
2815 {
2816 Signature {
2817 constness: (node.constness).map(|it| Token![const](tokens_helper(f, &it.span))),
2818 asyncness: (node.asyncness).map(|it| Token![async](tokens_helper(f, &it.span))),
2819 unsafety: (node.unsafety).map(|it| Token![unsafe](tokens_helper(f, &it.span))),
2820 abi: (node.abi).map(|it| f.fold_abi(it)),
2821 fn_token: Token![fn](tokens_helper(f, &node.fn_token.span)),
2822 ident: f.fold_ident(node.ident),
2823 generics: f.fold_generics(node.generics),
2824 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
2825 inputs: FoldHelper::lift(node.inputs, |it| f.fold_fn_arg(it)),
2826 variadic: (node.variadic).map(|it| f.fold_variadic(it)),
2827 output: f.fold_return_type(node.output),
2828 }
2829 }
fold_span<F>(f: &mut F, node: Span) -> Span where F: Fold + ?Sized,2830 pub fn fold_span<F>(f: &mut F, node: Span) -> Span
2831 where
2832 F: Fold + ?Sized,
2833 {
2834 node
2835 }
2836 #[cfg(feature = "full")]
fold_stmt<F>(f: &mut F, node: Stmt) -> Stmt where F: Fold + ?Sized,2837 pub fn fold_stmt<F>(f: &mut F, node: Stmt) -> Stmt
2838 where
2839 F: Fold + ?Sized,
2840 {
2841 match node {
2842 Stmt::Local(_binding_0) => Stmt::Local(f.fold_local(_binding_0)),
2843 Stmt::Item(_binding_0) => Stmt::Item(f.fold_item(_binding_0)),
2844 Stmt::Expr(_binding_0) => Stmt::Expr(f.fold_expr(_binding_0)),
2845 Stmt::Semi(_binding_0, _binding_1) => {
2846 Stmt::Semi(
2847 f.fold_expr(_binding_0),
2848 Token![;](tokens_helper(f, &_binding_1.spans)),
2849 )
2850 }
2851 }
2852 }
2853 #[cfg(any(feature = "derive", feature = "full"))]
fold_trait_bound<F>(f: &mut F, node: TraitBound) -> TraitBound where F: Fold + ?Sized,2854 pub fn fold_trait_bound<F>(f: &mut F, node: TraitBound) -> TraitBound
2855 where
2856 F: Fold + ?Sized,
2857 {
2858 TraitBound {
2859 paren_token: (node.paren_token).map(|it| Paren(tokens_helper(f, &it.span))),
2860 modifier: f.fold_trait_bound_modifier(node.modifier),
2861 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
2862 path: f.fold_path(node.path),
2863 }
2864 }
2865 #[cfg(any(feature = "derive", feature = "full"))]
fold_trait_bound_modifier<F>( f: &mut F, node: TraitBoundModifier, ) -> TraitBoundModifier where F: Fold + ?Sized,2866 pub fn fold_trait_bound_modifier<F>(
2867 f: &mut F,
2868 node: TraitBoundModifier,
2869 ) -> TraitBoundModifier
2870 where
2871 F: Fold + ?Sized,
2872 {
2873 match node {
2874 TraitBoundModifier::None => TraitBoundModifier::None,
2875 TraitBoundModifier::Maybe(_binding_0) => {
2876 TraitBoundModifier::Maybe(Token![?](tokens_helper(f, &_binding_0.spans)))
2877 }
2878 }
2879 }
2880 #[cfg(feature = "full")]
fold_trait_item<F>(f: &mut F, node: TraitItem) -> TraitItem where F: Fold + ?Sized,2881 pub fn fold_trait_item<F>(f: &mut F, node: TraitItem) -> TraitItem
2882 where
2883 F: Fold + ?Sized,
2884 {
2885 match node {
2886 TraitItem::Const(_binding_0) => {
2887 TraitItem::Const(f.fold_trait_item_const(_binding_0))
2888 }
2889 TraitItem::Method(_binding_0) => {
2890 TraitItem::Method(f.fold_trait_item_method(_binding_0))
2891 }
2892 TraitItem::Type(_binding_0) => {
2893 TraitItem::Type(f.fold_trait_item_type(_binding_0))
2894 }
2895 TraitItem::Macro(_binding_0) => {
2896 TraitItem::Macro(f.fold_trait_item_macro(_binding_0))
2897 }
2898 TraitItem::Verbatim(_binding_0) => TraitItem::Verbatim(_binding_0),
2899 #[cfg(syn_no_non_exhaustive)]
2900 _ => unreachable!(),
2901 }
2902 }
2903 #[cfg(feature = "full")]
fold_trait_item_const<F>(f: &mut F, node: TraitItemConst) -> TraitItemConst where F: Fold + ?Sized,2904 pub fn fold_trait_item_const<F>(f: &mut F, node: TraitItemConst) -> TraitItemConst
2905 where
2906 F: Fold + ?Sized,
2907 {
2908 TraitItemConst {
2909 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2910 const_token: Token![const](tokens_helper(f, &node.const_token.span)),
2911 ident: f.fold_ident(node.ident),
2912 colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)),
2913 ty: f.fold_type(node.ty),
2914 default: (node.default)
2915 .map(|it| (Token![=](tokens_helper(f, &(it).0.spans)), f.fold_expr((it).1))),
2916 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
2917 }
2918 }
2919 #[cfg(feature = "full")]
fold_trait_item_macro<F>(f: &mut F, node: TraitItemMacro) -> TraitItemMacro where F: Fold + ?Sized,2920 pub fn fold_trait_item_macro<F>(f: &mut F, node: TraitItemMacro) -> TraitItemMacro
2921 where
2922 F: Fold + ?Sized,
2923 {
2924 TraitItemMacro {
2925 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2926 mac: f.fold_macro(node.mac),
2927 semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
2928 }
2929 }
2930 #[cfg(feature = "full")]
fold_trait_item_method<F>(f: &mut F, node: TraitItemMethod) -> TraitItemMethod where F: Fold + ?Sized,2931 pub fn fold_trait_item_method<F>(f: &mut F, node: TraitItemMethod) -> TraitItemMethod
2932 where
2933 F: Fold + ?Sized,
2934 {
2935 TraitItemMethod {
2936 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2937 sig: f.fold_signature(node.sig),
2938 default: (node.default).map(|it| f.fold_block(it)),
2939 semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))),
2940 }
2941 }
2942 #[cfg(feature = "full")]
fold_trait_item_type<F>(f: &mut F, node: TraitItemType) -> TraitItemType where F: Fold + ?Sized,2943 pub fn fold_trait_item_type<F>(f: &mut F, node: TraitItemType) -> TraitItemType
2944 where
2945 F: Fold + ?Sized,
2946 {
2947 TraitItemType {
2948 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
2949 type_token: Token![type](tokens_helper(f, &node.type_token.span)),
2950 ident: f.fold_ident(node.ident),
2951 generics: f.fold_generics(node.generics),
2952 colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
2953 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
2954 default: (node.default)
2955 .map(|it| (Token![=](tokens_helper(f, &(it).0.spans)), f.fold_type((it).1))),
2956 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
2957 }
2958 }
2959 #[cfg(any(feature = "derive", feature = "full"))]
fold_type<F>(f: &mut F, node: Type) -> Type where F: Fold + ?Sized,2960 pub fn fold_type<F>(f: &mut F, node: Type) -> Type
2961 where
2962 F: Fold + ?Sized,
2963 {
2964 match node {
2965 Type::Array(_binding_0) => Type::Array(f.fold_type_array(_binding_0)),
2966 Type::BareFn(_binding_0) => Type::BareFn(f.fold_type_bare_fn(_binding_0)),
2967 Type::Group(_binding_0) => Type::Group(f.fold_type_group(_binding_0)),
2968 Type::ImplTrait(_binding_0) => {
2969 Type::ImplTrait(f.fold_type_impl_trait(_binding_0))
2970 }
2971 Type::Infer(_binding_0) => Type::Infer(f.fold_type_infer(_binding_0)),
2972 Type::Macro(_binding_0) => Type::Macro(f.fold_type_macro(_binding_0)),
2973 Type::Never(_binding_0) => Type::Never(f.fold_type_never(_binding_0)),
2974 Type::Paren(_binding_0) => Type::Paren(f.fold_type_paren(_binding_0)),
2975 Type::Path(_binding_0) => Type::Path(f.fold_type_path(_binding_0)),
2976 Type::Ptr(_binding_0) => Type::Ptr(f.fold_type_ptr(_binding_0)),
2977 Type::Reference(_binding_0) => Type::Reference(f.fold_type_reference(_binding_0)),
2978 Type::Slice(_binding_0) => Type::Slice(f.fold_type_slice(_binding_0)),
2979 Type::TraitObject(_binding_0) => {
2980 Type::TraitObject(f.fold_type_trait_object(_binding_0))
2981 }
2982 Type::Tuple(_binding_0) => Type::Tuple(f.fold_type_tuple(_binding_0)),
2983 Type::Verbatim(_binding_0) => Type::Verbatim(_binding_0),
2984 #[cfg(syn_no_non_exhaustive)]
2985 _ => unreachable!(),
2986 }
2987 }
2988 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_array<F>(f: &mut F, node: TypeArray) -> TypeArray where F: Fold + ?Sized,2989 pub fn fold_type_array<F>(f: &mut F, node: TypeArray) -> TypeArray
2990 where
2991 F: Fold + ?Sized,
2992 {
2993 TypeArray {
2994 bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
2995 elem: Box::new(f.fold_type(*node.elem)),
2996 semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)),
2997 len: f.fold_expr(node.len),
2998 }
2999 }
3000 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_bare_fn<F>(f: &mut F, node: TypeBareFn) -> TypeBareFn where F: Fold + ?Sized,3001 pub fn fold_type_bare_fn<F>(f: &mut F, node: TypeBareFn) -> TypeBareFn
3002 where
3003 F: Fold + ?Sized,
3004 {
3005 TypeBareFn {
3006 lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)),
3007 unsafety: (node.unsafety).map(|it| Token![unsafe](tokens_helper(f, &it.span))),
3008 abi: (node.abi).map(|it| f.fold_abi(it)),
3009 fn_token: Token![fn](tokens_helper(f, &node.fn_token.span)),
3010 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
3011 inputs: FoldHelper::lift(node.inputs, |it| f.fold_bare_fn_arg(it)),
3012 variadic: (node.variadic).map(|it| f.fold_variadic(it)),
3013 output: f.fold_return_type(node.output),
3014 }
3015 }
3016 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_group<F>(f: &mut F, node: TypeGroup) -> TypeGroup where F: Fold + ?Sized,3017 pub fn fold_type_group<F>(f: &mut F, node: TypeGroup) -> TypeGroup
3018 where
3019 F: Fold + ?Sized,
3020 {
3021 TypeGroup {
3022 group_token: Group(tokens_helper(f, &node.group_token.span)),
3023 elem: Box::new(f.fold_type(*node.elem)),
3024 }
3025 }
3026 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_impl_trait<F>(f: &mut F, node: TypeImplTrait) -> TypeImplTrait where F: Fold + ?Sized,3027 pub fn fold_type_impl_trait<F>(f: &mut F, node: TypeImplTrait) -> TypeImplTrait
3028 where
3029 F: Fold + ?Sized,
3030 {
3031 TypeImplTrait {
3032 impl_token: Token![impl](tokens_helper(f, &node.impl_token.span)),
3033 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
3034 }
3035 }
3036 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_infer<F>(f: &mut F, node: TypeInfer) -> TypeInfer where F: Fold + ?Sized,3037 pub fn fold_type_infer<F>(f: &mut F, node: TypeInfer) -> TypeInfer
3038 where
3039 F: Fold + ?Sized,
3040 {
3041 TypeInfer {
3042 underscore_token: Token![_](tokens_helper(f, &node.underscore_token.spans)),
3043 }
3044 }
3045 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_macro<F>(f: &mut F, node: TypeMacro) -> TypeMacro where F: Fold + ?Sized,3046 pub fn fold_type_macro<F>(f: &mut F, node: TypeMacro) -> TypeMacro
3047 where
3048 F: Fold + ?Sized,
3049 {
3050 TypeMacro {
3051 mac: f.fold_macro(node.mac),
3052 }
3053 }
3054 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_never<F>(f: &mut F, node: TypeNever) -> TypeNever where F: Fold + ?Sized,3055 pub fn fold_type_never<F>(f: &mut F, node: TypeNever) -> TypeNever
3056 where
3057 F: Fold + ?Sized,
3058 {
3059 TypeNever {
3060 bang_token: Token![!](tokens_helper(f, &node.bang_token.spans)),
3061 }
3062 }
3063 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_param<F>(f: &mut F, node: TypeParam) -> TypeParam where F: Fold + ?Sized,3064 pub fn fold_type_param<F>(f: &mut F, node: TypeParam) -> TypeParam
3065 where
3066 F: Fold + ?Sized,
3067 {
3068 TypeParam {
3069 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
3070 ident: f.fold_ident(node.ident),
3071 colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))),
3072 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
3073 eq_token: (node.eq_token).map(|it| Token![=](tokens_helper(f, &it.spans))),
3074 default: (node.default).map(|it| f.fold_type(it)),
3075 }
3076 }
3077 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_param_bound<F>(f: &mut F, node: TypeParamBound) -> TypeParamBound where F: Fold + ?Sized,3078 pub fn fold_type_param_bound<F>(f: &mut F, node: TypeParamBound) -> TypeParamBound
3079 where
3080 F: Fold + ?Sized,
3081 {
3082 match node {
3083 TypeParamBound::Trait(_binding_0) => {
3084 TypeParamBound::Trait(f.fold_trait_bound(_binding_0))
3085 }
3086 TypeParamBound::Lifetime(_binding_0) => {
3087 TypeParamBound::Lifetime(f.fold_lifetime(_binding_0))
3088 }
3089 }
3090 }
3091 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_paren<F>(f: &mut F, node: TypeParen) -> TypeParen where F: Fold + ?Sized,3092 pub fn fold_type_paren<F>(f: &mut F, node: TypeParen) -> TypeParen
3093 where
3094 F: Fold + ?Sized,
3095 {
3096 TypeParen {
3097 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
3098 elem: Box::new(f.fold_type(*node.elem)),
3099 }
3100 }
3101 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_path<F>(f: &mut F, node: TypePath) -> TypePath where F: Fold + ?Sized,3102 pub fn fold_type_path<F>(f: &mut F, node: TypePath) -> TypePath
3103 where
3104 F: Fold + ?Sized,
3105 {
3106 TypePath {
3107 qself: (node.qself).map(|it| f.fold_qself(it)),
3108 path: f.fold_path(node.path),
3109 }
3110 }
3111 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_ptr<F>(f: &mut F, node: TypePtr) -> TypePtr where F: Fold + ?Sized,3112 pub fn fold_type_ptr<F>(f: &mut F, node: TypePtr) -> TypePtr
3113 where
3114 F: Fold + ?Sized,
3115 {
3116 TypePtr {
3117 star_token: Token![*](tokens_helper(f, &node.star_token.spans)),
3118 const_token: (node.const_token)
3119 .map(|it| Token![const](tokens_helper(f, &it.span))),
3120 mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
3121 elem: Box::new(f.fold_type(*node.elem)),
3122 }
3123 }
3124 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_reference<F>(f: &mut F, node: TypeReference) -> TypeReference where F: Fold + ?Sized,3125 pub fn fold_type_reference<F>(f: &mut F, node: TypeReference) -> TypeReference
3126 where
3127 F: Fold + ?Sized,
3128 {
3129 TypeReference {
3130 and_token: Token![&](tokens_helper(f, &node.and_token.spans)),
3131 lifetime: (node.lifetime).map(|it| f.fold_lifetime(it)),
3132 mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))),
3133 elem: Box::new(f.fold_type(*node.elem)),
3134 }
3135 }
3136 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_slice<F>(f: &mut F, node: TypeSlice) -> TypeSlice where F: Fold + ?Sized,3137 pub fn fold_type_slice<F>(f: &mut F, node: TypeSlice) -> TypeSlice
3138 where
3139 F: Fold + ?Sized,
3140 {
3141 TypeSlice {
3142 bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)),
3143 elem: Box::new(f.fold_type(*node.elem)),
3144 }
3145 }
3146 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_trait_object<F>(f: &mut F, node: TypeTraitObject) -> TypeTraitObject where F: Fold + ?Sized,3147 pub fn fold_type_trait_object<F>(f: &mut F, node: TypeTraitObject) -> TypeTraitObject
3148 where
3149 F: Fold + ?Sized,
3150 {
3151 TypeTraitObject {
3152 dyn_token: (node.dyn_token).map(|it| Token![dyn](tokens_helper(f, &it.span))),
3153 bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)),
3154 }
3155 }
3156 #[cfg(any(feature = "derive", feature = "full"))]
fold_type_tuple<F>(f: &mut F, node: TypeTuple) -> TypeTuple where F: Fold + ?Sized,3157 pub fn fold_type_tuple<F>(f: &mut F, node: TypeTuple) -> TypeTuple
3158 where
3159 F: Fold + ?Sized,
3160 {
3161 TypeTuple {
3162 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
3163 elems: FoldHelper::lift(node.elems, |it| f.fold_type(it)),
3164 }
3165 }
3166 #[cfg(any(feature = "derive", feature = "full"))]
fold_un_op<F>(f: &mut F, node: UnOp) -> UnOp where F: Fold + ?Sized,3167 pub fn fold_un_op<F>(f: &mut F, node: UnOp) -> UnOp
3168 where
3169 F: Fold + ?Sized,
3170 {
3171 match node {
3172 UnOp::Deref(_binding_0) => {
3173 UnOp::Deref(Token![*](tokens_helper(f, &_binding_0.spans)))
3174 }
3175 UnOp::Not(_binding_0) => {
3176 UnOp::Not(Token![!](tokens_helper(f, &_binding_0.spans)))
3177 }
3178 UnOp::Neg(_binding_0) => {
3179 UnOp::Neg(Token![-](tokens_helper(f, &_binding_0.spans)))
3180 }
3181 }
3182 }
3183 #[cfg(feature = "full")]
fold_use_glob<F>(f: &mut F, node: UseGlob) -> UseGlob where F: Fold + ?Sized,3184 pub fn fold_use_glob<F>(f: &mut F, node: UseGlob) -> UseGlob
3185 where
3186 F: Fold + ?Sized,
3187 {
3188 UseGlob {
3189 star_token: Token![*](tokens_helper(f, &node.star_token.spans)),
3190 }
3191 }
3192 #[cfg(feature = "full")]
fold_use_group<F>(f: &mut F, node: UseGroup) -> UseGroup where F: Fold + ?Sized,3193 pub fn fold_use_group<F>(f: &mut F, node: UseGroup) -> UseGroup
3194 where
3195 F: Fold + ?Sized,
3196 {
3197 UseGroup {
3198 brace_token: Brace(tokens_helper(f, &node.brace_token.span)),
3199 items: FoldHelper::lift(node.items, |it| f.fold_use_tree(it)),
3200 }
3201 }
3202 #[cfg(feature = "full")]
fold_use_name<F>(f: &mut F, node: UseName) -> UseName where F: Fold + ?Sized,3203 pub fn fold_use_name<F>(f: &mut F, node: UseName) -> UseName
3204 where
3205 F: Fold + ?Sized,
3206 {
3207 UseName {
3208 ident: f.fold_ident(node.ident),
3209 }
3210 }
3211 #[cfg(feature = "full")]
fold_use_path<F>(f: &mut F, node: UsePath) -> UsePath where F: Fold + ?Sized,3212 pub fn fold_use_path<F>(f: &mut F, node: UsePath) -> UsePath
3213 where
3214 F: Fold + ?Sized,
3215 {
3216 UsePath {
3217 ident: f.fold_ident(node.ident),
3218 colon2_token: Token![::](tokens_helper(f, &node.colon2_token.spans)),
3219 tree: Box::new(f.fold_use_tree(*node.tree)),
3220 }
3221 }
3222 #[cfg(feature = "full")]
fold_use_rename<F>(f: &mut F, node: UseRename) -> UseRename where F: Fold + ?Sized,3223 pub fn fold_use_rename<F>(f: &mut F, node: UseRename) -> UseRename
3224 where
3225 F: Fold + ?Sized,
3226 {
3227 UseRename {
3228 ident: f.fold_ident(node.ident),
3229 as_token: Token![as](tokens_helper(f, &node.as_token.span)),
3230 rename: f.fold_ident(node.rename),
3231 }
3232 }
3233 #[cfg(feature = "full")]
fold_use_tree<F>(f: &mut F, node: UseTree) -> UseTree where F: Fold + ?Sized,3234 pub fn fold_use_tree<F>(f: &mut F, node: UseTree) -> UseTree
3235 where
3236 F: Fold + ?Sized,
3237 {
3238 match node {
3239 UseTree::Path(_binding_0) => UseTree::Path(f.fold_use_path(_binding_0)),
3240 UseTree::Name(_binding_0) => UseTree::Name(f.fold_use_name(_binding_0)),
3241 UseTree::Rename(_binding_0) => UseTree::Rename(f.fold_use_rename(_binding_0)),
3242 UseTree::Glob(_binding_0) => UseTree::Glob(f.fold_use_glob(_binding_0)),
3243 UseTree::Group(_binding_0) => UseTree::Group(f.fold_use_group(_binding_0)),
3244 }
3245 }
3246 #[cfg(any(feature = "derive", feature = "full"))]
fold_variadic<F>(f: &mut F, node: Variadic) -> Variadic where F: Fold + ?Sized,3247 pub fn fold_variadic<F>(f: &mut F, node: Variadic) -> Variadic
3248 where
3249 F: Fold + ?Sized,
3250 {
3251 Variadic {
3252 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
3253 dots: Token![...](tokens_helper(f, &node.dots.spans)),
3254 }
3255 }
3256 #[cfg(any(feature = "derive", feature = "full"))]
fold_variant<F>(f: &mut F, node: Variant) -> Variant where F: Fold + ?Sized,3257 pub fn fold_variant<F>(f: &mut F, node: Variant) -> Variant
3258 where
3259 F: Fold + ?Sized,
3260 {
3261 Variant {
3262 attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)),
3263 ident: f.fold_ident(node.ident),
3264 fields: f.fold_fields(node.fields),
3265 discriminant: (node.discriminant)
3266 .map(|it| (Token![=](tokens_helper(f, &(it).0.spans)), f.fold_expr((it).1))),
3267 }
3268 }
3269 #[cfg(any(feature = "derive", feature = "full"))]
fold_vis_crate<F>(f: &mut F, node: VisCrate) -> VisCrate where F: Fold + ?Sized,3270 pub fn fold_vis_crate<F>(f: &mut F, node: VisCrate) -> VisCrate
3271 where
3272 F: Fold + ?Sized,
3273 {
3274 VisCrate {
3275 crate_token: Token![crate](tokens_helper(f, &node.crate_token.span)),
3276 }
3277 }
3278 #[cfg(any(feature = "derive", feature = "full"))]
fold_vis_public<F>(f: &mut F, node: VisPublic) -> VisPublic where F: Fold + ?Sized,3279 pub fn fold_vis_public<F>(f: &mut F, node: VisPublic) -> VisPublic
3280 where
3281 F: Fold + ?Sized,
3282 {
3283 VisPublic {
3284 pub_token: Token![pub](tokens_helper(f, &node.pub_token.span)),
3285 }
3286 }
3287 #[cfg(any(feature = "derive", feature = "full"))]
fold_vis_restricted<F>(f: &mut F, node: VisRestricted) -> VisRestricted where F: Fold + ?Sized,3288 pub fn fold_vis_restricted<F>(f: &mut F, node: VisRestricted) -> VisRestricted
3289 where
3290 F: Fold + ?Sized,
3291 {
3292 VisRestricted {
3293 pub_token: Token![pub](tokens_helper(f, &node.pub_token.span)),
3294 paren_token: Paren(tokens_helper(f, &node.paren_token.span)),
3295 in_token: (node.in_token).map(|it| Token![in](tokens_helper(f, &it.span))),
3296 path: Box::new(f.fold_path(*node.path)),
3297 }
3298 }
3299 #[cfg(any(feature = "derive", feature = "full"))]
fold_visibility<F>(f: &mut F, node: Visibility) -> Visibility where F: Fold + ?Sized,3300 pub fn fold_visibility<F>(f: &mut F, node: Visibility) -> Visibility
3301 where
3302 F: Fold + ?Sized,
3303 {
3304 match node {
3305 Visibility::Public(_binding_0) => {
3306 Visibility::Public(f.fold_vis_public(_binding_0))
3307 }
3308 Visibility::Crate(_binding_0) => Visibility::Crate(f.fold_vis_crate(_binding_0)),
3309 Visibility::Restricted(_binding_0) => {
3310 Visibility::Restricted(f.fold_vis_restricted(_binding_0))
3311 }
3312 Visibility::Inherited => Visibility::Inherited,
3313 }
3314 }
3315 #[cfg(any(feature = "derive", feature = "full"))]
fold_where_clause<F>(f: &mut F, node: WhereClause) -> WhereClause where F: Fold + ?Sized,3316 pub fn fold_where_clause<F>(f: &mut F, node: WhereClause) -> WhereClause
3317 where
3318 F: Fold + ?Sized,
3319 {
3320 WhereClause {
3321 where_token: Token![where](tokens_helper(f, &node.where_token.span)),
3322 predicates: FoldHelper::lift(node.predicates, |it| f.fold_where_predicate(it)),
3323 }
3324 }
3325 #[cfg(any(feature = "derive", feature = "full"))]
fold_where_predicate<F>(f: &mut F, node: WherePredicate) -> WherePredicate where F: Fold + ?Sized,3326 pub fn fold_where_predicate<F>(f: &mut F, node: WherePredicate) -> WherePredicate
3327 where
3328 F: Fold + ?Sized,
3329 {
3330 match node {
3331 WherePredicate::Type(_binding_0) => {
3332 WherePredicate::Type(f.fold_predicate_type(_binding_0))
3333 }
3334 WherePredicate::Lifetime(_binding_0) => {
3335 WherePredicate::Lifetime(f.fold_predicate_lifetime(_binding_0))
3336 }
3337 WherePredicate::Eq(_binding_0) => {
3338 WherePredicate::Eq(f.fold_predicate_eq(_binding_0))
3339 }
3340 }
3341 }
3342