| 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" ))] |
| 33 | fn fold_abi(&mut self, i: Abi) -> Abi { |
| 34 | fold_abi(self, i) |
| 35 | } |
| 36 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 37 | 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" )] |
| 44 | fn fold_arm(&mut self, i: Arm) -> Arm { |
| 45 | fold_arm(self, i) |
| 46 | } |
| 47 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 48 | fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle { |
| 49 | fold_attr_style(self, i) |
| 50 | } |
| 51 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 52 | fn fold_attribute(&mut self, i: Attribute) -> Attribute { |
| 53 | fold_attribute(self, i) |
| 54 | } |
| 55 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 56 | 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" ))] |
| 60 | fn fold_bin_op(&mut self, i: BinOp) -> BinOp { |
| 61 | fold_bin_op(self, i) |
| 62 | } |
| 63 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 64 | fn fold_binding(&mut self, i: Binding) -> Binding { |
| 65 | fold_binding(self, i) |
| 66 | } |
| 67 | #[cfg (feature = "full" )] |
| 68 | fn fold_block(&mut self, i: Block) -> Block { |
| 69 | fold_block(self, i) |
| 70 | } |
| 71 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 72 | fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes { |
| 73 | fold_bound_lifetimes(self, i) |
| 74 | } |
| 75 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 76 | fn fold_const_param(&mut self, i: ConstParam) -> ConstParam { |
| 77 | fold_const_param(self, i) |
| 78 | } |
| 79 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 80 | fn fold_constraint(&mut self, i: Constraint) -> Constraint { |
| 81 | fold_constraint(self, i) |
| 82 | } |
| 83 | #[cfg (feature = "derive" )] |
| 84 | fn fold_data(&mut self, i: Data) -> Data { |
| 85 | fold_data(self, i) |
| 86 | } |
| 87 | #[cfg (feature = "derive" )] |
| 88 | fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum { |
| 89 | fold_data_enum(self, i) |
| 90 | } |
| 91 | #[cfg (feature = "derive" )] |
| 92 | fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct { |
| 93 | fold_data_struct(self, i) |
| 94 | } |
| 95 | #[cfg (feature = "derive" )] |
| 96 | fn fold_data_union(&mut self, i: DataUnion) -> DataUnion { |
| 97 | fold_data_union(self, i) |
| 98 | } |
| 99 | #[cfg (feature = "derive" )] |
| 100 | fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput { |
| 101 | fold_derive_input(self, i) |
| 102 | } |
| 103 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 104 | fn fold_expr(&mut self, i: Expr) -> Expr { |
| 105 | fold_expr(self, i) |
| 106 | } |
| 107 | #[cfg (feature = "full" )] |
| 108 | fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray { |
| 109 | fold_expr_array(self, i) |
| 110 | } |
| 111 | #[cfg (feature = "full" )] |
| 112 | fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign { |
| 113 | fold_expr_assign(self, i) |
| 114 | } |
| 115 | #[cfg (feature = "full" )] |
| 116 | fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp { |
| 117 | fold_expr_assign_op(self, i) |
| 118 | } |
| 119 | #[cfg (feature = "full" )] |
| 120 | fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync { |
| 121 | fold_expr_async(self, i) |
| 122 | } |
| 123 | #[cfg (feature = "full" )] |
| 124 | fn fold_expr_await(&mut self, i: ExprAwait) -> ExprAwait { |
| 125 | fold_expr_await(self, i) |
| 126 | } |
| 127 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 128 | fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary { |
| 129 | fold_expr_binary(self, i) |
| 130 | } |
| 131 | #[cfg (feature = "full" )] |
| 132 | fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock { |
| 133 | fold_expr_block(self, i) |
| 134 | } |
| 135 | #[cfg (feature = "full" )] |
| 136 | fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox { |
| 137 | fold_expr_box(self, i) |
| 138 | } |
| 139 | #[cfg (feature = "full" )] |
| 140 | fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak { |
| 141 | fold_expr_break(self, i) |
| 142 | } |
| 143 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 144 | fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall { |
| 145 | fold_expr_call(self, i) |
| 146 | } |
| 147 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 148 | fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast { |
| 149 | fold_expr_cast(self, i) |
| 150 | } |
| 151 | #[cfg (feature = "full" )] |
| 152 | fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure { |
| 153 | fold_expr_closure(self, i) |
| 154 | } |
| 155 | #[cfg (feature = "full" )] |
| 156 | fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue { |
| 157 | fold_expr_continue(self, i) |
| 158 | } |
| 159 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 160 | fn fold_expr_field(&mut self, i: ExprField) -> ExprField { |
| 161 | fold_expr_field(self, i) |
| 162 | } |
| 163 | #[cfg (feature = "full" )] |
| 164 | fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop { |
| 165 | fold_expr_for_loop(self, i) |
| 166 | } |
| 167 | #[cfg (feature = "full" )] |
| 168 | fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup { |
| 169 | fold_expr_group(self, i) |
| 170 | } |
| 171 | #[cfg (feature = "full" )] |
| 172 | fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf { |
| 173 | fold_expr_if(self, i) |
| 174 | } |
| 175 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 176 | fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex { |
| 177 | fold_expr_index(self, i) |
| 178 | } |
| 179 | #[cfg (feature = "full" )] |
| 180 | fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet { |
| 181 | fold_expr_let(self, i) |
| 182 | } |
| 183 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 184 | fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit { |
| 185 | fold_expr_lit(self, i) |
| 186 | } |
| 187 | #[cfg (feature = "full" )] |
| 188 | fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop { |
| 189 | fold_expr_loop(self, i) |
| 190 | } |
| 191 | #[cfg (feature = "full" )] |
| 192 | fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro { |
| 193 | fold_expr_macro(self, i) |
| 194 | } |
| 195 | #[cfg (feature = "full" )] |
| 196 | fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch { |
| 197 | fold_expr_match(self, i) |
| 198 | } |
| 199 | #[cfg (feature = "full" )] |
| 200 | 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" ))] |
| 204 | fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen { |
| 205 | fold_expr_paren(self, i) |
| 206 | } |
| 207 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 208 | fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath { |
| 209 | fold_expr_path(self, i) |
| 210 | } |
| 211 | #[cfg (feature = "full" )] |
| 212 | fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange { |
| 213 | fold_expr_range(self, i) |
| 214 | } |
| 215 | #[cfg (feature = "full" )] |
| 216 | fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference { |
| 217 | fold_expr_reference(self, i) |
| 218 | } |
| 219 | #[cfg (feature = "full" )] |
| 220 | fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat { |
| 221 | fold_expr_repeat(self, i) |
| 222 | } |
| 223 | #[cfg (feature = "full" )] |
| 224 | fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn { |
| 225 | fold_expr_return(self, i) |
| 226 | } |
| 227 | #[cfg (feature = "full" )] |
| 228 | fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct { |
| 229 | fold_expr_struct(self, i) |
| 230 | } |
| 231 | #[cfg (feature = "full" )] |
| 232 | fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry { |
| 233 | fold_expr_try(self, i) |
| 234 | } |
| 235 | #[cfg (feature = "full" )] |
| 236 | fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock { |
| 237 | fold_expr_try_block(self, i) |
| 238 | } |
| 239 | #[cfg (feature = "full" )] |
| 240 | fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple { |
| 241 | fold_expr_tuple(self, i) |
| 242 | } |
| 243 | #[cfg (feature = "full" )] |
| 244 | fn fold_expr_type(&mut self, i: ExprType) -> ExprType { |
| 245 | fold_expr_type(self, i) |
| 246 | } |
| 247 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 248 | fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary { |
| 249 | fold_expr_unary(self, i) |
| 250 | } |
| 251 | #[cfg (feature = "full" )] |
| 252 | fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe { |
| 253 | fold_expr_unsafe(self, i) |
| 254 | } |
| 255 | #[cfg (feature = "full" )] |
| 256 | fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile { |
| 257 | fold_expr_while(self, i) |
| 258 | } |
| 259 | #[cfg (feature = "full" )] |
| 260 | fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield { |
| 261 | fold_expr_yield(self, i) |
| 262 | } |
| 263 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 264 | fn fold_field(&mut self, i: Field) -> Field { |
| 265 | fold_field(self, i) |
| 266 | } |
| 267 | #[cfg (feature = "full" )] |
| 268 | fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat { |
| 269 | fold_field_pat(self, i) |
| 270 | } |
| 271 | #[cfg (feature = "full" )] |
| 272 | fn fold_field_value(&mut self, i: FieldValue) -> FieldValue { |
| 273 | fold_field_value(self, i) |
| 274 | } |
| 275 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 276 | fn fold_fields(&mut self, i: Fields) -> Fields { |
| 277 | fold_fields(self, i) |
| 278 | } |
| 279 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 280 | fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed { |
| 281 | fold_fields_named(self, i) |
| 282 | } |
| 283 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 284 | fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed { |
| 285 | fold_fields_unnamed(self, i) |
| 286 | } |
| 287 | #[cfg (feature = "full" )] |
| 288 | fn fold_file(&mut self, i: File) -> File { |
| 289 | fold_file(self, i) |
| 290 | } |
| 291 | #[cfg (feature = "full" )] |
| 292 | fn fold_fn_arg(&mut self, i: FnArg) -> FnArg { |
| 293 | fold_fn_arg(self, i) |
| 294 | } |
| 295 | #[cfg (feature = "full" )] |
| 296 | fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem { |
| 297 | fold_foreign_item(self, i) |
| 298 | } |
| 299 | #[cfg (feature = "full" )] |
| 300 | fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn { |
| 301 | fold_foreign_item_fn(self, i) |
| 302 | } |
| 303 | #[cfg (feature = "full" )] |
| 304 | fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro { |
| 305 | fold_foreign_item_macro(self, i) |
| 306 | } |
| 307 | #[cfg (feature = "full" )] |
| 308 | fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic { |
| 309 | fold_foreign_item_static(self, i) |
| 310 | } |
| 311 | #[cfg (feature = "full" )] |
| 312 | 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" ))] |
| 316 | fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument { |
| 317 | fold_generic_argument(self, i) |
| 318 | } |
| 319 | #[cfg (feature = "full" )] |
| 320 | 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" ))] |
| 327 | fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam { |
| 328 | fold_generic_param(self, i) |
| 329 | } |
| 330 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 331 | fn fold_generics(&mut self, i: Generics) -> Generics { |
| 332 | fold_generics(self, i) |
| 333 | } |
| 334 | fn fold_ident(&mut self, i: Ident) -> Ident { |
| 335 | fold_ident(self, i) |
| 336 | } |
| 337 | #[cfg (feature = "full" )] |
| 338 | fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem { |
| 339 | fold_impl_item(self, i) |
| 340 | } |
| 341 | #[cfg (feature = "full" )] |
| 342 | fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst { |
| 343 | fold_impl_item_const(self, i) |
| 344 | } |
| 345 | #[cfg (feature = "full" )] |
| 346 | fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro { |
| 347 | fold_impl_item_macro(self, i) |
| 348 | } |
| 349 | #[cfg (feature = "full" )] |
| 350 | fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod { |
| 351 | fold_impl_item_method(self, i) |
| 352 | } |
| 353 | #[cfg (feature = "full" )] |
| 354 | 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" ))] |
| 358 | fn fold_index(&mut self, i: Index) -> Index { |
| 359 | fold_index(self, i) |
| 360 | } |
| 361 | #[cfg (feature = "full" )] |
| 362 | fn fold_item(&mut self, i: Item) -> Item { |
| 363 | fold_item(self, i) |
| 364 | } |
| 365 | #[cfg (feature = "full" )] |
| 366 | fn fold_item_const(&mut self, i: ItemConst) -> ItemConst { |
| 367 | fold_item_const(self, i) |
| 368 | } |
| 369 | #[cfg (feature = "full" )] |
| 370 | fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum { |
| 371 | fold_item_enum(self, i) |
| 372 | } |
| 373 | #[cfg (feature = "full" )] |
| 374 | fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate { |
| 375 | fold_item_extern_crate(self, i) |
| 376 | } |
| 377 | #[cfg (feature = "full" )] |
| 378 | fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn { |
| 379 | fold_item_fn(self, i) |
| 380 | } |
| 381 | #[cfg (feature = "full" )] |
| 382 | fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod { |
| 383 | fold_item_foreign_mod(self, i) |
| 384 | } |
| 385 | #[cfg (feature = "full" )] |
| 386 | fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl { |
| 387 | fold_item_impl(self, i) |
| 388 | } |
| 389 | #[cfg (feature = "full" )] |
| 390 | fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro { |
| 391 | fold_item_macro(self, i) |
| 392 | } |
| 393 | #[cfg (feature = "full" )] |
| 394 | fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 { |
| 395 | fold_item_macro2(self, i) |
| 396 | } |
| 397 | #[cfg (feature = "full" )] |
| 398 | fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod { |
| 399 | fold_item_mod(self, i) |
| 400 | } |
| 401 | #[cfg (feature = "full" )] |
| 402 | fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic { |
| 403 | fold_item_static(self, i) |
| 404 | } |
| 405 | #[cfg (feature = "full" )] |
| 406 | fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct { |
| 407 | fold_item_struct(self, i) |
| 408 | } |
| 409 | #[cfg (feature = "full" )] |
| 410 | fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait { |
| 411 | fold_item_trait(self, i) |
| 412 | } |
| 413 | #[cfg (feature = "full" )] |
| 414 | fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias { |
| 415 | fold_item_trait_alias(self, i) |
| 416 | } |
| 417 | #[cfg (feature = "full" )] |
| 418 | fn fold_item_type(&mut self, i: ItemType) -> ItemType { |
| 419 | fold_item_type(self, i) |
| 420 | } |
| 421 | #[cfg (feature = "full" )] |
| 422 | fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion { |
| 423 | fold_item_union(self, i) |
| 424 | } |
| 425 | #[cfg (feature = "full" )] |
| 426 | fn fold_item_use(&mut self, i: ItemUse) -> ItemUse { |
| 427 | fold_item_use(self, i) |
| 428 | } |
| 429 | #[cfg (feature = "full" )] |
| 430 | fn fold_label(&mut self, i: Label) -> Label { |
| 431 | fold_label(self, i) |
| 432 | } |
| 433 | fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime { |
| 434 | fold_lifetime(self, i) |
| 435 | } |
| 436 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 437 | fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef { |
| 438 | fold_lifetime_def(self, i) |
| 439 | } |
| 440 | fn fold_lit(&mut self, i: Lit) -> Lit { |
| 441 | fold_lit(self, i) |
| 442 | } |
| 443 | fn fold_lit_bool(&mut self, i: LitBool) -> LitBool { |
| 444 | fold_lit_bool(self, i) |
| 445 | } |
| 446 | fn fold_lit_byte(&mut self, i: LitByte) -> LitByte { |
| 447 | fold_lit_byte(self, i) |
| 448 | } |
| 449 | fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr { |
| 450 | fold_lit_byte_str(self, i) |
| 451 | } |
| 452 | fn fold_lit_char(&mut self, i: LitChar) -> LitChar { |
| 453 | fold_lit_char(self, i) |
| 454 | } |
| 455 | fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat { |
| 456 | fold_lit_float(self, i) |
| 457 | } |
| 458 | fn fold_lit_int(&mut self, i: LitInt) -> LitInt { |
| 459 | fold_lit_int(self, i) |
| 460 | } |
| 461 | fn fold_lit_str(&mut self, i: LitStr) -> LitStr { |
| 462 | fold_lit_str(self, i) |
| 463 | } |
| 464 | #[cfg (feature = "full" )] |
| 465 | fn fold_local(&mut self, i: Local) -> Local { |
| 466 | fold_local(self, i) |
| 467 | } |
| 468 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 469 | fn fold_macro(&mut self, i: Macro) -> Macro { |
| 470 | fold_macro(self, i) |
| 471 | } |
| 472 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 473 | fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter { |
| 474 | fold_macro_delimiter(self, i) |
| 475 | } |
| 476 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 477 | fn fold_member(&mut self, i: Member) -> Member { |
| 478 | fold_member(self, i) |
| 479 | } |
| 480 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 481 | fn fold_meta(&mut self, i: Meta) -> Meta { |
| 482 | fold_meta(self, i) |
| 483 | } |
| 484 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 485 | fn fold_meta_list(&mut self, i: MetaList) -> MetaList { |
| 486 | fold_meta_list(self, i) |
| 487 | } |
| 488 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 489 | fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue { |
| 490 | fold_meta_name_value(self, i) |
| 491 | } |
| 492 | #[cfg (feature = "full" )] |
| 493 | fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish { |
| 494 | fold_method_turbofish(self, i) |
| 495 | } |
| 496 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 497 | fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta { |
| 498 | fold_nested_meta(self, i) |
| 499 | } |
| 500 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 501 | 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" )] |
| 508 | fn fold_pat(&mut self, i: Pat) -> Pat { |
| 509 | fold_pat(self, i) |
| 510 | } |
| 511 | #[cfg (feature = "full" )] |
| 512 | fn fold_pat_box(&mut self, i: PatBox) -> PatBox { |
| 513 | fold_pat_box(self, i) |
| 514 | } |
| 515 | #[cfg (feature = "full" )] |
| 516 | fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent { |
| 517 | fold_pat_ident(self, i) |
| 518 | } |
| 519 | #[cfg (feature = "full" )] |
| 520 | fn fold_pat_lit(&mut self, i: PatLit) -> PatLit { |
| 521 | fold_pat_lit(self, i) |
| 522 | } |
| 523 | #[cfg (feature = "full" )] |
| 524 | fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro { |
| 525 | fold_pat_macro(self, i) |
| 526 | } |
| 527 | #[cfg (feature = "full" )] |
| 528 | fn fold_pat_or(&mut self, i: PatOr) -> PatOr { |
| 529 | fold_pat_or(self, i) |
| 530 | } |
| 531 | #[cfg (feature = "full" )] |
| 532 | fn fold_pat_path(&mut self, i: PatPath) -> PatPath { |
| 533 | fold_pat_path(self, i) |
| 534 | } |
| 535 | #[cfg (feature = "full" )] |
| 536 | fn fold_pat_range(&mut self, i: PatRange) -> PatRange { |
| 537 | fold_pat_range(self, i) |
| 538 | } |
| 539 | #[cfg (feature = "full" )] |
| 540 | fn fold_pat_reference(&mut self, i: PatReference) -> PatReference { |
| 541 | fold_pat_reference(self, i) |
| 542 | } |
| 543 | #[cfg (feature = "full" )] |
| 544 | fn fold_pat_rest(&mut self, i: PatRest) -> PatRest { |
| 545 | fold_pat_rest(self, i) |
| 546 | } |
| 547 | #[cfg (feature = "full" )] |
| 548 | fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice { |
| 549 | fold_pat_slice(self, i) |
| 550 | } |
| 551 | #[cfg (feature = "full" )] |
| 552 | fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct { |
| 553 | fold_pat_struct(self, i) |
| 554 | } |
| 555 | #[cfg (feature = "full" )] |
| 556 | fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple { |
| 557 | fold_pat_tuple(self, i) |
| 558 | } |
| 559 | #[cfg (feature = "full" )] |
| 560 | fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct { |
| 561 | fold_pat_tuple_struct(self, i) |
| 562 | } |
| 563 | #[cfg (feature = "full" )] |
| 564 | fn fold_pat_type(&mut self, i: PatType) -> PatType { |
| 565 | fold_pat_type(self, i) |
| 566 | } |
| 567 | #[cfg (feature = "full" )] |
| 568 | fn fold_pat_wild(&mut self, i: PatWild) -> PatWild { |
| 569 | fold_pat_wild(self, i) |
| 570 | } |
| 571 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 572 | fn fold_path(&mut self, i: Path) -> Path { |
| 573 | fold_path(self, i) |
| 574 | } |
| 575 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 576 | fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments { |
| 577 | fold_path_arguments(self, i) |
| 578 | } |
| 579 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 580 | fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment { |
| 581 | fold_path_segment(self, i) |
| 582 | } |
| 583 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 584 | fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq { |
| 585 | fold_predicate_eq(self, i) |
| 586 | } |
| 587 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 588 | fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime { |
| 589 | fold_predicate_lifetime(self, i) |
| 590 | } |
| 591 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 592 | fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType { |
| 593 | fold_predicate_type(self, i) |
| 594 | } |
| 595 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 596 | fn fold_qself(&mut self, i: QSelf) -> QSelf { |
| 597 | fold_qself(self, i) |
| 598 | } |
| 599 | #[cfg (feature = "full" )] |
| 600 | fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits { |
| 601 | fold_range_limits(self, i) |
| 602 | } |
| 603 | #[cfg (feature = "full" )] |
| 604 | fn fold_receiver(&mut self, i: Receiver) -> Receiver { |
| 605 | fold_receiver(self, i) |
| 606 | } |
| 607 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 608 | fn fold_return_type(&mut self, i: ReturnType) -> ReturnType { |
| 609 | fold_return_type(self, i) |
| 610 | } |
| 611 | #[cfg (feature = "full" )] |
| 612 | fn fold_signature(&mut self, i: Signature) -> Signature { |
| 613 | fold_signature(self, i) |
| 614 | } |
| 615 | fn fold_span(&mut self, i: Span) -> Span { |
| 616 | fold_span(self, i) |
| 617 | } |
| 618 | #[cfg (feature = "full" )] |
| 619 | fn fold_stmt(&mut self, i: Stmt) -> Stmt { |
| 620 | fold_stmt(self, i) |
| 621 | } |
| 622 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 623 | fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound { |
| 624 | fold_trait_bound(self, i) |
| 625 | } |
| 626 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 627 | 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" )] |
| 634 | fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem { |
| 635 | fold_trait_item(self, i) |
| 636 | } |
| 637 | #[cfg (feature = "full" )] |
| 638 | fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst { |
| 639 | fold_trait_item_const(self, i) |
| 640 | } |
| 641 | #[cfg (feature = "full" )] |
| 642 | fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro { |
| 643 | fold_trait_item_macro(self, i) |
| 644 | } |
| 645 | #[cfg (feature = "full" )] |
| 646 | fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod { |
| 647 | fold_trait_item_method(self, i) |
| 648 | } |
| 649 | #[cfg (feature = "full" )] |
| 650 | 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" ))] |
| 654 | fn fold_type(&mut self, i: Type) -> Type { |
| 655 | fold_type(self, i) |
| 656 | } |
| 657 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 658 | fn fold_type_array(&mut self, i: TypeArray) -> TypeArray { |
| 659 | fold_type_array(self, i) |
| 660 | } |
| 661 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 662 | 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" ))] |
| 666 | fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup { |
| 667 | fold_type_group(self, i) |
| 668 | } |
| 669 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 670 | 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" ))] |
| 674 | fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer { |
| 675 | fold_type_infer(self, i) |
| 676 | } |
| 677 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 678 | fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro { |
| 679 | fold_type_macro(self, i) |
| 680 | } |
| 681 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 682 | fn fold_type_never(&mut self, i: TypeNever) -> TypeNever { |
| 683 | fold_type_never(self, i) |
| 684 | } |
| 685 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 686 | fn fold_type_param(&mut self, i: TypeParam) -> TypeParam { |
| 687 | fold_type_param(self, i) |
| 688 | } |
| 689 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 690 | 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" ))] |
| 694 | fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen { |
| 695 | fold_type_paren(self, i) |
| 696 | } |
| 697 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 698 | fn fold_type_path(&mut self, i: TypePath) -> TypePath { |
| 699 | fold_type_path(self, i) |
| 700 | } |
| 701 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 702 | fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr { |
| 703 | fold_type_ptr(self, i) |
| 704 | } |
| 705 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 706 | fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference { |
| 707 | fold_type_reference(self, i) |
| 708 | } |
| 709 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 710 | fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice { |
| 711 | fold_type_slice(self, i) |
| 712 | } |
| 713 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 714 | 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" ))] |
| 718 | fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple { |
| 719 | fold_type_tuple(self, i) |
| 720 | } |
| 721 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 722 | fn fold_un_op(&mut self, i: UnOp) -> UnOp { |
| 723 | fold_un_op(self, i) |
| 724 | } |
| 725 | #[cfg (feature = "full" )] |
| 726 | fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob { |
| 727 | fold_use_glob(self, i) |
| 728 | } |
| 729 | #[cfg (feature = "full" )] |
| 730 | fn fold_use_group(&mut self, i: UseGroup) -> UseGroup { |
| 731 | fold_use_group(self, i) |
| 732 | } |
| 733 | #[cfg (feature = "full" )] |
| 734 | fn fold_use_name(&mut self, i: UseName) -> UseName { |
| 735 | fold_use_name(self, i) |
| 736 | } |
| 737 | #[cfg (feature = "full" )] |
| 738 | fn fold_use_path(&mut self, i: UsePath) -> UsePath { |
| 739 | fold_use_path(self, i) |
| 740 | } |
| 741 | #[cfg (feature = "full" )] |
| 742 | fn fold_use_rename(&mut self, i: UseRename) -> UseRename { |
| 743 | fold_use_rename(self, i) |
| 744 | } |
| 745 | #[cfg (feature = "full" )] |
| 746 | fn fold_use_tree(&mut self, i: UseTree) -> UseTree { |
| 747 | fold_use_tree(self, i) |
| 748 | } |
| 749 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 750 | fn fold_variadic(&mut self, i: Variadic) -> Variadic { |
| 751 | fold_variadic(self, i) |
| 752 | } |
| 753 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 754 | fn fold_variant(&mut self, i: Variant) -> Variant { |
| 755 | fold_variant(self, i) |
| 756 | } |
| 757 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 758 | fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate { |
| 759 | fold_vis_crate(self, i) |
| 760 | } |
| 761 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 762 | fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic { |
| 763 | fold_vis_public(self, i) |
| 764 | } |
| 765 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 766 | fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted { |
| 767 | fold_vis_restricted(self, i) |
| 768 | } |
| 769 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 770 | fn fold_visibility(&mut self, i: Visibility) -> Visibility { |
| 771 | fold_visibility(self, i) |
| 772 | } |
| 773 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 774 | fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause { |
| 775 | fold_where_clause(self, i) |
| 776 | } |
| 777 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 778 | fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate { |
| 779 | fold_where_predicate(self, i) |
| 780 | } |
| 781 | } |
| 782 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 789 | name: (node.name).map(|it: LitStr| f.fold_lit_str(it)), |
| 790 | } |
| 791 | } |
| 792 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Colon2| Token)), |
| 803 | lt_token: Token), |
| 804 | args: FoldHelper::lift(self:node.args, |it: GenericArgument| f.fold_generic_argument(it)), |
| 805 | gt_token: Token), |
| 806 | } |
| 807 | } |
| 808 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 815 | pat: f.fold_pat(node.pat), |
| 816 | guard: (node.guard) |
| 817 | .map(|it: (If, Box)| ( |
| 818 | Token.0.span)), |
| 819 | Box::new(f.fold_expr(*(it).1)), |
| 820 | )), |
| 821 | fat_arrow_token: Token), |
| 822 | body: Box::new(f.fold_expr(*node.body)), |
| 823 | comma: (node.comma).map(|it: Comma| Token)), |
| 824 | } |
| 825 | } |
| 826 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Bang) => { |
| 834 | AttrStyle::Inner(Token)) |
| 835 | } |
| 836 | } |
| 837 | } |
| 838 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 845 | style: f.fold_attr_style(node.style), |
| 846 | bracket_token: Bracket(span:tokens_helper(folder: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" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 858 | name: (node.name) |
| 859 | .map(|it: (Ident, Colon)| ( |
| 860 | f.fold_ident((it).0), |
| 861 | Token.1.spans)), |
| 862 | )), |
| 863 | ty: f.fold_type(node.ty), |
| 864 | } |
| 865 | } |
| 866 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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)) |
| 874 | } |
| 875 | BinOp::Sub(_binding_0) => { |
| 876 | BinOp::Sub(Token)) |
| 877 | } |
| 878 | BinOp::Mul(_binding_0) => { |
| 879 | BinOp::Mul(Token)) |
| 880 | } |
| 881 | BinOp::Div(_binding_0) => { |
| 882 | BinOp::Div(Token)) |
| 883 | } |
| 884 | BinOp::Rem(_binding_0) => { |
| 885 | BinOp::Rem(Token)) |
| 886 | } |
| 887 | BinOp::And(_binding_0) => { |
| 888 | BinOp::And(Token)) |
| 889 | } |
| 890 | BinOp::Or(_binding_0) => { |
| 891 | BinOp::Or(Token)) |
| 892 | } |
| 893 | BinOp::BitXor(_binding_0) => { |
| 894 | BinOp::BitXor(Token)) |
| 895 | } |
| 896 | BinOp::BitAnd(_binding_0) => { |
| 897 | BinOp::BitAnd(Token)) |
| 898 | } |
| 899 | BinOp::BitOr(_binding_0) => { |
| 900 | BinOp::BitOr(Token)) |
| 901 | } |
| 902 | BinOp::Shl(_binding_0) => { |
| 903 | BinOp::Shl(Token)) |
| 904 | } |
| 905 | BinOp::Shr(_binding_0) => { |
| 906 | BinOp::Shr(Token)) |
| 907 | } |
| 908 | BinOp::Eq(_binding_0) => { |
| 909 | BinOp::Eq(Token)) |
| 910 | } |
| 911 | BinOp::Lt(_binding_0) => { |
| 912 | BinOp::Lt(Token)) |
| 913 | } |
| 914 | BinOp::Le(_binding_0) => { |
| 915 | BinOp::Le(Token)) |
| 916 | } |
| 917 | BinOp::Ne(_binding_0) => { |
| 918 | BinOp::Ne(Token)) |
| 919 | } |
| 920 | BinOp::Ge(_binding_0) => { |
| 921 | BinOp::Ge(Token)) |
| 922 | } |
| 923 | BinOp::Gt(_binding_0) => { |
| 924 | BinOp::Gt(Token)) |
| 925 | } |
| 926 | BinOp::AddEq(_binding_0) => { |
| 927 | BinOp::AddEq(Token)) |
| 928 | } |
| 929 | BinOp::SubEq(_binding_0) => { |
| 930 | BinOp::SubEq(Token)) |
| 931 | } |
| 932 | BinOp::MulEq(_binding_0) => { |
| 933 | BinOp::MulEq(Token)) |
| 934 | } |
| 935 | BinOp::DivEq(_binding_0) => { |
| 936 | BinOp::DivEq(Token)) |
| 937 | } |
| 938 | BinOp::RemEq(_binding_0) => { |
| 939 | BinOp::RemEq(Token)) |
| 940 | } |
| 941 | BinOp::BitXorEq(_binding_0) => { |
| 942 | BinOp::BitXorEq(Token)) |
| 943 | } |
| 944 | BinOp::BitAndEq(_binding_0) => { |
| 945 | BinOp::BitAndEq(Token)) |
| 946 | } |
| 947 | BinOp::BitOrEq(_binding_0) => { |
| 948 | BinOp::BitOrEq(Token)) |
| 949 | } |
| 950 | BinOp::ShlEq(_binding_0) => { |
| 951 | BinOp::ShlEq(Token)) |
| 952 | } |
| 953 | BinOp::ShrEq(_binding_0) => { |
| 954 | BinOp::ShrEq(Token)) |
| 955 | } |
| 956 | } |
| 957 | } |
| 958 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 966 | ty: f.fold_type(node.ty), |
| 967 | } |
| 968 | } |
| 969 | #[cfg (feature = "full" )] |
| 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(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 976 | stmts: FoldHelper::lift(self:node.stmts, |it: Stmt| f.fold_stmt(it)), |
| 977 | } |
| 978 | } |
| 979 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 986 | lt_token: Token), |
| 987 | lifetimes: FoldHelper::lift(self:node.lifetimes, |it: LifetimeDef| f.fold_lifetime_def(it)), |
| 988 | gt_token: Token), |
| 989 | } |
| 990 | } |
| 991 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 998 | const_token: Token), |
| 999 | ident: f.fold_ident(node.ident), |
| 1000 | colon_token: Token), |
| 1001 | ty: f.fold_type(node.ty), |
| 1002 | eq_token: (node.eq_token).map(|it: Eq| Token)), |
| 1003 | default: (node.default).map(|it: Expr| f.fold_expr(it)), |
| 1004 | } |
| 1005 | } |
| 1006 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 1014 | bounds: FoldHelper::lift(self:node.bounds, |it: TypeParamBound| f.fold_type_param_bound(it)), |
| 1015 | } |
| 1016 | } |
| 1017 | #[cfg (feature = "derive" )] |
| 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: DataStruct) => Data::Struct(f.fold_data_struct(_binding_0)), |
| 1024 | Data::Enum(_binding_0: DataEnum) => Data::Enum(f.fold_data_enum(_binding_0)), |
| 1025 | Data::Union(_binding_0: DataUnion) => Data::Union(f.fold_data_union(_binding_0)), |
| 1026 | } |
| 1027 | } |
| 1028 | #[cfg (feature = "derive" )] |
| 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), |
| 1035 | brace_token: Brace(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 1036 | variants: FoldHelper::lift(self:node.variants, |it: Variant| f.fold_variant(it)), |
| 1037 | } |
| 1038 | } |
| 1039 | #[cfg (feature = "derive" )] |
| 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), |
| 1046 | fields: f.fold_fields(node.fields), |
| 1047 | semi_token: (node.semi_token).map(|it: Semi| Token)), |
| 1048 | } |
| 1049 | } |
| 1050 | #[cfg (feature = "derive" )] |
| 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), |
| 1057 | fields: f.fold_fields_named(node.fields), |
| 1058 | } |
| 1059 | } |
| 1060 | #[cfg (feature = "derive" )] |
| 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(self:node.attrs, |it: Attribute| 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" ))] |
| 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" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1144 | bracket_token: Bracket(span:tokens_helper(folder:f, &node.bracket_token.span)), |
| 1145 | elems: FoldHelper::lift(self:node.elems, |it: Expr| f.fold_expr(it)), |
| 1146 | } |
| 1147 | } |
| 1148 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1155 | left: Box::new(f.fold_expr(*node.left)), |
| 1156 | eq_token: Token), |
| 1157 | right: Box::new(f.fold_expr(*node.right)), |
| 1158 | } |
| 1159 | } |
| 1160 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| 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" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1179 | async_token: Token), |
| 1180 | capture: (node.capture).map(|it: Move| Token)), |
| 1181 | block: f.fold_block(node.block), |
| 1182 | } |
| 1183 | } |
| 1184 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1191 | base: Box::new(f.fold_expr(*node.base)), |
| 1192 | dot_token: Token), |
| 1193 | await_token: crate::token::Await(span:tokens_helper(folder:f, &node.await_token.span)), |
| 1194 | } |
| 1195 | } |
| 1196 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| 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" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1215 | label: (node.label).map(|it: Label| f.fold_label(it)), |
| 1216 | block: f.fold_block(node.block), |
| 1217 | } |
| 1218 | } |
| 1219 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1226 | box_token: Token), |
| 1227 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1228 | } |
| 1229 | } |
| 1230 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1237 | break_token: Token), |
| 1238 | label: (node.label).map(|it: Lifetime| f.fold_lifetime(it)), |
| 1239 | expr: (node.expr).map(|it: Box| Box::new(f.fold_expr(*it))), |
| 1240 | } |
| 1241 | } |
| 1242 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1249 | func: Box::new(f.fold_expr(*node.func)), |
| 1250 | paren_token: Paren(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 1251 | args: FoldHelper::lift(self:node.args, |it: Expr| f.fold_expr(it)), |
| 1252 | } |
| 1253 | } |
| 1254 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1261 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1262 | as_token: Token), |
| 1263 | ty: Box::new(f.fold_type(*node.ty)), |
| 1264 | } |
| 1265 | } |
| 1266 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1273 | movability: (node.movability) |
| 1274 | .map(|it: Static| Token)), |
| 1275 | asyncness: (node.asyncness).map(|it: Async| Token)), |
| 1276 | capture: (node.capture).map(|it: Move| Token)), |
| 1277 | or1_token: Token), |
| 1278 | inputs: FoldHelper::lift(self:node.inputs, |it: Pat| f.fold_pat(it)), |
| 1279 | or2_token: Token), |
| 1280 | output: f.fold_return_type(node.output), |
| 1281 | body: Box::new(f.fold_expr(*node.body)), |
| 1282 | } |
| 1283 | } |
| 1284 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1291 | continue_token: Token), |
| 1292 | label: (node.label).map(|it: Lifetime| f.fold_lifetime(it)), |
| 1293 | } |
| 1294 | } |
| 1295 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1302 | base: Box::new(f.fold_expr(*node.base)), |
| 1303 | dot_token: Token), |
| 1304 | member: f.fold_member(node.member), |
| 1305 | } |
| 1306 | } |
| 1307 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1314 | label: (node.label).map(|it: Label| f.fold_label(it)), |
| 1315 | for_token: Token), |
| 1316 | pat: f.fold_pat(node.pat), |
| 1317 | in_token: Token), |
| 1318 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1319 | body: f.fold_block(node.body), |
| 1320 | } |
| 1321 | } |
| 1322 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1329 | group_token: Group(span:tokens_helper(folder:f, &node.group_token.span)), |
| 1330 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1331 | } |
| 1332 | } |
| 1333 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1340 | if_token: Token), |
| 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: (Else, Box)| ( |
| 1345 | Token.0.span)), |
| 1346 | Box::new(f.fold_expr(*(it).1)), |
| 1347 | )), |
| 1348 | } |
| 1349 | } |
| 1350 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1357 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1358 | bracket_token: Bracket(span:tokens_helper(folder:f, &node.bracket_token.span)), |
| 1359 | index: Box::new(f.fold_expr(*node.index)), |
| 1360 | } |
| 1361 | } |
| 1362 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1369 | let_token: Token), |
| 1370 | pat: f.fold_pat(node.pat), |
| 1371 | eq_token: Token), |
| 1372 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1373 | } |
| 1374 | } |
| 1375 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1382 | lit: f.fold_lit(node.lit), |
| 1383 | } |
| 1384 | } |
| 1385 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1392 | label: (node.label).map(|it: Label| f.fold_label(it)), |
| 1393 | loop_token: Token), |
| 1394 | body: f.fold_block(node.body), |
| 1395 | } |
| 1396 | } |
| 1397 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1404 | mac: f.fold_macro(node.mac), |
| 1405 | } |
| 1406 | } |
| 1407 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1414 | match_token: Token), |
| 1415 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1416 | brace_token: Brace(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 1417 | arms: FoldHelper::lift(self:node.arms, |it: Arm| f.fold_arm(it)), |
| 1418 | } |
| 1419 | } |
| 1420 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1427 | receiver: Box::new(f.fold_expr(*node.receiver)), |
| 1428 | dot_token: Token), |
| 1429 | method: f.fold_ident(node.method), |
| 1430 | turbofish: (node.turbofish).map(|it: MethodTurbofish| f.fold_method_turbofish(it)), |
| 1431 | paren_token: Paren(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 1432 | args: FoldHelper::lift(self:node.args, |it: Expr| f.fold_expr(it)), |
| 1433 | } |
| 1434 | } |
| 1435 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1442 | paren_token: Paren(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 1443 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1444 | } |
| 1445 | } |
| 1446 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1453 | qself: (node.qself).map(|it: QSelf| f.fold_qself(it)), |
| 1454 | path: f.fold_path(node.path), |
| 1455 | } |
| 1456 | } |
| 1457 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1464 | from: (node.from).map(|it: Box| Box::new(f.fold_expr(*it))), |
| 1465 | limits: f.fold_range_limits(node.limits), |
| 1466 | to: (node.to).map(|it: Box| Box::new(f.fold_expr(*it))), |
| 1467 | } |
| 1468 | } |
| 1469 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1476 | and_token: Token), |
| 1477 | raw: node.raw, |
| 1478 | mutability: (node.mutability).map(|it: Mut| Token)), |
| 1479 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1480 | } |
| 1481 | } |
| 1482 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1489 | bracket_token: Bracket(span:tokens_helper(folder:f, &node.bracket_token.span)), |
| 1490 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1491 | semi_token: Token), |
| 1492 | len: Box::new(f.fold_expr(*node.len)), |
| 1493 | } |
| 1494 | } |
| 1495 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1502 | return_token: Token), |
| 1503 | expr: (node.expr).map(|it: Box| Box::new(f.fold_expr(*it))), |
| 1504 | } |
| 1505 | } |
| 1506 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1513 | path: f.fold_path(node.path), |
| 1514 | brace_token: Brace(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 1515 | fields: FoldHelper::lift(self:node.fields, |it: FieldValue| f.fold_field_value(it)), |
| 1516 | dot2_token: (node.dot2_token).map(|it: Dot2| Token)), |
| 1517 | rest: (node.rest).map(|it: Box| Box::new(f.fold_expr(*it))), |
| 1518 | } |
| 1519 | } |
| 1520 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1527 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1528 | question_token: Token), |
| 1529 | } |
| 1530 | } |
| 1531 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1538 | try_token: Token), |
| 1539 | block: f.fold_block(node.block), |
| 1540 | } |
| 1541 | } |
| 1542 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1549 | paren_token: Paren(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 1550 | elems: FoldHelper::lift(self:node.elems, |it: Expr| f.fold_expr(it)), |
| 1551 | } |
| 1552 | } |
| 1553 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1560 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1561 | colon_token: Token), |
| 1562 | ty: Box::new(f.fold_type(*node.ty)), |
| 1563 | } |
| 1564 | } |
| 1565 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| 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" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1583 | unsafe_token: Token), |
| 1584 | block: f.fold_block(node.block), |
| 1585 | } |
| 1586 | } |
| 1587 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1594 | label: (node.label).map(|it: Label| f.fold_label(it)), |
| 1595 | while_token: Token), |
| 1596 | cond: Box::new(f.fold_expr(*node.cond)), |
| 1597 | body: f.fold_block(node.body), |
| 1598 | } |
| 1599 | } |
| 1600 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1607 | yield_token: Token), |
| 1608 | expr: (node.expr).map(|it: Box| Box::new(f.fold_expr(*it))), |
| 1609 | } |
| 1610 | } |
| 1611 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1618 | vis: f.fold_visibility(node.vis), |
| 1619 | ident: (node.ident).map(|it: Ident| f.fold_ident(it)), |
| 1620 | colon_token: (node.colon_token).map(|it: Colon| Token)), |
| 1621 | ty: f.fold_type(node.ty), |
| 1622 | } |
| 1623 | } |
| 1624 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1631 | member: f.fold_member(node.member), |
| 1632 | colon_token: (node.colon_token).map(|it: Colon| Token)), |
| 1633 | pat: Box::new(f.fold_pat(*node.pat)), |
| 1634 | } |
| 1635 | } |
| 1636 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1643 | member: f.fold_member(node.member), |
| 1644 | colon_token: (node.colon_token).map(|it: Colon| Token)), |
| 1645 | expr: f.fold_expr(node.expr), |
| 1646 | } |
| 1647 | } |
| 1648 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: FieldsNamed) => Fields::Named(f.fold_fields_named(_binding_0)), |
| 1655 | Fields::Unnamed(_binding_0: FieldsUnnamed) => Fields::Unnamed(f.fold_fields_unnamed(_binding_0)), |
| 1656 | Fields::Unit => Fields::Unit, |
| 1657 | } |
| 1658 | } |
| 1659 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 1666 | named: FoldHelper::lift(self:node.named, |it: Field| f.fold_field(it)), |
| 1667 | } |
| 1668 | } |
| 1669 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 1676 | unnamed: FoldHelper::lift(self:node.unnamed, |it: Field| f.fold_field(it)), |
| 1677 | } |
| 1678 | } |
| 1679 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1687 | items: FoldHelper::lift(self:node.items, |it: Item| f.fold_item(it)), |
| 1688 | } |
| 1689 | } |
| 1690 | #[cfg (feature = "full" )] |
| 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: Receiver) => FnArg::Receiver(f.fold_receiver(_binding_0)), |
| 1697 | FnArg::Typed(_binding_0: PatType) => FnArg::Typed(f.fold_pat_type(_binding_0)), |
| 1698 | } |
| 1699 | } |
| 1700 | #[cfg (feature = "full" )] |
| 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: ForeignItemFn) => { |
| 1707 | ForeignItem::Fn(f.fold_foreign_item_fn(_binding_0)) |
| 1708 | } |
| 1709 | ForeignItem::Static(_binding_0: ForeignItemStatic) => { |
| 1710 | ForeignItem::Static(f.fold_foreign_item_static(_binding_0)) |
| 1711 | } |
| 1712 | ForeignItem::Type(_binding_0: ForeignItemType) => { |
| 1713 | ForeignItem::Type(f.fold_foreign_item_type(_binding_0)) |
| 1714 | } |
| 1715 | ForeignItem::Macro(_binding_0: ForeignItemMacro) => { |
| 1716 | ForeignItem::Macro(f.fold_foreign_item_macro(_binding_0)) |
| 1717 | } |
| 1718 | ForeignItem::Verbatim(_binding_0: TokenStream) => ForeignItem::Verbatim(_binding_0), |
| 1719 | #[cfg (syn_no_non_exhaustive)] |
| 1720 | _ => unreachable!(), |
| 1721 | } |
| 1722 | } |
| 1723 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1730 | vis: f.fold_visibility(node.vis), |
| 1731 | sig: f.fold_signature(node.sig), |
| 1732 | semi_token: Token), |
| 1733 | } |
| 1734 | } |
| 1735 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1742 | mac: f.fold_macro(node.mac), |
| 1743 | semi_token: (node.semi_token).map(|it: Semi| Token)), |
| 1744 | } |
| 1745 | } |
| 1746 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1756 | vis: f.fold_visibility(node.vis), |
| 1757 | static_token: Token), |
| 1758 | mutability: (node.mutability).map(|it: Mut| Token)), |
| 1759 | ident: f.fold_ident(node.ident), |
| 1760 | colon_token: Token), |
| 1761 | ty: Box::new(f.fold_type(*node.ty)), |
| 1762 | semi_token: Token), |
| 1763 | } |
| 1764 | } |
| 1765 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1772 | vis: f.fold_visibility(node.vis), |
| 1773 | type_token: Token), |
| 1774 | ident: f.fold_ident(node.ident), |
| 1775 | semi_token: Token), |
| 1776 | } |
| 1777 | } |
| 1778 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Lifetime) => { |
| 1785 | GenericArgument::Lifetime(f.fold_lifetime(_binding_0)) |
| 1786 | } |
| 1787 | GenericArgument::Type(_binding_0: Type) => { |
| 1788 | GenericArgument::Type(f.fold_type(_binding_0)) |
| 1789 | } |
| 1790 | GenericArgument::Const(_binding_0: Expr) => { |
| 1791 | GenericArgument::Const(f.fold_expr(_binding_0)) |
| 1792 | } |
| 1793 | GenericArgument::Binding(_binding_0: Binding) => { |
| 1794 | GenericArgument::Binding(f.fold_binding(_binding_0)) |
| 1795 | } |
| 1796 | GenericArgument::Constraint(_binding_0: Constraint) => { |
| 1797 | GenericArgument::Constraint(f.fold_constraint(_binding_0)) |
| 1798 | } |
| 1799 | } |
| 1800 | } |
| 1801 | #[cfg (feature = "full" )] |
| 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: Type) => { |
| 1811 | GenericMethodArgument::Type(f.fold_type(_binding_0)) |
| 1812 | } |
| 1813 | GenericMethodArgument::Const(_binding_0: Expr) => { |
| 1814 | GenericMethodArgument::Const(f.fold_expr(_binding_0)) |
| 1815 | } |
| 1816 | } |
| 1817 | } |
| 1818 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: TypeParam) => { |
| 1825 | GenericParam::Type(f.fold_type_param(_binding_0)) |
| 1826 | } |
| 1827 | GenericParam::Lifetime(_binding_0: LifetimeDef) => { |
| 1828 | GenericParam::Lifetime(f.fold_lifetime_def(_binding_0)) |
| 1829 | } |
| 1830 | GenericParam::Const(_binding_0: ConstParam) => { |
| 1831 | GenericParam::Const(f.fold_const_param(_binding_0)) |
| 1832 | } |
| 1833 | } |
| 1834 | } |
| 1835 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Lt| Token)), |
| 1842 | params: FoldHelper::lift(self:node.params, |it: GenericParam| f.fold_generic_param(it)), |
| 1843 | gt_token: (node.gt_token).map(|it: Gt| Token)), |
| 1844 | where_clause: (node.where_clause).map(|it: WhereClause| f.fold_where_clause(it)), |
| 1845 | } |
| 1846 | } |
| 1847 | pub fn fold_ident<F>(f: &mut F, node: Ident) -> Ident |
| 1848 | where |
| 1849 | F: Fold + ?Sized, |
| 1850 | { |
| 1851 | let mut node: Ident = node; |
| 1852 | let span: Span = f.fold_span(node.span()); |
| 1853 | node.set_span(span); |
| 1854 | node |
| 1855 | } |
| 1856 | #[cfg (feature = "full" )] |
| 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: ImplItemConst) => { |
| 1863 | ImplItem::Const(f.fold_impl_item_const(_binding_0)) |
| 1864 | } |
| 1865 | ImplItem::Method(_binding_0: ImplItemMethod) => { |
| 1866 | ImplItem::Method(f.fold_impl_item_method(_binding_0)) |
| 1867 | } |
| 1868 | ImplItem::Type(_binding_0: ImplItemType) => ImplItem::Type(f.fold_impl_item_type(_binding_0)), |
| 1869 | ImplItem::Macro(_binding_0: ImplItemMacro) => { |
| 1870 | ImplItem::Macro(f.fold_impl_item_macro(_binding_0)) |
| 1871 | } |
| 1872 | ImplItem::Verbatim(_binding_0: TokenStream) => ImplItem::Verbatim(_binding_0), |
| 1873 | #[cfg (syn_no_non_exhaustive)] |
| 1874 | _ => unreachable!(), |
| 1875 | } |
| 1876 | } |
| 1877 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1884 | vis: f.fold_visibility(node.vis), |
| 1885 | defaultness: (node.defaultness) |
| 1886 | .map(|it: Default| Token)), |
| 1887 | const_token: Token), |
| 1888 | ident: f.fold_ident(node.ident), |
| 1889 | colon_token: Token), |
| 1890 | ty: f.fold_type(node.ty), |
| 1891 | eq_token: Token), |
| 1892 | expr: f.fold_expr(node.expr), |
| 1893 | semi_token: Token), |
| 1894 | } |
| 1895 | } |
| 1896 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1903 | mac: f.fold_macro(node.mac), |
| 1904 | semi_token: (node.semi_token).map(|it: Semi| Token)), |
| 1905 | } |
| 1906 | } |
| 1907 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1914 | vis: f.fold_visibility(node.vis), |
| 1915 | defaultness: (node.defaultness) |
| 1916 | .map(|it: Default| Token)), |
| 1917 | sig: f.fold_signature(node.sig), |
| 1918 | block: f.fold_block(node.block), |
| 1919 | } |
| 1920 | } |
| 1921 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1928 | vis: f.fold_visibility(node.vis), |
| 1929 | defaultness: (node.defaultness) |
| 1930 | .map(|it: Default| Token)), |
| 1931 | type_token: Token), |
| 1932 | ident: f.fold_ident(node.ident), |
| 1933 | generics: f.fold_generics(node.generics), |
| 1934 | eq_token: Token), |
| 1935 | ty: f.fold_type(node.ty), |
| 1936 | semi_token: Token), |
| 1937 | } |
| 1938 | } |
| 1939 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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" )] |
| 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" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 1989 | vis: f.fold_visibility(node.vis), |
| 1990 | const_token: Token), |
| 1991 | ident: f.fold_ident(node.ident), |
| 1992 | colon_token: Token), |
| 1993 | ty: Box::new(f.fold_type(*node.ty)), |
| 1994 | eq_token: Token), |
| 1995 | expr: Box::new(f.fold_expr(*node.expr)), |
| 1996 | semi_token: Token), |
| 1997 | } |
| 1998 | } |
| 1999 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2006 | vis: f.fold_visibility(node.vis), |
| 2007 | enum_token: Token), |
| 2008 | ident: f.fold_ident(node.ident), |
| 2009 | generics: f.fold_generics(node.generics), |
| 2010 | brace_token: Brace(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 2011 | variants: FoldHelper::lift(self:node.variants, |it: Variant| f.fold_variant(it)), |
| 2012 | } |
| 2013 | } |
| 2014 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2021 | vis: f.fold_visibility(node.vis), |
| 2022 | extern_token: Token), |
| 2023 | crate_token: Token), |
| 2024 | ident: f.fold_ident(node.ident), |
| 2025 | rename: (node.rename) |
| 2026 | .map(|it: (As, Ident)| ( |
| 2027 | Token.0.span)), |
| 2028 | f.fold_ident((it).1), |
| 2029 | )), |
| 2030 | semi_token: Token), |
| 2031 | } |
| 2032 | } |
| 2033 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| 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" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2052 | abi: f.fold_abi(node.abi), |
| 2053 | brace_token: Brace(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 2054 | items: FoldHelper::lift(self:node.items, |it: ForeignItem| f.fold_foreign_item(it)), |
| 2055 | } |
| 2056 | } |
| 2057 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2064 | defaultness: (node.defaultness) |
| 2065 | .map(|it: Default| Token)), |
| 2066 | unsafety: (node.unsafety).map(|it: Unsafe| Token)), |
| 2067 | impl_token: Token), |
| 2068 | generics: f.fold_generics(node.generics), |
| 2069 | trait_: (node.trait_) |
| 2070 | .map(|it: (Option, Path, For)| ( |
| 2071 | ((it).0).map(|it: Bang| Token)), |
| 2072 | f.fold_path((it).1), |
| 2073 | Token.2.span)), |
| 2074 | )), |
| 2075 | self_ty: Box::new(f.fold_type(*node.self_ty)), |
| 2076 | brace_token: Brace(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 2077 | items: FoldHelper::lift(self:node.items, |it: ImplItem| f.fold_impl_item(it)), |
| 2078 | } |
| 2079 | } |
| 2080 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2087 | ident: (node.ident).map(|it: Ident| f.fold_ident(it)), |
| 2088 | mac: f.fold_macro(node.mac), |
| 2089 | semi_token: (node.semi_token).map(|it: Semi| Token)), |
| 2090 | } |
| 2091 | } |
| 2092 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2099 | vis: f.fold_visibility(node.vis), |
| 2100 | macro_token: Token), |
| 2101 | ident: f.fold_ident(node.ident), |
| 2102 | rules: node.rules, |
| 2103 | } |
| 2104 | } |
| 2105 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2112 | vis: f.fold_visibility(node.vis), |
| 2113 | mod_token: Token), |
| 2114 | ident: f.fold_ident(node.ident), |
| 2115 | content: (node.content) |
| 2116 | .map(|it: (Brace, Vec- )
| ( |
| 2117 | Brace(span:tokens_helper(folder:f, &(it).0.span)), |
| 2118 | FoldHelper::lift((it).1, |it: Item| f.fold_item(it)), |
| 2119 | )), |
| 2120 | semi: (node.semi).map(|it: Semi| Token)), |
| 2121 | } |
| 2122 | } |
| 2123 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2130 | vis: f.fold_visibility(node.vis), |
| 2131 | static_token: Token), |
| 2132 | mutability: (node.mutability).map(|it: Mut| Token)), |
| 2133 | ident: f.fold_ident(node.ident), |
| 2134 | colon_token: Token), |
| 2135 | ty: Box::new(f.fold_type(*node.ty)), |
| 2136 | eq_token: Token), |
| 2137 | expr: Box::new(f.fold_expr(*node.expr)), |
| 2138 | semi_token: Token), |
| 2139 | } |
| 2140 | } |
| 2141 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2148 | vis: f.fold_visibility(node.vis), |
| 2149 | struct_token: Token), |
| 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: Semi| Token)), |
| 2154 | } |
| 2155 | } |
| 2156 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2163 | vis: f.fold_visibility(node.vis), |
| 2164 | unsafety: (node.unsafety).map(|it: Unsafe| Token)), |
| 2165 | auto_token: (node.auto_token).map(|it: Auto| Token)), |
| 2166 | trait_token: Token), |
| 2167 | ident: f.fold_ident(node.ident), |
| 2168 | generics: f.fold_generics(node.generics), |
| 2169 | colon_token: (node.colon_token).map(|it: Colon| Token)), |
| 2170 | supertraits: FoldHelper::lift( |
| 2171 | self:node.supertraits, |
| 2172 | |it: TypeParamBound| f.fold_type_param_bound(it), |
| 2173 | ), |
| 2174 | brace_token: Brace(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 2175 | items: FoldHelper::lift(self:node.items, |it: TraitItem| f.fold_trait_item(it)), |
| 2176 | } |
| 2177 | } |
| 2178 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2185 | vis: f.fold_visibility(node.vis), |
| 2186 | trait_token: Token), |
| 2187 | ident: f.fold_ident(node.ident), |
| 2188 | generics: f.fold_generics(node.generics), |
| 2189 | eq_token: Token), |
| 2190 | bounds: FoldHelper::lift(self:node.bounds, |it: TypeParamBound| f.fold_type_param_bound(it)), |
| 2191 | semi_token: Token), |
| 2192 | } |
| 2193 | } |
| 2194 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2201 | vis: f.fold_visibility(node.vis), |
| 2202 | type_token: Token), |
| 2203 | ident: f.fold_ident(node.ident), |
| 2204 | generics: f.fold_generics(node.generics), |
| 2205 | eq_token: Token), |
| 2206 | ty: Box::new(f.fold_type(*node.ty)), |
| 2207 | semi_token: Token), |
| 2208 | } |
| 2209 | } |
| 2210 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2217 | vis: f.fold_visibility(node.vis), |
| 2218 | union_token: Token), |
| 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" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2231 | vis: f.fold_visibility(node.vis), |
| 2232 | use_token: Token), |
| 2233 | leading_colon: (node.leading_colon) |
| 2234 | .map(|it: Colon2| Token)), |
| 2235 | tree: f.fold_use_tree(node.tree), |
| 2236 | semi_token: Token), |
| 2237 | } |
| 2238 | } |
| 2239 | #[cfg (feature = "full" )] |
| 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), |
| 2247 | } |
| 2248 | } |
| 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" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2265 | lifetime: f.fold_lifetime(node.lifetime), |
| 2266 | colon_token: (node.colon_token).map(|it: Colon| Token)), |
| 2267 | bounds: FoldHelper::lift(self:node.bounds, |it: Lifetime| f.fold_lifetime(it)), |
| 2268 | } |
| 2269 | } |
| 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: LitStr) => Lit::Str(f.fold_lit_str(_binding_0)), |
| 2276 | Lit::ByteStr(_binding_0: LitByteStr) => Lit::ByteStr(f.fold_lit_byte_str(_binding_0)), |
| 2277 | Lit::Byte(_binding_0: LitByte) => Lit::Byte(f.fold_lit_byte(_binding_0)), |
| 2278 | Lit::Char(_binding_0: LitChar) => Lit::Char(f.fold_lit_char(_binding_0)), |
| 2279 | Lit::Int(_binding_0: LitInt) => Lit::Int(f.fold_lit_int(_binding_0)), |
| 2280 | Lit::Float(_binding_0: LitFloat) => Lit::Float(f.fold_lit_float(_binding_0)), |
| 2281 | Lit::Bool(_binding_0: LitBool) => Lit::Bool(f.fold_lit_bool(_binding_0)), |
| 2282 | Lit::Verbatim(_binding_0: Literal) => Lit::Verbatim(_binding_0), |
| 2283 | } |
| 2284 | } |
| 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 | } |
| 2294 | pub fn fold_lit_byte<F>(f: &mut F, node: LitByte) -> LitByte |
| 2295 | where |
| 2296 | F: Fold + ?Sized, |
| 2297 | { |
| 2298 | let span: Span = f.fold_span(node.span()); |
| 2299 | let mut node: LitByte = node; |
| 2300 | node.set_span(span); |
| 2301 | node |
| 2302 | } |
| 2303 | pub fn fold_lit_byte_str<F>(f: &mut F, node: LitByteStr) -> LitByteStr |
| 2304 | where |
| 2305 | F: Fold + ?Sized, |
| 2306 | { |
| 2307 | let span: Span = f.fold_span(node.span()); |
| 2308 | let mut node: LitByteStr = node; |
| 2309 | node.set_span(span); |
| 2310 | node |
| 2311 | } |
| 2312 | pub fn fold_lit_char<F>(f: &mut F, node: LitChar) -> LitChar |
| 2313 | where |
| 2314 | F: Fold + ?Sized, |
| 2315 | { |
| 2316 | let span: Span = f.fold_span(node.span()); |
| 2317 | let mut node: LitChar = node; |
| 2318 | node.set_span(span); |
| 2319 | node |
| 2320 | } |
| 2321 | pub fn fold_lit_float<F>(f: &mut F, node: LitFloat) -> LitFloat |
| 2322 | where |
| 2323 | F: Fold + ?Sized, |
| 2324 | { |
| 2325 | let span: Span = f.fold_span(node.span()); |
| 2326 | let mut node: LitFloat = node; |
| 2327 | node.set_span(span); |
| 2328 | node |
| 2329 | } |
| 2330 | pub fn fold_lit_int<F>(f: &mut F, node: LitInt) -> LitInt |
| 2331 | where |
| 2332 | F: Fold + ?Sized, |
| 2333 | { |
| 2334 | let span: Span = f.fold_span(node.span()); |
| 2335 | let mut node: LitInt = node; |
| 2336 | node.set_span(span); |
| 2337 | node |
| 2338 | } |
| 2339 | pub fn fold_lit_str<F>(f: &mut F, node: LitStr) -> LitStr |
| 2340 | where |
| 2341 | F: Fold + ?Sized, |
| 2342 | { |
| 2343 | let span: Span = f.fold_span(node.span()); |
| 2344 | let mut node: LitStr = node; |
| 2345 | node.set_span(span); |
| 2346 | node |
| 2347 | } |
| 2348 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2355 | let_token: Token), |
| 2356 | pat: f.fold_pat(node.pat), |
| 2357 | init: (node.init) |
| 2358 | .map(|it: (Eq, Box)| ( |
| 2359 | Token.0.spans)), |
| 2360 | Box::new(f.fold_expr(*(it).1)), |
| 2361 | )), |
| 2362 | semi_token: Token), |
| 2363 | } |
| 2364 | } |
| 2365 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 2373 | delimiter: f.fold_macro_delimiter(node.delimiter), |
| 2374 | tokens: node.tokens, |
| 2375 | } |
| 2376 | } |
| 2377 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Paren) => { |
| 2384 | MacroDelimiter::Paren(Paren(span:tokens_helper(folder:f, &_binding_0.span))) |
| 2385 | } |
| 2386 | MacroDelimiter::Brace(_binding_0: Brace) => { |
| 2387 | MacroDelimiter::Brace(Brace(span:tokens_helper(folder:f, &_binding_0.span))) |
| 2388 | } |
| 2389 | MacroDelimiter::Bracket(_binding_0: Bracket) => { |
| 2390 | MacroDelimiter::Bracket(Bracket(span:tokens_helper(folder:f, &_binding_0.span))) |
| 2391 | } |
| 2392 | } |
| 2393 | } |
| 2394 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Ident) => Member::Named(f.fold_ident(_binding_0)), |
| 2401 | Member::Unnamed(_binding_0: Index) => Member::Unnamed(f.fold_index(_binding_0)), |
| 2402 | } |
| 2403 | } |
| 2404 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Path) => Meta::Path(f.fold_path(_binding_0)), |
| 2411 | Meta::List(_binding_0: MetaList) => Meta::List(f.fold_meta_list(_binding_0)), |
| 2412 | Meta::NameValue(_binding_0: MetaNameValue) => { |
| 2413 | Meta::NameValue(f.fold_meta_name_value(_binding_0)) |
| 2414 | } |
| 2415 | } |
| 2416 | } |
| 2417 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 2425 | nested: FoldHelper::lift(self:node.nested, |it: NestedMeta| f.fold_nested_meta(it)), |
| 2426 | } |
| 2427 | } |
| 2428 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 2436 | lit: f.fold_lit(node.lit), |
| 2437 | } |
| 2438 | } |
| 2439 | #[cfg (feature = "full" )] |
| 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), |
| 2446 | lt_token: Token), |
| 2447 | args: FoldHelper::lift(self:node.args, |it: GenericMethodArgument| f.fold_generic_method_argument(it)), |
| 2448 | gt_token: Token), |
| 2449 | } |
| 2450 | } |
| 2451 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Meta) => NestedMeta::Meta(f.fold_meta(_binding_0)), |
| 2458 | NestedMeta::Lit(_binding_0: Lit) => NestedMeta::Lit(f.fold_lit(_binding_0)), |
| 2459 | } |
| 2460 | } |
| 2461 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 2471 | inputs: FoldHelper::lift(self:node.inputs, |it: Type| f.fold_type(it)), |
| 2472 | output: f.fold_return_type(node.output), |
| 2473 | } |
| 2474 | } |
| 2475 | #[cfg (feature = "full" )] |
| 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: PatBox) => Pat::Box(f.fold_pat_box(_binding_0)), |
| 2482 | Pat::Ident(_binding_0: PatIdent) => Pat::Ident(f.fold_pat_ident(_binding_0)), |
| 2483 | Pat::Lit(_binding_0: PatLit) => Pat::Lit(f.fold_pat_lit(_binding_0)), |
| 2484 | Pat::Macro(_binding_0: PatMacro) => Pat::Macro(f.fold_pat_macro(_binding_0)), |
| 2485 | Pat::Or(_binding_0: PatOr) => Pat::Or(f.fold_pat_or(_binding_0)), |
| 2486 | Pat::Path(_binding_0: PatPath) => Pat::Path(f.fold_pat_path(_binding_0)), |
| 2487 | Pat::Range(_binding_0: PatRange) => Pat::Range(f.fold_pat_range(_binding_0)), |
| 2488 | Pat::Reference(_binding_0: PatReference) => Pat::Reference(f.fold_pat_reference(_binding_0)), |
| 2489 | Pat::Rest(_binding_0: PatRest) => Pat::Rest(f.fold_pat_rest(_binding_0)), |
| 2490 | Pat::Slice(_binding_0: PatSlice) => Pat::Slice(f.fold_pat_slice(_binding_0)), |
| 2491 | Pat::Struct(_binding_0: PatStruct) => Pat::Struct(f.fold_pat_struct(_binding_0)), |
| 2492 | Pat::Tuple(_binding_0: PatTuple) => Pat::Tuple(f.fold_pat_tuple(_binding_0)), |
| 2493 | Pat::TupleStruct(_binding_0: PatTupleStruct) => { |
| 2494 | Pat::TupleStruct(f.fold_pat_tuple_struct(_binding_0)) |
| 2495 | } |
| 2496 | Pat::Type(_binding_0: PatType) => Pat::Type(f.fold_pat_type(_binding_0)), |
| 2497 | Pat::Verbatim(_binding_0: TokenStream) => Pat::Verbatim(_binding_0), |
| 2498 | Pat::Wild(_binding_0: PatWild) => Pat::Wild(f.fold_pat_wild(_binding_0)), |
| 2499 | #[cfg (syn_no_non_exhaustive)] |
| 2500 | _ => unreachable!(), |
| 2501 | } |
| 2502 | } |
| 2503 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2510 | box_token: Token), |
| 2511 | pat: Box::new(f.fold_pat(*node.pat)), |
| 2512 | } |
| 2513 | } |
| 2514 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2521 | by_ref: (node.by_ref).map(|it: Ref| Token)), |
| 2522 | mutability: (node.mutability).map(|it: Mut| Token)), |
| 2523 | ident: f.fold_ident(node.ident), |
| 2524 | subpat: (node.subpat) |
| 2525 | .map(|it: (At, Box)| ( |
| 2526 | Token.0.spans)), |
| 2527 | Box::new(f.fold_pat(*(it).1)), |
| 2528 | )), |
| 2529 | } |
| 2530 | } |
| 2531 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2538 | expr: Box::new(f.fold_expr(*node.expr)), |
| 2539 | } |
| 2540 | } |
| 2541 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2548 | mac: f.fold_macro(node.mac), |
| 2549 | } |
| 2550 | } |
| 2551 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2558 | leading_vert: (node.leading_vert) |
| 2559 | .map(|it: Or| Token)), |
| 2560 | cases: FoldHelper::lift(self:node.cases, |it: Pat| f.fold_pat(it)), |
| 2561 | } |
| 2562 | } |
| 2563 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2570 | qself: (node.qself).map(|it: QSelf| f.fold_qself(it)), |
| 2571 | path: f.fold_path(node.path), |
| 2572 | } |
| 2573 | } |
| 2574 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| 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" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2593 | and_token: Token), |
| 2594 | mutability: (node.mutability).map(|it: Mut| Token)), |
| 2595 | pat: Box::new(f.fold_pat(*node.pat)), |
| 2596 | } |
| 2597 | } |
| 2598 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2605 | dot2_token: Token), |
| 2606 | } |
| 2607 | } |
| 2608 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2615 | bracket_token: Bracket(span:tokens_helper(folder:f, &node.bracket_token.span)), |
| 2616 | elems: FoldHelper::lift(self:node.elems, |it: Pat| f.fold_pat(it)), |
| 2617 | } |
| 2618 | } |
| 2619 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2626 | path: f.fold_path(node.path), |
| 2627 | brace_token: Brace(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 2628 | fields: FoldHelper::lift(self:node.fields, |it: FieldPat| f.fold_field_pat(it)), |
| 2629 | dot2_token: (node.dot2_token).map(|it: Dot2| Token)), |
| 2630 | } |
| 2631 | } |
| 2632 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2639 | paren_token: Paren(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 2640 | elems: FoldHelper::lift(self:node.elems, |it: Pat| f.fold_pat(it)), |
| 2641 | } |
| 2642 | } |
| 2643 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| 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" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2661 | pat: Box::new(f.fold_pat(*node.pat)), |
| 2662 | colon_token: Token), |
| 2663 | ty: Box::new(f.fold_type(*node.ty)), |
| 2664 | } |
| 2665 | } |
| 2666 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2673 | underscore_token: Token), |
| 2674 | } |
| 2675 | } |
| 2676 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Colon2| Token)), |
| 2684 | segments: FoldHelper::lift(self:node.segments, |it: PathSegment| f.fold_path_segment(it)), |
| 2685 | } |
| 2686 | } |
| 2687 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: AngleBracketedGenericArguments) => { |
| 2695 | PathArguments::AngleBracketed( |
| 2696 | f.fold_angle_bracketed_generic_arguments(_binding_0), |
| 2697 | ) |
| 2698 | } |
| 2699 | PathArguments::Parenthesized(_binding_0: ParenthesizedGenericArguments) => { |
| 2700 | PathArguments::Parenthesized( |
| 2701 | f.fold_parenthesized_generic_arguments(_binding_0), |
| 2702 | ) |
| 2703 | } |
| 2704 | } |
| 2705 | } |
| 2706 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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" ))] |
| 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), |
| 2724 | rhs_ty: f.fold_type(node.rhs_ty), |
| 2725 | } |
| 2726 | } |
| 2727 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 2738 | bounds: FoldHelper::lift(self:node.bounds, |it: Lifetime| f.fold_lifetime(it)), |
| 2739 | } |
| 2740 | } |
| 2741 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: BoundLifetimes| f.fold_bound_lifetimes(it)), |
| 2748 | bounded_ty: f.fold_type(node.bounded_ty), |
| 2749 | colon_token: Token), |
| 2750 | bounds: FoldHelper::lift(self:node.bounds, |it: TypeParamBound| f.fold_type_param_bound(it)), |
| 2751 | } |
| 2752 | } |
| 2753 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 2760 | ty: Box::new(f.fold_type(*node.ty)), |
| 2761 | position: node.position, |
| 2762 | as_token: (node.as_token).map(|it: As| Token)), |
| 2763 | gt_token: Token), |
| 2764 | } |
| 2765 | } |
| 2766 | #[cfg (feature = "full" )] |
| 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: Dot2) => { |
| 2773 | RangeLimits::HalfOpen(Token)) |
| 2774 | } |
| 2775 | RangeLimits::Closed(_binding_0: DotDotEq) => { |
| 2776 | RangeLimits::Closed(Token)) |
| 2777 | } |
| 2778 | } |
| 2779 | } |
| 2780 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2787 | reference: (node.reference) |
| 2788 | .map(|it: (And, Option)| ( |
| 2789 | Token.0.spans)), |
| 2790 | ((it).1).map(|it: Lifetime| f.fold_lifetime(it)), |
| 2791 | )), |
| 2792 | mutability: (node.mutability).map(|it: Mut| Token)), |
| 2793 | self_token: Token), |
| 2794 | } |
| 2795 | } |
| 2796 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: RArrow, _binding_1: Box) => { |
| 2804 | ReturnType::Type( |
| 2805 | Token), |
| 2806 | Box::new(f.fold_type(*_binding_1)), |
| 2807 | ) |
| 2808 | } |
| 2809 | } |
| 2810 | } |
| 2811 | #[cfg (feature = "full" )] |
| 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: Const| Token)), |
| 2818 | asyncness: (node.asyncness).map(|it: Async| Token)), |
| 2819 | unsafety: (node.unsafety).map(|it: Unsafe| Token)), |
| 2820 | abi: (node.abi).map(|it: Abi| f.fold_abi(it)), |
| 2821 | fn_token: Token), |
| 2822 | ident: f.fold_ident(node.ident), |
| 2823 | generics: f.fold_generics(node.generics), |
| 2824 | paren_token: Paren(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 2825 | inputs: FoldHelper::lift(self:node.inputs, |it: FnArg| f.fold_fn_arg(it)), |
| 2826 | variadic: (node.variadic).map(|it: Variadic| f.fold_variadic(it)), |
| 2827 | output: f.fold_return_type(node.output), |
| 2828 | } |
| 2829 | } |
| 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" )] |
| 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: Local) => Stmt::Local(f.fold_local(_binding_0)), |
| 2843 | Stmt::Item(_binding_0: Item) => Stmt::Item(f.fold_item(_binding_0)), |
| 2844 | Stmt::Expr(_binding_0: Expr) => Stmt::Expr(f.fold_expr(_binding_0)), |
| 2845 | Stmt::Semi(_binding_0: Expr, _binding_1: Semi) => { |
| 2846 | Stmt::Semi( |
| 2847 | f.fold_expr(_binding_0), |
| 2848 | Token), |
| 2849 | ) |
| 2850 | } |
| 2851 | } |
| 2852 | } |
| 2853 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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| Paren(span:tokens_helper(folder:f, &it.span))), |
| 2860 | modifier: f.fold_trait_bound_modifier(node.modifier), |
| 2861 | lifetimes: (node.lifetimes).map(|it: BoundLifetimes| f.fold_bound_lifetimes(it)), |
| 2862 | path: f.fold_path(node.path), |
| 2863 | } |
| 2864 | } |
| 2865 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Question) => { |
| 2876 | TraitBoundModifier::Maybe(Token)) |
| 2877 | } |
| 2878 | } |
| 2879 | } |
| 2880 | #[cfg (feature = "full" )] |
| 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: TraitItemConst) => { |
| 2887 | TraitItem::Const(f.fold_trait_item_const(_binding_0)) |
| 2888 | } |
| 2889 | TraitItem::Method(_binding_0: TraitItemMethod) => { |
| 2890 | TraitItem::Method(f.fold_trait_item_method(_binding_0)) |
| 2891 | } |
| 2892 | TraitItem::Type(_binding_0: TraitItemType) => { |
| 2893 | TraitItem::Type(f.fold_trait_item_type(_binding_0)) |
| 2894 | } |
| 2895 | TraitItem::Macro(_binding_0: TraitItemMacro) => { |
| 2896 | TraitItem::Macro(f.fold_trait_item_macro(_binding_0)) |
| 2897 | } |
| 2898 | TraitItem::Verbatim(_binding_0: TokenStream) => TraitItem::Verbatim(_binding_0), |
| 2899 | #[cfg (syn_no_non_exhaustive)] |
| 2900 | _ => unreachable!(), |
| 2901 | } |
| 2902 | } |
| 2903 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2910 | const_token: Token), |
| 2911 | ident: f.fold_ident(node.ident), |
| 2912 | colon_token: Token), |
| 2913 | ty: f.fold_type(node.ty), |
| 2914 | default: (node.default) |
| 2915 | .map(|it: (Eq, Expr)| (Token.0.spans)), f.fold_expr((it).1))), |
| 2916 | semi_token: Token), |
| 2917 | } |
| 2918 | } |
| 2919 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2926 | mac: f.fold_macro(node.mac), |
| 2927 | semi_token: (node.semi_token).map(|it: Semi| Token)), |
| 2928 | } |
| 2929 | } |
| 2930 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2937 | sig: f.fold_signature(node.sig), |
| 2938 | default: (node.default).map(|it: Block| f.fold_block(it)), |
| 2939 | semi_token: (node.semi_token).map(|it: Semi| Token)), |
| 2940 | } |
| 2941 | } |
| 2942 | #[cfg (feature = "full" )] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 2949 | type_token: Token), |
| 2950 | ident: f.fold_ident(node.ident), |
| 2951 | generics: f.fold_generics(node.generics), |
| 2952 | colon_token: (node.colon_token).map(|it: Colon| Token)), |
| 2953 | bounds: FoldHelper::lift(self:node.bounds, |it: TypeParamBound| f.fold_type_param_bound(it)), |
| 2954 | default: (node.default) |
| 2955 | .map(|it: (Eq, Type)| (Token.0.spans)), f.fold_type((it).1))), |
| 2956 | semi_token: Token), |
| 2957 | } |
| 2958 | } |
| 2959 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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" ))] |
| 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(span:tokens_helper(folder:f, &node.bracket_token.span)), |
| 2995 | elem: Box::new(f.fold_type(*node.elem)), |
| 2996 | semi_token: Token), |
| 2997 | len: f.fold_expr(node.len), |
| 2998 | } |
| 2999 | } |
| 3000 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: BoundLifetimes| f.fold_bound_lifetimes(it)), |
| 3007 | unsafety: (node.unsafety).map(|it: Unsafe| Token)), |
| 3008 | abi: (node.abi).map(|it: Abi| f.fold_abi(it)), |
| 3009 | fn_token: Token), |
| 3010 | paren_token: Paren(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 3011 | inputs: FoldHelper::lift(self:node.inputs, |it: BareFnArg| f.fold_bare_fn_arg(it)), |
| 3012 | variadic: (node.variadic).map(|it: Variadic| f.fold_variadic(it)), |
| 3013 | output: f.fold_return_type(node.output), |
| 3014 | } |
| 3015 | } |
| 3016 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(span:tokens_helper(folder:f, &node.group_token.span)), |
| 3023 | elem: Box::new(f.fold_type(*node.elem)), |
| 3024 | } |
| 3025 | } |
| 3026 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 3033 | bounds: FoldHelper::lift(self:node.bounds, |it: TypeParamBound| f.fold_type_param_bound(it)), |
| 3034 | } |
| 3035 | } |
| 3036 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 3043 | } |
| 3044 | } |
| 3045 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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" ))] |
| 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), |
| 3061 | } |
| 3062 | } |
| 3063 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 3070 | ident: f.fold_ident(node.ident), |
| 3071 | colon_token: (node.colon_token).map(|it: Colon| Token)), |
| 3072 | bounds: FoldHelper::lift(self:node.bounds, |it: TypeParamBound| f.fold_type_param_bound(it)), |
| 3073 | eq_token: (node.eq_token).map(|it: Eq| Token)), |
| 3074 | default: (node.default).map(|it: Type| f.fold_type(it)), |
| 3075 | } |
| 3076 | } |
| 3077 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: TraitBound) => { |
| 3084 | TypeParamBound::Trait(f.fold_trait_bound(_binding_0)) |
| 3085 | } |
| 3086 | TypeParamBound::Lifetime(_binding_0: Lifetime) => { |
| 3087 | TypeParamBound::Lifetime(f.fold_lifetime(_binding_0)) |
| 3088 | } |
| 3089 | } |
| 3090 | } |
| 3091 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 3098 | elem: Box::new(f.fold_type(*node.elem)), |
| 3099 | } |
| 3100 | } |
| 3101 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: QSelf| f.fold_qself(it)), |
| 3108 | path: f.fold_path(node.path), |
| 3109 | } |
| 3110 | } |
| 3111 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 3118 | const_token: (node.const_token) |
| 3119 | .map(|it: Const| Token)), |
| 3120 | mutability: (node.mutability).map(|it: Mut| Token)), |
| 3121 | elem: Box::new(f.fold_type(*node.elem)), |
| 3122 | } |
| 3123 | } |
| 3124 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 3131 | lifetime: (node.lifetime).map(|it: Lifetime| f.fold_lifetime(it)), |
| 3132 | mutability: (node.mutability).map(|it: Mut| Token)), |
| 3133 | elem: Box::new(f.fold_type(*node.elem)), |
| 3134 | } |
| 3135 | } |
| 3136 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(span:tokens_helper(folder:f, &node.bracket_token.span)), |
| 3143 | elem: Box::new(f.fold_type(*node.elem)), |
| 3144 | } |
| 3145 | } |
| 3146 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Dyn| Token)), |
| 3153 | bounds: FoldHelper::lift(self:node.bounds, |it: TypeParamBound| f.fold_type_param_bound(it)), |
| 3154 | } |
| 3155 | } |
| 3156 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 3163 | elems: FoldHelper::lift(self:node.elems, |it: Type| f.fold_type(it)), |
| 3164 | } |
| 3165 | } |
| 3166 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: Star) => { |
| 3173 | UnOp::Deref(Token)) |
| 3174 | } |
| 3175 | UnOp::Not(_binding_0: Bang) => { |
| 3176 | UnOp::Not(Token)) |
| 3177 | } |
| 3178 | UnOp::Neg(_binding_0: Sub) => { |
| 3179 | UnOp::Neg(Token)) |
| 3180 | } |
| 3181 | } |
| 3182 | } |
| 3183 | #[cfg (feature = "full" )] |
| 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), |
| 3190 | } |
| 3191 | } |
| 3192 | #[cfg (feature = "full" )] |
| 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(span:tokens_helper(folder:f, &node.brace_token.span)), |
| 3199 | items: FoldHelper::lift(self:node.items, |it: UseTree| f.fold_use_tree(it)), |
| 3200 | } |
| 3201 | } |
| 3202 | #[cfg (feature = "full" )] |
| 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" )] |
| 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), |
| 3219 | tree: Box::new(f.fold_use_tree(*node.tree)), |
| 3220 | } |
| 3221 | } |
| 3222 | #[cfg (feature = "full" )] |
| 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), |
| 3230 | rename: f.fold_ident(node.rename), |
| 3231 | } |
| 3232 | } |
| 3233 | #[cfg (feature = "full" )] |
| 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: UsePath) => UseTree::Path(f.fold_use_path(_binding_0)), |
| 3240 | UseTree::Name(_binding_0: UseName) => UseTree::Name(f.fold_use_name(_binding_0)), |
| 3241 | UseTree::Rename(_binding_0: UseRename) => UseTree::Rename(f.fold_use_rename(_binding_0)), |
| 3242 | UseTree::Glob(_binding_0: UseGlob) => UseTree::Glob(f.fold_use_glob(_binding_0)), |
| 3243 | UseTree::Group(_binding_0: UseGroup) => UseTree::Group(f.fold_use_group(_binding_0)), |
| 3244 | } |
| 3245 | } |
| 3246 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| f.fold_attribute(it)), |
| 3253 | dots: Token), |
| 3254 | } |
| 3255 | } |
| 3256 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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(self:node.attrs, |it: Attribute| 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: (Eq, Expr)| (Token.0.spans)), f.fold_expr((it).1))), |
| 3267 | } |
| 3268 | } |
| 3269 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 3276 | } |
| 3277 | } |
| 3278 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 3285 | } |
| 3286 | } |
| 3287 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 3294 | paren_token: Paren(span:tokens_helper(folder:f, &node.paren_token.span)), |
| 3295 | in_token: (node.in_token).map(|it: In| Token)), |
| 3296 | path: Box::new(f.fold_path(*node.path)), |
| 3297 | } |
| 3298 | } |
| 3299 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: VisPublic) => { |
| 3306 | Visibility::Public(f.fold_vis_public(_binding_0)) |
| 3307 | } |
| 3308 | Visibility::Crate(_binding_0: VisCrate) => Visibility::Crate(f.fold_vis_crate(_binding_0)), |
| 3309 | Visibility::Restricted(_binding_0: VisRestricted) => { |
| 3310 | Visibility::Restricted(f.fold_vis_restricted(_binding_0)) |
| 3311 | } |
| 3312 | Visibility::Inherited => Visibility::Inherited, |
| 3313 | } |
| 3314 | } |
| 3315 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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), |
| 3322 | predicates: FoldHelper::lift(self:node.predicates, |it: WherePredicate| f.fold_where_predicate(it)), |
| 3323 | } |
| 3324 | } |
| 3325 | #[cfg (any(feature = "derive" , feature = "full" ))] |
| 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: PredicateType) => { |
| 3332 | WherePredicate::Type(f.fold_predicate_type(_binding_0)) |
| 3333 | } |
| 3334 | WherePredicate::Lifetime(_binding_0: PredicateLifetime) => { |
| 3335 | WherePredicate::Lifetime(f.fold_predicate_lifetime(_binding_0)) |
| 3336 | } |
| 3337 | WherePredicate::Eq(_binding_0: PredicateEq) => { |
| 3338 | WherePredicate::Eq(f.fold_predicate_eq(_binding_0)) |
| 3339 | } |
| 3340 | } |
| 3341 | } |
| 3342 | |