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