// This file is @generated by syn-internal-codegen. // It is not intended for manual editing. #![allow(unreachable_code, unused_variables)] #![allow(clippy::match_wildcard_for_single_variants)] #[cfg(any(feature = "full", feature = "derive"))] use crate::gen::helper::fold::*; #[cfg(any(feature = "full", feature = "derive"))] use crate::token::{Brace, Bracket, Group, Paren}; use crate::*; use proc_macro2::Span; #[cfg(feature = "full")] macro_rules! full { ($e:expr) => { $e }; } #[cfg(all(feature = "derive", not(feature = "full")))] macro_rules! full { ($e:expr) => { unreachable!() }; } /// Syntax tree traversal to transform the nodes of an owned syntax tree. /// /// See the [module documentation] for details. /// /// [module documentation]: self /// /// *This trait is available only if Syn is built with the `"fold"` feature.* pub trait Fold { #[cfg(any(feature = "derive", feature = "full"))] fn fold_abi(&mut self, i: Abi) -> Abi { fold_abi(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_angle_bracketed_generic_arguments( &mut self, i: AngleBracketedGenericArguments, ) -> AngleBracketedGenericArguments { fold_angle_bracketed_generic_arguments(self, i) } #[cfg(feature = "full")] fn fold_arm(&mut self, i: Arm) -> Arm { fold_arm(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_attr_style(&mut self, i: AttrStyle) -> AttrStyle { fold_attr_style(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_attribute(&mut self, i: Attribute) -> Attribute { fold_attribute(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_bare_fn_arg(&mut self, i: BareFnArg) -> BareFnArg { fold_bare_fn_arg(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_bin_op(&mut self, i: BinOp) -> BinOp { fold_bin_op(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_binding(&mut self, i: Binding) -> Binding { fold_binding(self, i) } #[cfg(feature = "full")] fn fold_block(&mut self, i: Block) -> Block { fold_block(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_bound_lifetimes(&mut self, i: BoundLifetimes) -> BoundLifetimes { fold_bound_lifetimes(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_const_param(&mut self, i: ConstParam) -> ConstParam { fold_const_param(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_constraint(&mut self, i: Constraint) -> Constraint { fold_constraint(self, i) } #[cfg(feature = "derive")] fn fold_data(&mut self, i: Data) -> Data { fold_data(self, i) } #[cfg(feature = "derive")] fn fold_data_enum(&mut self, i: DataEnum) -> DataEnum { fold_data_enum(self, i) } #[cfg(feature = "derive")] fn fold_data_struct(&mut self, i: DataStruct) -> DataStruct { fold_data_struct(self, i) } #[cfg(feature = "derive")] fn fold_data_union(&mut self, i: DataUnion) -> DataUnion { fold_data_union(self, i) } #[cfg(feature = "derive")] fn fold_derive_input(&mut self, i: DeriveInput) -> DeriveInput { fold_derive_input(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr(&mut self, i: Expr) -> Expr { fold_expr(self, i) } #[cfg(feature = "full")] fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray { fold_expr_array(self, i) } #[cfg(feature = "full")] fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign { fold_expr_assign(self, i) } #[cfg(feature = "full")] fn fold_expr_assign_op(&mut self, i: ExprAssignOp) -> ExprAssignOp { fold_expr_assign_op(self, i) } #[cfg(feature = "full")] fn fold_expr_async(&mut self, i: ExprAsync) -> ExprAsync { fold_expr_async(self, i) } #[cfg(feature = "full")] fn fold_expr_await(&mut self, i: ExprAwait) -> ExprAwait { fold_expr_await(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr_binary(&mut self, i: ExprBinary) -> ExprBinary { fold_expr_binary(self, i) } #[cfg(feature = "full")] fn fold_expr_block(&mut self, i: ExprBlock) -> ExprBlock { fold_expr_block(self, i) } #[cfg(feature = "full")] fn fold_expr_box(&mut self, i: ExprBox) -> ExprBox { fold_expr_box(self, i) } #[cfg(feature = "full")] fn fold_expr_break(&mut self, i: ExprBreak) -> ExprBreak { fold_expr_break(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr_call(&mut self, i: ExprCall) -> ExprCall { fold_expr_call(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr_cast(&mut self, i: ExprCast) -> ExprCast { fold_expr_cast(self, i) } #[cfg(feature = "full")] fn fold_expr_closure(&mut self, i: ExprClosure) -> ExprClosure { fold_expr_closure(self, i) } #[cfg(feature = "full")] fn fold_expr_continue(&mut self, i: ExprContinue) -> ExprContinue { fold_expr_continue(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr_field(&mut self, i: ExprField) -> ExprField { fold_expr_field(self, i) } #[cfg(feature = "full")] fn fold_expr_for_loop(&mut self, i: ExprForLoop) -> ExprForLoop { fold_expr_for_loop(self, i) } #[cfg(feature = "full")] fn fold_expr_group(&mut self, i: ExprGroup) -> ExprGroup { fold_expr_group(self, i) } #[cfg(feature = "full")] fn fold_expr_if(&mut self, i: ExprIf) -> ExprIf { fold_expr_if(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr_index(&mut self, i: ExprIndex) -> ExprIndex { fold_expr_index(self, i) } #[cfg(feature = "full")] fn fold_expr_let(&mut self, i: ExprLet) -> ExprLet { fold_expr_let(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr_lit(&mut self, i: ExprLit) -> ExprLit { fold_expr_lit(self, i) } #[cfg(feature = "full")] fn fold_expr_loop(&mut self, i: ExprLoop) -> ExprLoop { fold_expr_loop(self, i) } #[cfg(feature = "full")] fn fold_expr_macro(&mut self, i: ExprMacro) -> ExprMacro { fold_expr_macro(self, i) } #[cfg(feature = "full")] fn fold_expr_match(&mut self, i: ExprMatch) -> ExprMatch { fold_expr_match(self, i) } #[cfg(feature = "full")] fn fold_expr_method_call(&mut self, i: ExprMethodCall) -> ExprMethodCall { fold_expr_method_call(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr_paren(&mut self, i: ExprParen) -> ExprParen { fold_expr_paren(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr_path(&mut self, i: ExprPath) -> ExprPath { fold_expr_path(self, i) } #[cfg(feature = "full")] fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange { fold_expr_range(self, i) } #[cfg(feature = "full")] fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference { fold_expr_reference(self, i) } #[cfg(feature = "full")] fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat { fold_expr_repeat(self, i) } #[cfg(feature = "full")] fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn { fold_expr_return(self, i) } #[cfg(feature = "full")] fn fold_expr_struct(&mut self, i: ExprStruct) -> ExprStruct { fold_expr_struct(self, i) } #[cfg(feature = "full")] fn fold_expr_try(&mut self, i: ExprTry) -> ExprTry { fold_expr_try(self, i) } #[cfg(feature = "full")] fn fold_expr_try_block(&mut self, i: ExprTryBlock) -> ExprTryBlock { fold_expr_try_block(self, i) } #[cfg(feature = "full")] fn fold_expr_tuple(&mut self, i: ExprTuple) -> ExprTuple { fold_expr_tuple(self, i) } #[cfg(feature = "full")] fn fold_expr_type(&mut self, i: ExprType) -> ExprType { fold_expr_type(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_expr_unary(&mut self, i: ExprUnary) -> ExprUnary { fold_expr_unary(self, i) } #[cfg(feature = "full")] fn fold_expr_unsafe(&mut self, i: ExprUnsafe) -> ExprUnsafe { fold_expr_unsafe(self, i) } #[cfg(feature = "full")] fn fold_expr_while(&mut self, i: ExprWhile) -> ExprWhile { fold_expr_while(self, i) } #[cfg(feature = "full")] fn fold_expr_yield(&mut self, i: ExprYield) -> ExprYield { fold_expr_yield(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_field(&mut self, i: Field) -> Field { fold_field(self, i) } #[cfg(feature = "full")] fn fold_field_pat(&mut self, i: FieldPat) -> FieldPat { fold_field_pat(self, i) } #[cfg(feature = "full")] fn fold_field_value(&mut self, i: FieldValue) -> FieldValue { fold_field_value(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_fields(&mut self, i: Fields) -> Fields { fold_fields(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_fields_named(&mut self, i: FieldsNamed) -> FieldsNamed { fold_fields_named(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_fields_unnamed(&mut self, i: FieldsUnnamed) -> FieldsUnnamed { fold_fields_unnamed(self, i) } #[cfg(feature = "full")] fn fold_file(&mut self, i: File) -> File { fold_file(self, i) } #[cfg(feature = "full")] fn fold_fn_arg(&mut self, i: FnArg) -> FnArg { fold_fn_arg(self, i) } #[cfg(feature = "full")] fn fold_foreign_item(&mut self, i: ForeignItem) -> ForeignItem { fold_foreign_item(self, i) } #[cfg(feature = "full")] fn fold_foreign_item_fn(&mut self, i: ForeignItemFn) -> ForeignItemFn { fold_foreign_item_fn(self, i) } #[cfg(feature = "full")] fn fold_foreign_item_macro(&mut self, i: ForeignItemMacro) -> ForeignItemMacro { fold_foreign_item_macro(self, i) } #[cfg(feature = "full")] fn fold_foreign_item_static(&mut self, i: ForeignItemStatic) -> ForeignItemStatic { fold_foreign_item_static(self, i) } #[cfg(feature = "full")] fn fold_foreign_item_type(&mut self, i: ForeignItemType) -> ForeignItemType { fold_foreign_item_type(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_generic_argument(&mut self, i: GenericArgument) -> GenericArgument { fold_generic_argument(self, i) } #[cfg(feature = "full")] fn fold_generic_method_argument( &mut self, i: GenericMethodArgument, ) -> GenericMethodArgument { fold_generic_method_argument(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_generic_param(&mut self, i: GenericParam) -> GenericParam { fold_generic_param(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_generics(&mut self, i: Generics) -> Generics { fold_generics(self, i) } fn fold_ident(&mut self, i: Ident) -> Ident { fold_ident(self, i) } #[cfg(feature = "full")] fn fold_impl_item(&mut self, i: ImplItem) -> ImplItem { fold_impl_item(self, i) } #[cfg(feature = "full")] fn fold_impl_item_const(&mut self, i: ImplItemConst) -> ImplItemConst { fold_impl_item_const(self, i) } #[cfg(feature = "full")] fn fold_impl_item_macro(&mut self, i: ImplItemMacro) -> ImplItemMacro { fold_impl_item_macro(self, i) } #[cfg(feature = "full")] fn fold_impl_item_method(&mut self, i: ImplItemMethod) -> ImplItemMethod { fold_impl_item_method(self, i) } #[cfg(feature = "full")] fn fold_impl_item_type(&mut self, i: ImplItemType) -> ImplItemType { fold_impl_item_type(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_index(&mut self, i: Index) -> Index { fold_index(self, i) } #[cfg(feature = "full")] fn fold_item(&mut self, i: Item) -> Item { fold_item(self, i) } #[cfg(feature = "full")] fn fold_item_const(&mut self, i: ItemConst) -> ItemConst { fold_item_const(self, i) } #[cfg(feature = "full")] fn fold_item_enum(&mut self, i: ItemEnum) -> ItemEnum { fold_item_enum(self, i) } #[cfg(feature = "full")] fn fold_item_extern_crate(&mut self, i: ItemExternCrate) -> ItemExternCrate { fold_item_extern_crate(self, i) } #[cfg(feature = "full")] fn fold_item_fn(&mut self, i: ItemFn) -> ItemFn { fold_item_fn(self, i) } #[cfg(feature = "full")] fn fold_item_foreign_mod(&mut self, i: ItemForeignMod) -> ItemForeignMod { fold_item_foreign_mod(self, i) } #[cfg(feature = "full")] fn fold_item_impl(&mut self, i: ItemImpl) -> ItemImpl { fold_item_impl(self, i) } #[cfg(feature = "full")] fn fold_item_macro(&mut self, i: ItemMacro) -> ItemMacro { fold_item_macro(self, i) } #[cfg(feature = "full")] fn fold_item_macro2(&mut self, i: ItemMacro2) -> ItemMacro2 { fold_item_macro2(self, i) } #[cfg(feature = "full")] fn fold_item_mod(&mut self, i: ItemMod) -> ItemMod { fold_item_mod(self, i) } #[cfg(feature = "full")] fn fold_item_static(&mut self, i: ItemStatic) -> ItemStatic { fold_item_static(self, i) } #[cfg(feature = "full")] fn fold_item_struct(&mut self, i: ItemStruct) -> ItemStruct { fold_item_struct(self, i) } #[cfg(feature = "full")] fn fold_item_trait(&mut self, i: ItemTrait) -> ItemTrait { fold_item_trait(self, i) } #[cfg(feature = "full")] fn fold_item_trait_alias(&mut self, i: ItemTraitAlias) -> ItemTraitAlias { fold_item_trait_alias(self, i) } #[cfg(feature = "full")] fn fold_item_type(&mut self, i: ItemType) -> ItemType { fold_item_type(self, i) } #[cfg(feature = "full")] fn fold_item_union(&mut self, i: ItemUnion) -> ItemUnion { fold_item_union(self, i) } #[cfg(feature = "full")] fn fold_item_use(&mut self, i: ItemUse) -> ItemUse { fold_item_use(self, i) } #[cfg(feature = "full")] fn fold_label(&mut self, i: Label) -> Label { fold_label(self, i) } fn fold_lifetime(&mut self, i: Lifetime) -> Lifetime { fold_lifetime(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_lifetime_def(&mut self, i: LifetimeDef) -> LifetimeDef { fold_lifetime_def(self, i) } fn fold_lit(&mut self, i: Lit) -> Lit { fold_lit(self, i) } fn fold_lit_bool(&mut self, i: LitBool) -> LitBool { fold_lit_bool(self, i) } fn fold_lit_byte(&mut self, i: LitByte) -> LitByte { fold_lit_byte(self, i) } fn fold_lit_byte_str(&mut self, i: LitByteStr) -> LitByteStr { fold_lit_byte_str(self, i) } fn fold_lit_char(&mut self, i: LitChar) -> LitChar { fold_lit_char(self, i) } fn fold_lit_float(&mut self, i: LitFloat) -> LitFloat { fold_lit_float(self, i) } fn fold_lit_int(&mut self, i: LitInt) -> LitInt { fold_lit_int(self, i) } fn fold_lit_str(&mut self, i: LitStr) -> LitStr { fold_lit_str(self, i) } #[cfg(feature = "full")] fn fold_local(&mut self, i: Local) -> Local { fold_local(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_macro(&mut self, i: Macro) -> Macro { fold_macro(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_macro_delimiter(&mut self, i: MacroDelimiter) -> MacroDelimiter { fold_macro_delimiter(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_member(&mut self, i: Member) -> Member { fold_member(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_meta(&mut self, i: Meta) -> Meta { fold_meta(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_meta_list(&mut self, i: MetaList) -> MetaList { fold_meta_list(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_meta_name_value(&mut self, i: MetaNameValue) -> MetaNameValue { fold_meta_name_value(self, i) } #[cfg(feature = "full")] fn fold_method_turbofish(&mut self, i: MethodTurbofish) -> MethodTurbofish { fold_method_turbofish(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_nested_meta(&mut self, i: NestedMeta) -> NestedMeta { fold_nested_meta(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_parenthesized_generic_arguments( &mut self, i: ParenthesizedGenericArguments, ) -> ParenthesizedGenericArguments { fold_parenthesized_generic_arguments(self, i) } #[cfg(feature = "full")] fn fold_pat(&mut self, i: Pat) -> Pat { fold_pat(self, i) } #[cfg(feature = "full")] fn fold_pat_box(&mut self, i: PatBox) -> PatBox { fold_pat_box(self, i) } #[cfg(feature = "full")] fn fold_pat_ident(&mut self, i: PatIdent) -> PatIdent { fold_pat_ident(self, i) } #[cfg(feature = "full")] fn fold_pat_lit(&mut self, i: PatLit) -> PatLit { fold_pat_lit(self, i) } #[cfg(feature = "full")] fn fold_pat_macro(&mut self, i: PatMacro) -> PatMacro { fold_pat_macro(self, i) } #[cfg(feature = "full")] fn fold_pat_or(&mut self, i: PatOr) -> PatOr { fold_pat_or(self, i) } #[cfg(feature = "full")] fn fold_pat_path(&mut self, i: PatPath) -> PatPath { fold_pat_path(self, i) } #[cfg(feature = "full")] fn fold_pat_range(&mut self, i: PatRange) -> PatRange { fold_pat_range(self, i) } #[cfg(feature = "full")] fn fold_pat_reference(&mut self, i: PatReference) -> PatReference { fold_pat_reference(self, i) } #[cfg(feature = "full")] fn fold_pat_rest(&mut self, i: PatRest) -> PatRest { fold_pat_rest(self, i) } #[cfg(feature = "full")] fn fold_pat_slice(&mut self, i: PatSlice) -> PatSlice { fold_pat_slice(self, i) } #[cfg(feature = "full")] fn fold_pat_struct(&mut self, i: PatStruct) -> PatStruct { fold_pat_struct(self, i) } #[cfg(feature = "full")] fn fold_pat_tuple(&mut self, i: PatTuple) -> PatTuple { fold_pat_tuple(self, i) } #[cfg(feature = "full")] fn fold_pat_tuple_struct(&mut self, i: PatTupleStruct) -> PatTupleStruct { fold_pat_tuple_struct(self, i) } #[cfg(feature = "full")] fn fold_pat_type(&mut self, i: PatType) -> PatType { fold_pat_type(self, i) } #[cfg(feature = "full")] fn fold_pat_wild(&mut self, i: PatWild) -> PatWild { fold_pat_wild(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_path(&mut self, i: Path) -> Path { fold_path(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_path_arguments(&mut self, i: PathArguments) -> PathArguments { fold_path_arguments(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_path_segment(&mut self, i: PathSegment) -> PathSegment { fold_path_segment(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_predicate_eq(&mut self, i: PredicateEq) -> PredicateEq { fold_predicate_eq(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_predicate_lifetime(&mut self, i: PredicateLifetime) -> PredicateLifetime { fold_predicate_lifetime(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_predicate_type(&mut self, i: PredicateType) -> PredicateType { fold_predicate_type(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_qself(&mut self, i: QSelf) -> QSelf { fold_qself(self, i) } #[cfg(feature = "full")] fn fold_range_limits(&mut self, i: RangeLimits) -> RangeLimits { fold_range_limits(self, i) } #[cfg(feature = "full")] fn fold_receiver(&mut self, i: Receiver) -> Receiver { fold_receiver(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_return_type(&mut self, i: ReturnType) -> ReturnType { fold_return_type(self, i) } #[cfg(feature = "full")] fn fold_signature(&mut self, i: Signature) -> Signature { fold_signature(self, i) } fn fold_span(&mut self, i: Span) -> Span { fold_span(self, i) } #[cfg(feature = "full")] fn fold_stmt(&mut self, i: Stmt) -> Stmt { fold_stmt(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_trait_bound(&mut self, i: TraitBound) -> TraitBound { fold_trait_bound(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_trait_bound_modifier( &mut self, i: TraitBoundModifier, ) -> TraitBoundModifier { fold_trait_bound_modifier(self, i) } #[cfg(feature = "full")] fn fold_trait_item(&mut self, i: TraitItem) -> TraitItem { fold_trait_item(self, i) } #[cfg(feature = "full")] fn fold_trait_item_const(&mut self, i: TraitItemConst) -> TraitItemConst { fold_trait_item_const(self, i) } #[cfg(feature = "full")] fn fold_trait_item_macro(&mut self, i: TraitItemMacro) -> TraitItemMacro { fold_trait_item_macro(self, i) } #[cfg(feature = "full")] fn fold_trait_item_method(&mut self, i: TraitItemMethod) -> TraitItemMethod { fold_trait_item_method(self, i) } #[cfg(feature = "full")] fn fold_trait_item_type(&mut self, i: TraitItemType) -> TraitItemType { fold_trait_item_type(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type(&mut self, i: Type) -> Type { fold_type(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_array(&mut self, i: TypeArray) -> TypeArray { fold_type_array(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_bare_fn(&mut self, i: TypeBareFn) -> TypeBareFn { fold_type_bare_fn(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_group(&mut self, i: TypeGroup) -> TypeGroup { fold_type_group(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_impl_trait(&mut self, i: TypeImplTrait) -> TypeImplTrait { fold_type_impl_trait(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_infer(&mut self, i: TypeInfer) -> TypeInfer { fold_type_infer(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_macro(&mut self, i: TypeMacro) -> TypeMacro { fold_type_macro(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_never(&mut self, i: TypeNever) -> TypeNever { fold_type_never(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_param(&mut self, i: TypeParam) -> TypeParam { fold_type_param(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_param_bound(&mut self, i: TypeParamBound) -> TypeParamBound { fold_type_param_bound(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_paren(&mut self, i: TypeParen) -> TypeParen { fold_type_paren(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_path(&mut self, i: TypePath) -> TypePath { fold_type_path(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_ptr(&mut self, i: TypePtr) -> TypePtr { fold_type_ptr(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_reference(&mut self, i: TypeReference) -> TypeReference { fold_type_reference(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_slice(&mut self, i: TypeSlice) -> TypeSlice { fold_type_slice(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_trait_object(&mut self, i: TypeTraitObject) -> TypeTraitObject { fold_type_trait_object(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_type_tuple(&mut self, i: TypeTuple) -> TypeTuple { fold_type_tuple(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_un_op(&mut self, i: UnOp) -> UnOp { fold_un_op(self, i) } #[cfg(feature = "full")] fn fold_use_glob(&mut self, i: UseGlob) -> UseGlob { fold_use_glob(self, i) } #[cfg(feature = "full")] fn fold_use_group(&mut self, i: UseGroup) -> UseGroup { fold_use_group(self, i) } #[cfg(feature = "full")] fn fold_use_name(&mut self, i: UseName) -> UseName { fold_use_name(self, i) } #[cfg(feature = "full")] fn fold_use_path(&mut self, i: UsePath) -> UsePath { fold_use_path(self, i) } #[cfg(feature = "full")] fn fold_use_rename(&mut self, i: UseRename) -> UseRename { fold_use_rename(self, i) } #[cfg(feature = "full")] fn fold_use_tree(&mut self, i: UseTree) -> UseTree { fold_use_tree(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_variadic(&mut self, i: Variadic) -> Variadic { fold_variadic(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_variant(&mut self, i: Variant) -> Variant { fold_variant(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate { fold_vis_crate(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic { fold_vis_public(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_vis_restricted(&mut self, i: VisRestricted) -> VisRestricted { fold_vis_restricted(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_visibility(&mut self, i: Visibility) -> Visibility { fold_visibility(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_where_clause(&mut self, i: WhereClause) -> WhereClause { fold_where_clause(self, i) } #[cfg(any(feature = "derive", feature = "full"))] fn fold_where_predicate(&mut self, i: WherePredicate) -> WherePredicate { fold_where_predicate(self, i) } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_abi(f: &mut F, node: Abi) -> Abi where F: Fold + ?Sized, { Abi { extern_token: Token![extern](tokens_helper(f, &node.extern_token.span)), name: (node.name).map(|it| f.fold_lit_str(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_angle_bracketed_generic_arguments( f: &mut F, node: AngleBracketedGenericArguments, ) -> AngleBracketedGenericArguments where F: Fold + ?Sized, { AngleBracketedGenericArguments { colon2_token: (node.colon2_token) .map(|it| Token![::](tokens_helper(f, &it.spans))), lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)), args: FoldHelper::lift(node.args, |it| f.fold_generic_argument(it)), gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)), } } #[cfg(feature = "full")] pub fn fold_arm(f: &mut F, node: Arm) -> Arm where F: Fold + ?Sized, { Arm { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), pat: f.fold_pat(node.pat), guard: (node.guard) .map(|it| ( Token![if](tokens_helper(f, &(it).0.span)), Box::new(f.fold_expr(*(it).1)), )), fat_arrow_token: Token![=>](tokens_helper(f, &node.fat_arrow_token.spans)), body: Box::new(f.fold_expr(*node.body)), comma: (node.comma).map(|it| Token![,](tokens_helper(f, &it.spans))), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_attr_style(f: &mut F, node: AttrStyle) -> AttrStyle where F: Fold + ?Sized, { match node { AttrStyle::Outer => AttrStyle::Outer, AttrStyle::Inner(_binding_0) => { AttrStyle::Inner(Token![!](tokens_helper(f, &_binding_0.spans))) } } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_attribute(f: &mut F, node: Attribute) -> Attribute where F: Fold + ?Sized, { Attribute { pound_token: Token![#](tokens_helper(f, &node.pound_token.spans)), style: f.fold_attr_style(node.style), bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), path: f.fold_path(node.path), tokens: node.tokens, } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_bare_fn_arg(f: &mut F, node: BareFnArg) -> BareFnArg where F: Fold + ?Sized, { BareFnArg { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), name: (node.name) .map(|it| ( f.fold_ident((it).0), Token![:](tokens_helper(f, &(it).1.spans)), )), ty: f.fold_type(node.ty), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_bin_op(f: &mut F, node: BinOp) -> BinOp where F: Fold + ?Sized, { match node { BinOp::Add(_binding_0) => { BinOp::Add(Token![+](tokens_helper(f, &_binding_0.spans))) } BinOp::Sub(_binding_0) => { BinOp::Sub(Token![-](tokens_helper(f, &_binding_0.spans))) } BinOp::Mul(_binding_0) => { BinOp::Mul(Token![*](tokens_helper(f, &_binding_0.spans))) } BinOp::Div(_binding_0) => { BinOp::Div(Token![/](tokens_helper(f, &_binding_0.spans))) } BinOp::Rem(_binding_0) => { BinOp::Rem(Token![%](tokens_helper(f, &_binding_0.spans))) } BinOp::And(_binding_0) => { BinOp::And(Token![&&](tokens_helper(f, &_binding_0.spans))) } BinOp::Or(_binding_0) => { BinOp::Or(Token![||](tokens_helper(f, &_binding_0.spans))) } BinOp::BitXor(_binding_0) => { BinOp::BitXor(Token![^](tokens_helper(f, &_binding_0.spans))) } BinOp::BitAnd(_binding_0) => { BinOp::BitAnd(Token![&](tokens_helper(f, &_binding_0.spans))) } BinOp::BitOr(_binding_0) => { BinOp::BitOr(Token![|](tokens_helper(f, &_binding_0.spans))) } BinOp::Shl(_binding_0) => { BinOp::Shl(Token![<<](tokens_helper(f, &_binding_0.spans))) } BinOp::Shr(_binding_0) => { BinOp::Shr(Token![>>](tokens_helper(f, &_binding_0.spans))) } BinOp::Eq(_binding_0) => { BinOp::Eq(Token![==](tokens_helper(f, &_binding_0.spans))) } BinOp::Lt(_binding_0) => { BinOp::Lt(Token![<](tokens_helper(f, &_binding_0.spans))) } BinOp::Le(_binding_0) => { BinOp::Le(Token![<=](tokens_helper(f, &_binding_0.spans))) } BinOp::Ne(_binding_0) => { BinOp::Ne(Token![!=](tokens_helper(f, &_binding_0.spans))) } BinOp::Ge(_binding_0) => { BinOp::Ge(Token![>=](tokens_helper(f, &_binding_0.spans))) } BinOp::Gt(_binding_0) => { BinOp::Gt(Token![>](tokens_helper(f, &_binding_0.spans))) } BinOp::AddEq(_binding_0) => { BinOp::AddEq(Token![+=](tokens_helper(f, &_binding_0.spans))) } BinOp::SubEq(_binding_0) => { BinOp::SubEq(Token![-=](tokens_helper(f, &_binding_0.spans))) } BinOp::MulEq(_binding_0) => { BinOp::MulEq(Token![*=](tokens_helper(f, &_binding_0.spans))) } BinOp::DivEq(_binding_0) => { BinOp::DivEq(Token![/=](tokens_helper(f, &_binding_0.spans))) } BinOp::RemEq(_binding_0) => { BinOp::RemEq(Token![%=](tokens_helper(f, &_binding_0.spans))) } BinOp::BitXorEq(_binding_0) => { BinOp::BitXorEq(Token![^=](tokens_helper(f, &_binding_0.spans))) } BinOp::BitAndEq(_binding_0) => { BinOp::BitAndEq(Token![&=](tokens_helper(f, &_binding_0.spans))) } BinOp::BitOrEq(_binding_0) => { BinOp::BitOrEq(Token![|=](tokens_helper(f, &_binding_0.spans))) } BinOp::ShlEq(_binding_0) => { BinOp::ShlEq(Token![<<=](tokens_helper(f, &_binding_0.spans))) } BinOp::ShrEq(_binding_0) => { BinOp::ShrEq(Token![>>=](tokens_helper(f, &_binding_0.spans))) } } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_binding(f: &mut F, node: Binding) -> Binding where F: Fold + ?Sized, { Binding { ident: f.fold_ident(node.ident), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), ty: f.fold_type(node.ty), } } #[cfg(feature = "full")] pub fn fold_block(f: &mut F, node: Block) -> Block where F: Fold + ?Sized, { Block { brace_token: Brace(tokens_helper(f, &node.brace_token.span)), stmts: FoldHelper::lift(node.stmts, |it| f.fold_stmt(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_bound_lifetimes(f: &mut F, node: BoundLifetimes) -> BoundLifetimes where F: Fold + ?Sized, { BoundLifetimes { for_token: Token![for](tokens_helper(f, &node.for_token.span)), lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)), lifetimes: FoldHelper::lift(node.lifetimes, |it| f.fold_lifetime_def(it)), gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_const_param(f: &mut F, node: ConstParam) -> ConstParam where F: Fold + ?Sized, { ConstParam { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), const_token: Token![const](tokens_helper(f, &node.const_token.span)), ident: f.fold_ident(node.ident), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), ty: f.fold_type(node.ty), eq_token: (node.eq_token).map(|it| Token![=](tokens_helper(f, &it.spans))), default: (node.default).map(|it| f.fold_expr(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_constraint(f: &mut F, node: Constraint) -> Constraint where F: Fold + ?Sized, { Constraint { ident: f.fold_ident(node.ident), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), } } #[cfg(feature = "derive")] pub fn fold_data(f: &mut F, node: Data) -> Data where F: Fold + ?Sized, { match node { Data::Struct(_binding_0) => Data::Struct(f.fold_data_struct(_binding_0)), Data::Enum(_binding_0) => Data::Enum(f.fold_data_enum(_binding_0)), Data::Union(_binding_0) => Data::Union(f.fold_data_union(_binding_0)), } } #[cfg(feature = "derive")] pub fn fold_data_enum(f: &mut F, node: DataEnum) -> DataEnum where F: Fold + ?Sized, { DataEnum { enum_token: Token![enum](tokens_helper(f, &node.enum_token.span)), brace_token: Brace(tokens_helper(f, &node.brace_token.span)), variants: FoldHelper::lift(node.variants, |it| f.fold_variant(it)), } } #[cfg(feature = "derive")] pub fn fold_data_struct(f: &mut F, node: DataStruct) -> DataStruct where F: Fold + ?Sized, { DataStruct { struct_token: Token![struct](tokens_helper(f, &node.struct_token.span)), fields: f.fold_fields(node.fields), semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "derive")] pub fn fold_data_union(f: &mut F, node: DataUnion) -> DataUnion where F: Fold + ?Sized, { DataUnion { union_token: Token![union](tokens_helper(f, &node.union_token.span)), fields: f.fold_fields_named(node.fields), } } #[cfg(feature = "derive")] pub fn fold_derive_input(f: &mut F, node: DeriveInput) -> DeriveInput where F: Fold + ?Sized, { DeriveInput { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), data: f.fold_data(node.data), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr(f: &mut F, node: Expr) -> Expr where F: Fold + ?Sized, { match node { Expr::Array(_binding_0) => Expr::Array(full!(f.fold_expr_array(_binding_0))), Expr::Assign(_binding_0) => Expr::Assign(full!(f.fold_expr_assign(_binding_0))), Expr::AssignOp(_binding_0) => { Expr::AssignOp(full!(f.fold_expr_assign_op(_binding_0))) } Expr::Async(_binding_0) => Expr::Async(full!(f.fold_expr_async(_binding_0))), Expr::Await(_binding_0) => Expr::Await(full!(f.fold_expr_await(_binding_0))), Expr::Binary(_binding_0) => Expr::Binary(f.fold_expr_binary(_binding_0)), Expr::Block(_binding_0) => Expr::Block(full!(f.fold_expr_block(_binding_0))), Expr::Box(_binding_0) => Expr::Box(full!(f.fold_expr_box(_binding_0))), Expr::Break(_binding_0) => Expr::Break(full!(f.fold_expr_break(_binding_0))), Expr::Call(_binding_0) => Expr::Call(f.fold_expr_call(_binding_0)), Expr::Cast(_binding_0) => Expr::Cast(f.fold_expr_cast(_binding_0)), Expr::Closure(_binding_0) => { Expr::Closure(full!(f.fold_expr_closure(_binding_0))) } Expr::Continue(_binding_0) => { Expr::Continue(full!(f.fold_expr_continue(_binding_0))) } Expr::Field(_binding_0) => Expr::Field(f.fold_expr_field(_binding_0)), Expr::ForLoop(_binding_0) => { Expr::ForLoop(full!(f.fold_expr_for_loop(_binding_0))) } Expr::Group(_binding_0) => Expr::Group(full!(f.fold_expr_group(_binding_0))), Expr::If(_binding_0) => Expr::If(full!(f.fold_expr_if(_binding_0))), Expr::Index(_binding_0) => Expr::Index(f.fold_expr_index(_binding_0)), Expr::Let(_binding_0) => Expr::Let(full!(f.fold_expr_let(_binding_0))), Expr::Lit(_binding_0) => Expr::Lit(f.fold_expr_lit(_binding_0)), Expr::Loop(_binding_0) => Expr::Loop(full!(f.fold_expr_loop(_binding_0))), Expr::Macro(_binding_0) => Expr::Macro(full!(f.fold_expr_macro(_binding_0))), Expr::Match(_binding_0) => Expr::Match(full!(f.fold_expr_match(_binding_0))), Expr::MethodCall(_binding_0) => { Expr::MethodCall(full!(f.fold_expr_method_call(_binding_0))) } Expr::Paren(_binding_0) => Expr::Paren(f.fold_expr_paren(_binding_0)), Expr::Path(_binding_0) => Expr::Path(f.fold_expr_path(_binding_0)), Expr::Range(_binding_0) => Expr::Range(full!(f.fold_expr_range(_binding_0))), Expr::Reference(_binding_0) => { Expr::Reference(full!(f.fold_expr_reference(_binding_0))) } Expr::Repeat(_binding_0) => Expr::Repeat(full!(f.fold_expr_repeat(_binding_0))), Expr::Return(_binding_0) => Expr::Return(full!(f.fold_expr_return(_binding_0))), Expr::Struct(_binding_0) => Expr::Struct(full!(f.fold_expr_struct(_binding_0))), Expr::Try(_binding_0) => Expr::Try(full!(f.fold_expr_try(_binding_0))), Expr::TryBlock(_binding_0) => { Expr::TryBlock(full!(f.fold_expr_try_block(_binding_0))) } Expr::Tuple(_binding_0) => Expr::Tuple(full!(f.fold_expr_tuple(_binding_0))), Expr::Type(_binding_0) => Expr::Type(full!(f.fold_expr_type(_binding_0))), Expr::Unary(_binding_0) => Expr::Unary(f.fold_expr_unary(_binding_0)), Expr::Unsafe(_binding_0) => Expr::Unsafe(full!(f.fold_expr_unsafe(_binding_0))), Expr::Verbatim(_binding_0) => Expr::Verbatim(_binding_0), Expr::While(_binding_0) => Expr::While(full!(f.fold_expr_while(_binding_0))), Expr::Yield(_binding_0) => Expr::Yield(full!(f.fold_expr_yield(_binding_0))), #[cfg(syn_no_non_exhaustive)] _ => unreachable!(), } } #[cfg(feature = "full")] pub fn fold_expr_array(f: &mut F, node: ExprArray) -> ExprArray where F: Fold + ?Sized, { ExprArray { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), elems: FoldHelper::lift(node.elems, |it| f.fold_expr(it)), } } #[cfg(feature = "full")] pub fn fold_expr_assign(f: &mut F, node: ExprAssign) -> ExprAssign where F: Fold + ?Sized, { ExprAssign { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), left: Box::new(f.fold_expr(*node.left)), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), right: Box::new(f.fold_expr(*node.right)), } } #[cfg(feature = "full")] pub fn fold_expr_assign_op(f: &mut F, node: ExprAssignOp) -> ExprAssignOp where F: Fold + ?Sized, { ExprAssignOp { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), left: Box::new(f.fold_expr(*node.left)), op: f.fold_bin_op(node.op), right: Box::new(f.fold_expr(*node.right)), } } #[cfg(feature = "full")] pub fn fold_expr_async(f: &mut F, node: ExprAsync) -> ExprAsync where F: Fold + ?Sized, { ExprAsync { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), async_token: Token![async](tokens_helper(f, &node.async_token.span)), capture: (node.capture).map(|it| Token![move](tokens_helper(f, &it.span))), block: f.fold_block(node.block), } } #[cfg(feature = "full")] pub fn fold_expr_await(f: &mut F, node: ExprAwait) -> ExprAwait where F: Fold + ?Sized, { ExprAwait { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), base: Box::new(f.fold_expr(*node.base)), dot_token: Token![.](tokens_helper(f, &node.dot_token.spans)), await_token: crate::token::Await(tokens_helper(f, &node.await_token.span)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr_binary(f: &mut F, node: ExprBinary) -> ExprBinary where F: Fold + ?Sized, { ExprBinary { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), left: Box::new(f.fold_expr(*node.left)), op: f.fold_bin_op(node.op), right: Box::new(f.fold_expr(*node.right)), } } #[cfg(feature = "full")] pub fn fold_expr_block(f: &mut F, node: ExprBlock) -> ExprBlock where F: Fold + ?Sized, { ExprBlock { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), label: (node.label).map(|it| f.fold_label(it)), block: f.fold_block(node.block), } } #[cfg(feature = "full")] pub fn fold_expr_box(f: &mut F, node: ExprBox) -> ExprBox where F: Fold + ?Sized, { ExprBox { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), box_token: Token![box](tokens_helper(f, &node.box_token.span)), expr: Box::new(f.fold_expr(*node.expr)), } } #[cfg(feature = "full")] pub fn fold_expr_break(f: &mut F, node: ExprBreak) -> ExprBreak where F: Fold + ?Sized, { ExprBreak { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), break_token: Token![break](tokens_helper(f, &node.break_token.span)), label: (node.label).map(|it| f.fold_lifetime(it)), expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr_call(f: &mut F, node: ExprCall) -> ExprCall where F: Fold + ?Sized, { ExprCall { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), func: Box::new(f.fold_expr(*node.func)), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), args: FoldHelper::lift(node.args, |it| f.fold_expr(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr_cast(f: &mut F, node: ExprCast) -> ExprCast where F: Fold + ?Sized, { ExprCast { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), expr: Box::new(f.fold_expr(*node.expr)), as_token: Token![as](tokens_helper(f, &node.as_token.span)), ty: Box::new(f.fold_type(*node.ty)), } } #[cfg(feature = "full")] pub fn fold_expr_closure(f: &mut F, node: ExprClosure) -> ExprClosure where F: Fold + ?Sized, { ExprClosure { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), movability: (node.movability) .map(|it| Token![static](tokens_helper(f, &it.span))), asyncness: (node.asyncness).map(|it| Token![async](tokens_helper(f, &it.span))), capture: (node.capture).map(|it| Token![move](tokens_helper(f, &it.span))), or1_token: Token![|](tokens_helper(f, &node.or1_token.spans)), inputs: FoldHelper::lift(node.inputs, |it| f.fold_pat(it)), or2_token: Token![|](tokens_helper(f, &node.or2_token.spans)), output: f.fold_return_type(node.output), body: Box::new(f.fold_expr(*node.body)), } } #[cfg(feature = "full")] pub fn fold_expr_continue(f: &mut F, node: ExprContinue) -> ExprContinue where F: Fold + ?Sized, { ExprContinue { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), continue_token: Token![continue](tokens_helper(f, &node.continue_token.span)), label: (node.label).map(|it| f.fold_lifetime(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr_field(f: &mut F, node: ExprField) -> ExprField where F: Fold + ?Sized, { ExprField { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), base: Box::new(f.fold_expr(*node.base)), dot_token: Token![.](tokens_helper(f, &node.dot_token.spans)), member: f.fold_member(node.member), } } #[cfg(feature = "full")] pub fn fold_expr_for_loop(f: &mut F, node: ExprForLoop) -> ExprForLoop where F: Fold + ?Sized, { ExprForLoop { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), label: (node.label).map(|it| f.fold_label(it)), for_token: Token![for](tokens_helper(f, &node.for_token.span)), pat: f.fold_pat(node.pat), in_token: Token![in](tokens_helper(f, &node.in_token.span)), expr: Box::new(f.fold_expr(*node.expr)), body: f.fold_block(node.body), } } #[cfg(feature = "full")] pub fn fold_expr_group(f: &mut F, node: ExprGroup) -> ExprGroup where F: Fold + ?Sized, { ExprGroup { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), group_token: Group(tokens_helper(f, &node.group_token.span)), expr: Box::new(f.fold_expr(*node.expr)), } } #[cfg(feature = "full")] pub fn fold_expr_if(f: &mut F, node: ExprIf) -> ExprIf where F: Fold + ?Sized, { ExprIf { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), if_token: Token![if](tokens_helper(f, &node.if_token.span)), cond: Box::new(f.fold_expr(*node.cond)), then_branch: f.fold_block(node.then_branch), else_branch: (node.else_branch) .map(|it| ( Token![else](tokens_helper(f, &(it).0.span)), Box::new(f.fold_expr(*(it).1)), )), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr_index(f: &mut F, node: ExprIndex) -> ExprIndex where F: Fold + ?Sized, { ExprIndex { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), expr: Box::new(f.fold_expr(*node.expr)), bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), index: Box::new(f.fold_expr(*node.index)), } } #[cfg(feature = "full")] pub fn fold_expr_let(f: &mut F, node: ExprLet) -> ExprLet where F: Fold + ?Sized, { ExprLet { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), let_token: Token![let](tokens_helper(f, &node.let_token.span)), pat: f.fold_pat(node.pat), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), expr: Box::new(f.fold_expr(*node.expr)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr_lit(f: &mut F, node: ExprLit) -> ExprLit where F: Fold + ?Sized, { ExprLit { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), lit: f.fold_lit(node.lit), } } #[cfg(feature = "full")] pub fn fold_expr_loop(f: &mut F, node: ExprLoop) -> ExprLoop where F: Fold + ?Sized, { ExprLoop { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), label: (node.label).map(|it| f.fold_label(it)), loop_token: Token![loop](tokens_helper(f, &node.loop_token.span)), body: f.fold_block(node.body), } } #[cfg(feature = "full")] pub fn fold_expr_macro(f: &mut F, node: ExprMacro) -> ExprMacro where F: Fold + ?Sized, { ExprMacro { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), mac: f.fold_macro(node.mac), } } #[cfg(feature = "full")] pub fn fold_expr_match(f: &mut F, node: ExprMatch) -> ExprMatch where F: Fold + ?Sized, { ExprMatch { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), match_token: Token![match](tokens_helper(f, &node.match_token.span)), expr: Box::new(f.fold_expr(*node.expr)), brace_token: Brace(tokens_helper(f, &node.brace_token.span)), arms: FoldHelper::lift(node.arms, |it| f.fold_arm(it)), } } #[cfg(feature = "full")] pub fn fold_expr_method_call(f: &mut F, node: ExprMethodCall) -> ExprMethodCall where F: Fold + ?Sized, { ExprMethodCall { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), receiver: Box::new(f.fold_expr(*node.receiver)), dot_token: Token![.](tokens_helper(f, &node.dot_token.spans)), method: f.fold_ident(node.method), turbofish: (node.turbofish).map(|it| f.fold_method_turbofish(it)), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), args: FoldHelper::lift(node.args, |it| f.fold_expr(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr_paren(f: &mut F, node: ExprParen) -> ExprParen where F: Fold + ?Sized, { ExprParen { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), expr: Box::new(f.fold_expr(*node.expr)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr_path(f: &mut F, node: ExprPath) -> ExprPath where F: Fold + ?Sized, { ExprPath { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), qself: (node.qself).map(|it| f.fold_qself(it)), path: f.fold_path(node.path), } } #[cfg(feature = "full")] pub fn fold_expr_range(f: &mut F, node: ExprRange) -> ExprRange where F: Fold + ?Sized, { ExprRange { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), from: (node.from).map(|it| Box::new(f.fold_expr(*it))), limits: f.fold_range_limits(node.limits), to: (node.to).map(|it| Box::new(f.fold_expr(*it))), } } #[cfg(feature = "full")] pub fn fold_expr_reference(f: &mut F, node: ExprReference) -> ExprReference where F: Fold + ?Sized, { ExprReference { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), and_token: Token![&](tokens_helper(f, &node.and_token.spans)), raw: node.raw, mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), expr: Box::new(f.fold_expr(*node.expr)), } } #[cfg(feature = "full")] pub fn fold_expr_repeat(f: &mut F, node: ExprRepeat) -> ExprRepeat where F: Fold + ?Sized, { ExprRepeat { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), expr: Box::new(f.fold_expr(*node.expr)), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), len: Box::new(f.fold_expr(*node.len)), } } #[cfg(feature = "full")] pub fn fold_expr_return(f: &mut F, node: ExprReturn) -> ExprReturn where F: Fold + ?Sized, { ExprReturn { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), return_token: Token![return](tokens_helper(f, &node.return_token.span)), expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))), } } #[cfg(feature = "full")] pub fn fold_expr_struct(f: &mut F, node: ExprStruct) -> ExprStruct where F: Fold + ?Sized, { ExprStruct { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), path: f.fold_path(node.path), brace_token: Brace(tokens_helper(f, &node.brace_token.span)), fields: FoldHelper::lift(node.fields, |it| f.fold_field_value(it)), dot2_token: (node.dot2_token).map(|it| Token![..](tokens_helper(f, &it.spans))), rest: (node.rest).map(|it| Box::new(f.fold_expr(*it))), } } #[cfg(feature = "full")] pub fn fold_expr_try(f: &mut F, node: ExprTry) -> ExprTry where F: Fold + ?Sized, { ExprTry { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), expr: Box::new(f.fold_expr(*node.expr)), question_token: Token![?](tokens_helper(f, &node.question_token.spans)), } } #[cfg(feature = "full")] pub fn fold_expr_try_block(f: &mut F, node: ExprTryBlock) -> ExprTryBlock where F: Fold + ?Sized, { ExprTryBlock { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), try_token: Token![try](tokens_helper(f, &node.try_token.span)), block: f.fold_block(node.block), } } #[cfg(feature = "full")] pub fn fold_expr_tuple(f: &mut F, node: ExprTuple) -> ExprTuple where F: Fold + ?Sized, { ExprTuple { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), elems: FoldHelper::lift(node.elems, |it| f.fold_expr(it)), } } #[cfg(feature = "full")] pub fn fold_expr_type(f: &mut F, node: ExprType) -> ExprType where F: Fold + ?Sized, { ExprType { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), expr: Box::new(f.fold_expr(*node.expr)), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_expr_unary(f: &mut F, node: ExprUnary) -> ExprUnary where F: Fold + ?Sized, { ExprUnary { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), op: f.fold_un_op(node.op), expr: Box::new(f.fold_expr(*node.expr)), } } #[cfg(feature = "full")] pub fn fold_expr_unsafe(f: &mut F, node: ExprUnsafe) -> ExprUnsafe where F: Fold + ?Sized, { ExprUnsafe { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), unsafe_token: Token![unsafe](tokens_helper(f, &node.unsafe_token.span)), block: f.fold_block(node.block), } } #[cfg(feature = "full")] pub fn fold_expr_while(f: &mut F, node: ExprWhile) -> ExprWhile where F: Fold + ?Sized, { ExprWhile { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), label: (node.label).map(|it| f.fold_label(it)), while_token: Token![while](tokens_helper(f, &node.while_token.span)), cond: Box::new(f.fold_expr(*node.cond)), body: f.fold_block(node.body), } } #[cfg(feature = "full")] pub fn fold_expr_yield(f: &mut F, node: ExprYield) -> ExprYield where F: Fold + ?Sized, { ExprYield { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), yield_token: Token![yield](tokens_helper(f, &node.yield_token.span)), expr: (node.expr).map(|it| Box::new(f.fold_expr(*it))), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_field(f: &mut F, node: Field) -> Field where F: Fold + ?Sized, { Field { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), ident: (node.ident).map(|it| f.fold_ident(it)), colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))), ty: f.fold_type(node.ty), } } #[cfg(feature = "full")] pub fn fold_field_pat(f: &mut F, node: FieldPat) -> FieldPat where F: Fold + ?Sized, { FieldPat { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), member: f.fold_member(node.member), colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))), pat: Box::new(f.fold_pat(*node.pat)), } } #[cfg(feature = "full")] pub fn fold_field_value(f: &mut F, node: FieldValue) -> FieldValue where F: Fold + ?Sized, { FieldValue { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), member: f.fold_member(node.member), colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))), expr: f.fold_expr(node.expr), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_fields(f: &mut F, node: Fields) -> Fields where F: Fold + ?Sized, { match node { Fields::Named(_binding_0) => Fields::Named(f.fold_fields_named(_binding_0)), Fields::Unnamed(_binding_0) => Fields::Unnamed(f.fold_fields_unnamed(_binding_0)), Fields::Unit => Fields::Unit, } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_fields_named(f: &mut F, node: FieldsNamed) -> FieldsNamed where F: Fold + ?Sized, { FieldsNamed { brace_token: Brace(tokens_helper(f, &node.brace_token.span)), named: FoldHelper::lift(node.named, |it| f.fold_field(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_fields_unnamed(f: &mut F, node: FieldsUnnamed) -> FieldsUnnamed where F: Fold + ?Sized, { FieldsUnnamed { paren_token: Paren(tokens_helper(f, &node.paren_token.span)), unnamed: FoldHelper::lift(node.unnamed, |it| f.fold_field(it)), } } #[cfg(feature = "full")] pub fn fold_file(f: &mut F, node: File) -> File where F: Fold + ?Sized, { File { shebang: node.shebang, attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), items: FoldHelper::lift(node.items, |it| f.fold_item(it)), } } #[cfg(feature = "full")] pub fn fold_fn_arg(f: &mut F, node: FnArg) -> FnArg where F: Fold + ?Sized, { match node { FnArg::Receiver(_binding_0) => FnArg::Receiver(f.fold_receiver(_binding_0)), FnArg::Typed(_binding_0) => FnArg::Typed(f.fold_pat_type(_binding_0)), } } #[cfg(feature = "full")] pub fn fold_foreign_item(f: &mut F, node: ForeignItem) -> ForeignItem where F: Fold + ?Sized, { match node { ForeignItem::Fn(_binding_0) => { ForeignItem::Fn(f.fold_foreign_item_fn(_binding_0)) } ForeignItem::Static(_binding_0) => { ForeignItem::Static(f.fold_foreign_item_static(_binding_0)) } ForeignItem::Type(_binding_0) => { ForeignItem::Type(f.fold_foreign_item_type(_binding_0)) } ForeignItem::Macro(_binding_0) => { ForeignItem::Macro(f.fold_foreign_item_macro(_binding_0)) } ForeignItem::Verbatim(_binding_0) => ForeignItem::Verbatim(_binding_0), #[cfg(syn_no_non_exhaustive)] _ => unreachable!(), } } #[cfg(feature = "full")] pub fn fold_foreign_item_fn(f: &mut F, node: ForeignItemFn) -> ForeignItemFn where F: Fold + ?Sized, { ForeignItemFn { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), sig: f.fold_signature(node.sig), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_foreign_item_macro(f: &mut F, node: ForeignItemMacro) -> ForeignItemMacro where F: Fold + ?Sized, { ForeignItemMacro { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), mac: f.fold_macro(node.mac), semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] pub fn fold_foreign_item_static( f: &mut F, node: ForeignItemStatic, ) -> ForeignItemStatic where F: Fold + ?Sized, { ForeignItemStatic { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), static_token: Token![static](tokens_helper(f, &node.static_token.span)), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), ident: f.fold_ident(node.ident), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_foreign_item_type(f: &mut F, node: ForeignItemType) -> ForeignItemType where F: Fold + ?Sized, { ForeignItemType { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), type_token: Token![type](tokens_helper(f, &node.type_token.span)), ident: f.fold_ident(node.ident), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_generic_argument(f: &mut F, node: GenericArgument) -> GenericArgument where F: Fold + ?Sized, { match node { GenericArgument::Lifetime(_binding_0) => { GenericArgument::Lifetime(f.fold_lifetime(_binding_0)) } GenericArgument::Type(_binding_0) => { GenericArgument::Type(f.fold_type(_binding_0)) } GenericArgument::Binding(_binding_0) => { GenericArgument::Binding(f.fold_binding(_binding_0)) } GenericArgument::Constraint(_binding_0) => { GenericArgument::Constraint(f.fold_constraint(_binding_0)) } GenericArgument::Const(_binding_0) => { GenericArgument::Const(f.fold_expr(_binding_0)) } } } #[cfg(feature = "full")] pub fn fold_generic_method_argument( f: &mut F, node: GenericMethodArgument, ) -> GenericMethodArgument where F: Fold + ?Sized, { match node { GenericMethodArgument::Type(_binding_0) => { GenericMethodArgument::Type(f.fold_type(_binding_0)) } GenericMethodArgument::Const(_binding_0) => { GenericMethodArgument::Const(f.fold_expr(_binding_0)) } } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_generic_param(f: &mut F, node: GenericParam) -> GenericParam where F: Fold + ?Sized, { match node { GenericParam::Type(_binding_0) => { GenericParam::Type(f.fold_type_param(_binding_0)) } GenericParam::Lifetime(_binding_0) => { GenericParam::Lifetime(f.fold_lifetime_def(_binding_0)) } GenericParam::Const(_binding_0) => { GenericParam::Const(f.fold_const_param(_binding_0)) } } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_generics(f: &mut F, node: Generics) -> Generics where F: Fold + ?Sized, { Generics { lt_token: (node.lt_token).map(|it| Token![<](tokens_helper(f, &it.spans))), params: FoldHelper::lift(node.params, |it| f.fold_generic_param(it)), gt_token: (node.gt_token).map(|it| Token![>](tokens_helper(f, &it.spans))), where_clause: (node.where_clause).map(|it| f.fold_where_clause(it)), } } pub fn fold_ident(f: &mut F, node: Ident) -> Ident where F: Fold + ?Sized, { let mut node = node; let span = f.fold_span(node.span()); node.set_span(span); node } #[cfg(feature = "full")] pub fn fold_impl_item(f: &mut F, node: ImplItem) -> ImplItem where F: Fold + ?Sized, { match node { ImplItem::Const(_binding_0) => { ImplItem::Const(f.fold_impl_item_const(_binding_0)) } ImplItem::Method(_binding_0) => { ImplItem::Method(f.fold_impl_item_method(_binding_0)) } ImplItem::Type(_binding_0) => ImplItem::Type(f.fold_impl_item_type(_binding_0)), ImplItem::Macro(_binding_0) => { ImplItem::Macro(f.fold_impl_item_macro(_binding_0)) } ImplItem::Verbatim(_binding_0) => ImplItem::Verbatim(_binding_0), #[cfg(syn_no_non_exhaustive)] _ => unreachable!(), } } #[cfg(feature = "full")] pub fn fold_impl_item_const(f: &mut F, node: ImplItemConst) -> ImplItemConst where F: Fold + ?Sized, { ImplItemConst { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), defaultness: (node.defaultness) .map(|it| Token![default](tokens_helper(f, &it.span))), const_token: Token![const](tokens_helper(f, &node.const_token.span)), ident: f.fold_ident(node.ident), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), ty: f.fold_type(node.ty), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), expr: f.fold_expr(node.expr), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_impl_item_macro(f: &mut F, node: ImplItemMacro) -> ImplItemMacro where F: Fold + ?Sized, { ImplItemMacro { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), mac: f.fold_macro(node.mac), semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] pub fn fold_impl_item_method(f: &mut F, node: ImplItemMethod) -> ImplItemMethod where F: Fold + ?Sized, { ImplItemMethod { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), defaultness: (node.defaultness) .map(|it| Token![default](tokens_helper(f, &it.span))), sig: f.fold_signature(node.sig), block: f.fold_block(node.block), } } #[cfg(feature = "full")] pub fn fold_impl_item_type(f: &mut F, node: ImplItemType) -> ImplItemType where F: Fold + ?Sized, { ImplItemType { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), defaultness: (node.defaultness) .map(|it| Token![default](tokens_helper(f, &it.span))), type_token: Token![type](tokens_helper(f, &node.type_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), ty: f.fold_type(node.ty), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_index(f: &mut F, node: Index) -> Index where F: Fold + ?Sized, { Index { index: node.index, span: f.fold_span(node.span), } } #[cfg(feature = "full")] pub fn fold_item(f: &mut F, node: Item) -> Item where F: Fold + ?Sized, { match node { Item::Const(_binding_0) => Item::Const(f.fold_item_const(_binding_0)), Item::Enum(_binding_0) => Item::Enum(f.fold_item_enum(_binding_0)), Item::ExternCrate(_binding_0) => { Item::ExternCrate(f.fold_item_extern_crate(_binding_0)) } Item::Fn(_binding_0) => Item::Fn(f.fold_item_fn(_binding_0)), Item::ForeignMod(_binding_0) => { Item::ForeignMod(f.fold_item_foreign_mod(_binding_0)) } Item::Impl(_binding_0) => Item::Impl(f.fold_item_impl(_binding_0)), Item::Macro(_binding_0) => Item::Macro(f.fold_item_macro(_binding_0)), Item::Macro2(_binding_0) => Item::Macro2(f.fold_item_macro2(_binding_0)), Item::Mod(_binding_0) => Item::Mod(f.fold_item_mod(_binding_0)), Item::Static(_binding_0) => Item::Static(f.fold_item_static(_binding_0)), Item::Struct(_binding_0) => Item::Struct(f.fold_item_struct(_binding_0)), Item::Trait(_binding_0) => Item::Trait(f.fold_item_trait(_binding_0)), Item::TraitAlias(_binding_0) => { Item::TraitAlias(f.fold_item_trait_alias(_binding_0)) } Item::Type(_binding_0) => Item::Type(f.fold_item_type(_binding_0)), Item::Union(_binding_0) => Item::Union(f.fold_item_union(_binding_0)), Item::Use(_binding_0) => Item::Use(f.fold_item_use(_binding_0)), Item::Verbatim(_binding_0) => Item::Verbatim(_binding_0), #[cfg(syn_no_non_exhaustive)] _ => unreachable!(), } } #[cfg(feature = "full")] pub fn fold_item_const(f: &mut F, node: ItemConst) -> ItemConst where F: Fold + ?Sized, { ItemConst { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), const_token: Token![const](tokens_helper(f, &node.const_token.span)), ident: f.fold_ident(node.ident), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), expr: Box::new(f.fold_expr(*node.expr)), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_item_enum(f: &mut F, node: ItemEnum) -> ItemEnum where F: Fold + ?Sized, { ItemEnum { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), enum_token: Token![enum](tokens_helper(f, &node.enum_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), brace_token: Brace(tokens_helper(f, &node.brace_token.span)), variants: FoldHelper::lift(node.variants, |it| f.fold_variant(it)), } } #[cfg(feature = "full")] pub fn fold_item_extern_crate(f: &mut F, node: ItemExternCrate) -> ItemExternCrate where F: Fold + ?Sized, { ItemExternCrate { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), extern_token: Token![extern](tokens_helper(f, &node.extern_token.span)), crate_token: Token![crate](tokens_helper(f, &node.crate_token.span)), ident: f.fold_ident(node.ident), rename: (node.rename) .map(|it| ( Token![as](tokens_helper(f, &(it).0.span)), f.fold_ident((it).1), )), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_item_fn(f: &mut F, node: ItemFn) -> ItemFn where F: Fold + ?Sized, { ItemFn { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), sig: f.fold_signature(node.sig), block: Box::new(f.fold_block(*node.block)), } } #[cfg(feature = "full")] pub fn fold_item_foreign_mod(f: &mut F, node: ItemForeignMod) -> ItemForeignMod where F: Fold + ?Sized, { ItemForeignMod { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), abi: f.fold_abi(node.abi), brace_token: Brace(tokens_helper(f, &node.brace_token.span)), items: FoldHelper::lift(node.items, |it| f.fold_foreign_item(it)), } } #[cfg(feature = "full")] pub fn fold_item_impl(f: &mut F, node: ItemImpl) -> ItemImpl where F: Fold + ?Sized, { ItemImpl { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), defaultness: (node.defaultness) .map(|it| Token![default](tokens_helper(f, &it.span))), unsafety: (node.unsafety).map(|it| Token![unsafe](tokens_helper(f, &it.span))), impl_token: Token![impl](tokens_helper(f, &node.impl_token.span)), generics: f.fold_generics(node.generics), trait_: (node.trait_) .map(|it| ( ((it).0).map(|it| Token![!](tokens_helper(f, &it.spans))), f.fold_path((it).1), Token![for](tokens_helper(f, &(it).2.span)), )), self_ty: Box::new(f.fold_type(*node.self_ty)), brace_token: Brace(tokens_helper(f, &node.brace_token.span)), items: FoldHelper::lift(node.items, |it| f.fold_impl_item(it)), } } #[cfg(feature = "full")] pub fn fold_item_macro(f: &mut F, node: ItemMacro) -> ItemMacro where F: Fold + ?Sized, { ItemMacro { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), ident: (node.ident).map(|it| f.fold_ident(it)), mac: f.fold_macro(node.mac), semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] pub fn fold_item_macro2(f: &mut F, node: ItemMacro2) -> ItemMacro2 where F: Fold + ?Sized, { ItemMacro2 { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), macro_token: Token![macro](tokens_helper(f, &node.macro_token.span)), ident: f.fold_ident(node.ident), rules: node.rules, } } #[cfg(feature = "full")] pub fn fold_item_mod(f: &mut F, node: ItemMod) -> ItemMod where F: Fold + ?Sized, { ItemMod { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), mod_token: Token![mod](tokens_helper(f, &node.mod_token.span)), ident: f.fold_ident(node.ident), content: (node.content) .map(|it| ( Brace(tokens_helper(f, &(it).0.span)), FoldHelper::lift((it).1, |it| f.fold_item(it)), )), semi: (node.semi).map(|it| Token![;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] pub fn fold_item_static(f: &mut F, node: ItemStatic) -> ItemStatic where F: Fold + ?Sized, { ItemStatic { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), static_token: Token![static](tokens_helper(f, &node.static_token.span)), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), ident: f.fold_ident(node.ident), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), expr: Box::new(f.fold_expr(*node.expr)), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_item_struct(f: &mut F, node: ItemStruct) -> ItemStruct where F: Fold + ?Sized, { ItemStruct { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), struct_token: Token![struct](tokens_helper(f, &node.struct_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), fields: f.fold_fields(node.fields), semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] pub fn fold_item_trait(f: &mut F, node: ItemTrait) -> ItemTrait where F: Fold + ?Sized, { ItemTrait { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), unsafety: (node.unsafety).map(|it| Token![unsafe](tokens_helper(f, &it.span))), auto_token: (node.auto_token).map(|it| Token![auto](tokens_helper(f, &it.span))), trait_token: Token![trait](tokens_helper(f, &node.trait_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))), supertraits: FoldHelper::lift( node.supertraits, |it| f.fold_type_param_bound(it), ), brace_token: Brace(tokens_helper(f, &node.brace_token.span)), items: FoldHelper::lift(node.items, |it| f.fold_trait_item(it)), } } #[cfg(feature = "full")] pub fn fold_item_trait_alias(f: &mut F, node: ItemTraitAlias) -> ItemTraitAlias where F: Fold + ?Sized, { ItemTraitAlias { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), trait_token: Token![trait](tokens_helper(f, &node.trait_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_item_type(f: &mut F, node: ItemType) -> ItemType where F: Fold + ?Sized, { ItemType { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), type_token: Token![type](tokens_helper(f, &node.type_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), ty: Box::new(f.fold_type(*node.ty)), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_item_union(f: &mut F, node: ItemUnion) -> ItemUnion where F: Fold + ?Sized, { ItemUnion { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), union_token: Token![union](tokens_helper(f, &node.union_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), fields: f.fold_fields_named(node.fields), } } #[cfg(feature = "full")] pub fn fold_item_use(f: &mut F, node: ItemUse) -> ItemUse where F: Fold + ?Sized, { ItemUse { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), use_token: Token![use](tokens_helper(f, &node.use_token.span)), leading_colon: (node.leading_colon) .map(|it| Token![::](tokens_helper(f, &it.spans))), tree: f.fold_use_tree(node.tree), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_label(f: &mut F, node: Label) -> Label where F: Fold + ?Sized, { Label { name: f.fold_lifetime(node.name), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), } } pub fn fold_lifetime(f: &mut F, node: Lifetime) -> Lifetime where F: Fold + ?Sized, { Lifetime { apostrophe: f.fold_span(node.apostrophe), ident: f.fold_ident(node.ident), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_lifetime_def(f: &mut F, node: LifetimeDef) -> LifetimeDef where F: Fold + ?Sized, { LifetimeDef { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), lifetime: f.fold_lifetime(node.lifetime), colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))), bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)), } } pub fn fold_lit(f: &mut F, node: Lit) -> Lit where F: Fold + ?Sized, { match node { Lit::Str(_binding_0) => Lit::Str(f.fold_lit_str(_binding_0)), Lit::ByteStr(_binding_0) => Lit::ByteStr(f.fold_lit_byte_str(_binding_0)), Lit::Byte(_binding_0) => Lit::Byte(f.fold_lit_byte(_binding_0)), Lit::Char(_binding_0) => Lit::Char(f.fold_lit_char(_binding_0)), Lit::Int(_binding_0) => Lit::Int(f.fold_lit_int(_binding_0)), Lit::Float(_binding_0) => Lit::Float(f.fold_lit_float(_binding_0)), Lit::Bool(_binding_0) => Lit::Bool(f.fold_lit_bool(_binding_0)), Lit::Verbatim(_binding_0) => Lit::Verbatim(_binding_0), } } pub fn fold_lit_bool(f: &mut F, node: LitBool) -> LitBool where F: Fold + ?Sized, { LitBool { value: node.value, span: f.fold_span(node.span), } } pub fn fold_lit_byte(f: &mut F, node: LitByte) -> LitByte where F: Fold + ?Sized, { let span = f.fold_span(node.span()); let mut node = node; node.set_span(span); node } pub fn fold_lit_byte_str(f: &mut F, node: LitByteStr) -> LitByteStr where F: Fold + ?Sized, { let span = f.fold_span(node.span()); let mut node = node; node.set_span(span); node } pub fn fold_lit_char(f: &mut F, node: LitChar) -> LitChar where F: Fold + ?Sized, { let span = f.fold_span(node.span()); let mut node = node; node.set_span(span); node } pub fn fold_lit_float(f: &mut F, node: LitFloat) -> LitFloat where F: Fold + ?Sized, { let span = f.fold_span(node.span()); let mut node = node; node.set_span(span); node } pub fn fold_lit_int(f: &mut F, node: LitInt) -> LitInt where F: Fold + ?Sized, { let span = f.fold_span(node.span()); let mut node = node; node.set_span(span); node } pub fn fold_lit_str(f: &mut F, node: LitStr) -> LitStr where F: Fold + ?Sized, { let span = f.fold_span(node.span()); let mut node = node; node.set_span(span); node } #[cfg(feature = "full")] pub fn fold_local(f: &mut F, node: Local) -> Local where F: Fold + ?Sized, { Local { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), let_token: Token![let](tokens_helper(f, &node.let_token.span)), pat: f.fold_pat(node.pat), init: (node.init) .map(|it| ( Token![=](tokens_helper(f, &(it).0.spans)), Box::new(f.fold_expr(*(it).1)), )), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_macro(f: &mut F, node: Macro) -> Macro where F: Fold + ?Sized, { Macro { path: f.fold_path(node.path), bang_token: Token![!](tokens_helper(f, &node.bang_token.spans)), delimiter: f.fold_macro_delimiter(node.delimiter), tokens: node.tokens, } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_macro_delimiter(f: &mut F, node: MacroDelimiter) -> MacroDelimiter where F: Fold + ?Sized, { match node { MacroDelimiter::Paren(_binding_0) => { MacroDelimiter::Paren(Paren(tokens_helper(f, &_binding_0.span))) } MacroDelimiter::Brace(_binding_0) => { MacroDelimiter::Brace(Brace(tokens_helper(f, &_binding_0.span))) } MacroDelimiter::Bracket(_binding_0) => { MacroDelimiter::Bracket(Bracket(tokens_helper(f, &_binding_0.span))) } } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_member(f: &mut F, node: Member) -> Member where F: Fold + ?Sized, { match node { Member::Named(_binding_0) => Member::Named(f.fold_ident(_binding_0)), Member::Unnamed(_binding_0) => Member::Unnamed(f.fold_index(_binding_0)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_meta(f: &mut F, node: Meta) -> Meta where F: Fold + ?Sized, { match node { Meta::Path(_binding_0) => Meta::Path(f.fold_path(_binding_0)), Meta::List(_binding_0) => Meta::List(f.fold_meta_list(_binding_0)), Meta::NameValue(_binding_0) => { Meta::NameValue(f.fold_meta_name_value(_binding_0)) } } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_meta_list(f: &mut F, node: MetaList) -> MetaList where F: Fold + ?Sized, { MetaList { path: f.fold_path(node.path), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), nested: FoldHelper::lift(node.nested, |it| f.fold_nested_meta(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_meta_name_value(f: &mut F, node: MetaNameValue) -> MetaNameValue where F: Fold + ?Sized, { MetaNameValue { path: f.fold_path(node.path), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), lit: f.fold_lit(node.lit), } } #[cfg(feature = "full")] pub fn fold_method_turbofish(f: &mut F, node: MethodTurbofish) -> MethodTurbofish where F: Fold + ?Sized, { MethodTurbofish { colon2_token: Token![::](tokens_helper(f, &node.colon2_token.spans)), lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)), args: FoldHelper::lift(node.args, |it| f.fold_generic_method_argument(it)), gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_nested_meta(f: &mut F, node: NestedMeta) -> NestedMeta where F: Fold + ?Sized, { match node { NestedMeta::Meta(_binding_0) => NestedMeta::Meta(f.fold_meta(_binding_0)), NestedMeta::Lit(_binding_0) => NestedMeta::Lit(f.fold_lit(_binding_0)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_parenthesized_generic_arguments( f: &mut F, node: ParenthesizedGenericArguments, ) -> ParenthesizedGenericArguments where F: Fold + ?Sized, { ParenthesizedGenericArguments { paren_token: Paren(tokens_helper(f, &node.paren_token.span)), inputs: FoldHelper::lift(node.inputs, |it| f.fold_type(it)), output: f.fold_return_type(node.output), } } #[cfg(feature = "full")] pub fn fold_pat(f: &mut F, node: Pat) -> Pat where F: Fold + ?Sized, { match node { Pat::Box(_binding_0) => Pat::Box(f.fold_pat_box(_binding_0)), Pat::Ident(_binding_0) => Pat::Ident(f.fold_pat_ident(_binding_0)), Pat::Lit(_binding_0) => Pat::Lit(f.fold_pat_lit(_binding_0)), Pat::Macro(_binding_0) => Pat::Macro(f.fold_pat_macro(_binding_0)), Pat::Or(_binding_0) => Pat::Or(f.fold_pat_or(_binding_0)), Pat::Path(_binding_0) => Pat::Path(f.fold_pat_path(_binding_0)), Pat::Range(_binding_0) => Pat::Range(f.fold_pat_range(_binding_0)), Pat::Reference(_binding_0) => Pat::Reference(f.fold_pat_reference(_binding_0)), Pat::Rest(_binding_0) => Pat::Rest(f.fold_pat_rest(_binding_0)), Pat::Slice(_binding_0) => Pat::Slice(f.fold_pat_slice(_binding_0)), Pat::Struct(_binding_0) => Pat::Struct(f.fold_pat_struct(_binding_0)), Pat::Tuple(_binding_0) => Pat::Tuple(f.fold_pat_tuple(_binding_0)), Pat::TupleStruct(_binding_0) => { Pat::TupleStruct(f.fold_pat_tuple_struct(_binding_0)) } Pat::Type(_binding_0) => Pat::Type(f.fold_pat_type(_binding_0)), Pat::Verbatim(_binding_0) => Pat::Verbatim(_binding_0), Pat::Wild(_binding_0) => Pat::Wild(f.fold_pat_wild(_binding_0)), #[cfg(syn_no_non_exhaustive)] _ => unreachable!(), } } #[cfg(feature = "full")] pub fn fold_pat_box(f: &mut F, node: PatBox) -> PatBox where F: Fold + ?Sized, { PatBox { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), box_token: Token![box](tokens_helper(f, &node.box_token.span)), pat: Box::new(f.fold_pat(*node.pat)), } } #[cfg(feature = "full")] pub fn fold_pat_ident(f: &mut F, node: PatIdent) -> PatIdent where F: Fold + ?Sized, { PatIdent { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), by_ref: (node.by_ref).map(|it| Token![ref](tokens_helper(f, &it.span))), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), ident: f.fold_ident(node.ident), subpat: (node.subpat) .map(|it| ( Token![@](tokens_helper(f, &(it).0.spans)), Box::new(f.fold_pat(*(it).1)), )), } } #[cfg(feature = "full")] pub fn fold_pat_lit(f: &mut F, node: PatLit) -> PatLit where F: Fold + ?Sized, { PatLit { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), expr: Box::new(f.fold_expr(*node.expr)), } } #[cfg(feature = "full")] pub fn fold_pat_macro(f: &mut F, node: PatMacro) -> PatMacro where F: Fold + ?Sized, { PatMacro { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), mac: f.fold_macro(node.mac), } } #[cfg(feature = "full")] pub fn fold_pat_or(f: &mut F, node: PatOr) -> PatOr where F: Fold + ?Sized, { PatOr { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), leading_vert: (node.leading_vert) .map(|it| Token![|](tokens_helper(f, &it.spans))), cases: FoldHelper::lift(node.cases, |it| f.fold_pat(it)), } } #[cfg(feature = "full")] pub fn fold_pat_path(f: &mut F, node: PatPath) -> PatPath where F: Fold + ?Sized, { PatPath { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), qself: (node.qself).map(|it| f.fold_qself(it)), path: f.fold_path(node.path), } } #[cfg(feature = "full")] pub fn fold_pat_range(f: &mut F, node: PatRange) -> PatRange where F: Fold + ?Sized, { PatRange { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), lo: Box::new(f.fold_expr(*node.lo)), limits: f.fold_range_limits(node.limits), hi: Box::new(f.fold_expr(*node.hi)), } } #[cfg(feature = "full")] pub fn fold_pat_reference(f: &mut F, node: PatReference) -> PatReference where F: Fold + ?Sized, { PatReference { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), and_token: Token![&](tokens_helper(f, &node.and_token.spans)), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), pat: Box::new(f.fold_pat(*node.pat)), } } #[cfg(feature = "full")] pub fn fold_pat_rest(f: &mut F, node: PatRest) -> PatRest where F: Fold + ?Sized, { PatRest { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), dot2_token: Token![..](tokens_helper(f, &node.dot2_token.spans)), } } #[cfg(feature = "full")] pub fn fold_pat_slice(f: &mut F, node: PatSlice) -> PatSlice where F: Fold + ?Sized, { PatSlice { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)), } } #[cfg(feature = "full")] pub fn fold_pat_struct(f: &mut F, node: PatStruct) -> PatStruct where F: Fold + ?Sized, { PatStruct { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), path: f.fold_path(node.path), brace_token: Brace(tokens_helper(f, &node.brace_token.span)), fields: FoldHelper::lift(node.fields, |it| f.fold_field_pat(it)), dot2_token: (node.dot2_token).map(|it| Token![..](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] pub fn fold_pat_tuple(f: &mut F, node: PatTuple) -> PatTuple where F: Fold + ?Sized, { PatTuple { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), elems: FoldHelper::lift(node.elems, |it| f.fold_pat(it)), } } #[cfg(feature = "full")] pub fn fold_pat_tuple_struct(f: &mut F, node: PatTupleStruct) -> PatTupleStruct where F: Fold + ?Sized, { PatTupleStruct { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), path: f.fold_path(node.path), pat: f.fold_pat_tuple(node.pat), } } #[cfg(feature = "full")] pub fn fold_pat_type(f: &mut F, node: PatType) -> PatType where F: Fold + ?Sized, { PatType { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), pat: Box::new(f.fold_pat(*node.pat)), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), } } #[cfg(feature = "full")] pub fn fold_pat_wild(f: &mut F, node: PatWild) -> PatWild where F: Fold + ?Sized, { PatWild { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), underscore_token: Token![_](tokens_helper(f, &node.underscore_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_path(f: &mut F, node: Path) -> Path where F: Fold + ?Sized, { Path { leading_colon: (node.leading_colon) .map(|it| Token![::](tokens_helper(f, &it.spans))), segments: FoldHelper::lift(node.segments, |it| f.fold_path_segment(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_path_arguments(f: &mut F, node: PathArguments) -> PathArguments where F: Fold + ?Sized, { match node { PathArguments::None => PathArguments::None, PathArguments::AngleBracketed(_binding_0) => { PathArguments::AngleBracketed( f.fold_angle_bracketed_generic_arguments(_binding_0), ) } PathArguments::Parenthesized(_binding_0) => { PathArguments::Parenthesized( f.fold_parenthesized_generic_arguments(_binding_0), ) } } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_path_segment(f: &mut F, node: PathSegment) -> PathSegment where F: Fold + ?Sized, { PathSegment { ident: f.fold_ident(node.ident), arguments: f.fold_path_arguments(node.arguments), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_predicate_eq(f: &mut F, node: PredicateEq) -> PredicateEq where F: Fold + ?Sized, { PredicateEq { lhs_ty: f.fold_type(node.lhs_ty), eq_token: Token![=](tokens_helper(f, &node.eq_token.spans)), rhs_ty: f.fold_type(node.rhs_ty), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_predicate_lifetime( f: &mut F, node: PredicateLifetime, ) -> PredicateLifetime where F: Fold + ?Sized, { PredicateLifetime { lifetime: f.fold_lifetime(node.lifetime), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_predicate_type(f: &mut F, node: PredicateType) -> PredicateType where F: Fold + ?Sized, { PredicateType { lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)), bounded_ty: f.fold_type(node.bounded_ty), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_qself(f: &mut F, node: QSelf) -> QSelf where F: Fold + ?Sized, { QSelf { lt_token: Token![<](tokens_helper(f, &node.lt_token.spans)), ty: Box::new(f.fold_type(*node.ty)), position: node.position, as_token: (node.as_token).map(|it| Token![as](tokens_helper(f, &it.span))), gt_token: Token![>](tokens_helper(f, &node.gt_token.spans)), } } #[cfg(feature = "full")] pub fn fold_range_limits(f: &mut F, node: RangeLimits) -> RangeLimits where F: Fold + ?Sized, { match node { RangeLimits::HalfOpen(_binding_0) => { RangeLimits::HalfOpen(Token![..](tokens_helper(f, &_binding_0.spans))) } RangeLimits::Closed(_binding_0) => { RangeLimits::Closed(Token![..=](tokens_helper(f, &_binding_0.spans))) } } } #[cfg(feature = "full")] pub fn fold_receiver(f: &mut F, node: Receiver) -> Receiver where F: Fold + ?Sized, { Receiver { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), reference: (node.reference) .map(|it| ( Token![&](tokens_helper(f, &(it).0.spans)), ((it).1).map(|it| f.fold_lifetime(it)), )), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), self_token: Token![self](tokens_helper(f, &node.self_token.span)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_return_type(f: &mut F, node: ReturnType) -> ReturnType where F: Fold + ?Sized, { match node { ReturnType::Default => ReturnType::Default, ReturnType::Type(_binding_0, _binding_1) => { ReturnType::Type( Token![->](tokens_helper(f, &_binding_0.spans)), Box::new(f.fold_type(*_binding_1)), ) } } } #[cfg(feature = "full")] pub fn fold_signature(f: &mut F, node: Signature) -> Signature where F: Fold + ?Sized, { Signature { constness: (node.constness).map(|it| Token![const](tokens_helper(f, &it.span))), asyncness: (node.asyncness).map(|it| Token![async](tokens_helper(f, &it.span))), unsafety: (node.unsafety).map(|it| Token![unsafe](tokens_helper(f, &it.span))), abi: (node.abi).map(|it| f.fold_abi(it)), fn_token: Token![fn](tokens_helper(f, &node.fn_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), inputs: FoldHelper::lift(node.inputs, |it| f.fold_fn_arg(it)), variadic: (node.variadic).map(|it| f.fold_variadic(it)), output: f.fold_return_type(node.output), } } pub fn fold_span(f: &mut F, node: Span) -> Span where F: Fold + ?Sized, { node } #[cfg(feature = "full")] pub fn fold_stmt(f: &mut F, node: Stmt) -> Stmt where F: Fold + ?Sized, { match node { Stmt::Local(_binding_0) => Stmt::Local(f.fold_local(_binding_0)), Stmt::Item(_binding_0) => Stmt::Item(f.fold_item(_binding_0)), Stmt::Expr(_binding_0) => Stmt::Expr(f.fold_expr(_binding_0)), Stmt::Semi(_binding_0, _binding_1) => { Stmt::Semi( f.fold_expr(_binding_0), Token![;](tokens_helper(f, &_binding_1.spans)), ) } } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_trait_bound(f: &mut F, node: TraitBound) -> TraitBound where F: Fold + ?Sized, { TraitBound { paren_token: (node.paren_token).map(|it| Paren(tokens_helper(f, &it.span))), modifier: f.fold_trait_bound_modifier(node.modifier), lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)), path: f.fold_path(node.path), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_trait_bound_modifier( f: &mut F, node: TraitBoundModifier, ) -> TraitBoundModifier where F: Fold + ?Sized, { match node { TraitBoundModifier::None => TraitBoundModifier::None, TraitBoundModifier::Maybe(_binding_0) => { TraitBoundModifier::Maybe(Token![?](tokens_helper(f, &_binding_0.spans))) } } } #[cfg(feature = "full")] pub fn fold_trait_item(f: &mut F, node: TraitItem) -> TraitItem where F: Fold + ?Sized, { match node { TraitItem::Const(_binding_0) => { TraitItem::Const(f.fold_trait_item_const(_binding_0)) } TraitItem::Method(_binding_0) => { TraitItem::Method(f.fold_trait_item_method(_binding_0)) } TraitItem::Type(_binding_0) => { TraitItem::Type(f.fold_trait_item_type(_binding_0)) } TraitItem::Macro(_binding_0) => { TraitItem::Macro(f.fold_trait_item_macro(_binding_0)) } TraitItem::Verbatim(_binding_0) => TraitItem::Verbatim(_binding_0), #[cfg(syn_no_non_exhaustive)] _ => unreachable!(), } } #[cfg(feature = "full")] pub fn fold_trait_item_const(f: &mut F, node: TraitItemConst) -> TraitItemConst where F: Fold + ?Sized, { TraitItemConst { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), const_token: Token![const](tokens_helper(f, &node.const_token.span)), ident: f.fold_ident(node.ident), colon_token: Token![:](tokens_helper(f, &node.colon_token.spans)), ty: f.fold_type(node.ty), default: (node.default) .map(|it| (Token![=](tokens_helper(f, &(it).0.spans)), f.fold_expr((it).1))), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] pub fn fold_trait_item_macro(f: &mut F, node: TraitItemMacro) -> TraitItemMacro where F: Fold + ?Sized, { TraitItemMacro { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), mac: f.fold_macro(node.mac), semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] pub fn fold_trait_item_method(f: &mut F, node: TraitItemMethod) -> TraitItemMethod where F: Fold + ?Sized, { TraitItemMethod { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), sig: f.fold_signature(node.sig), default: (node.default).map(|it| f.fold_block(it)), semi_token: (node.semi_token).map(|it| Token![;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] pub fn fold_trait_item_type(f: &mut F, node: TraitItemType) -> TraitItemType where F: Fold + ?Sized, { TraitItemType { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), type_token: Token![type](tokens_helper(f, &node.type_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), default: (node.default) .map(|it| (Token![=](tokens_helper(f, &(it).0.spans)), f.fold_type((it).1))), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type(f: &mut F, node: Type) -> Type where F: Fold + ?Sized, { match node { Type::Array(_binding_0) => Type::Array(f.fold_type_array(_binding_0)), Type::BareFn(_binding_0) => Type::BareFn(f.fold_type_bare_fn(_binding_0)), Type::Group(_binding_0) => Type::Group(f.fold_type_group(_binding_0)), Type::ImplTrait(_binding_0) => { Type::ImplTrait(f.fold_type_impl_trait(_binding_0)) } Type::Infer(_binding_0) => Type::Infer(f.fold_type_infer(_binding_0)), Type::Macro(_binding_0) => Type::Macro(f.fold_type_macro(_binding_0)), Type::Never(_binding_0) => Type::Never(f.fold_type_never(_binding_0)), Type::Paren(_binding_0) => Type::Paren(f.fold_type_paren(_binding_0)), Type::Path(_binding_0) => Type::Path(f.fold_type_path(_binding_0)), Type::Ptr(_binding_0) => Type::Ptr(f.fold_type_ptr(_binding_0)), Type::Reference(_binding_0) => Type::Reference(f.fold_type_reference(_binding_0)), Type::Slice(_binding_0) => Type::Slice(f.fold_type_slice(_binding_0)), Type::TraitObject(_binding_0) => { Type::TraitObject(f.fold_type_trait_object(_binding_0)) } Type::Tuple(_binding_0) => Type::Tuple(f.fold_type_tuple(_binding_0)), Type::Verbatim(_binding_0) => Type::Verbatim(_binding_0), #[cfg(syn_no_non_exhaustive)] _ => unreachable!(), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_array(f: &mut F, node: TypeArray) -> TypeArray where F: Fold + ?Sized, { TypeArray { bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), elem: Box::new(f.fold_type(*node.elem)), semi_token: Token![;](tokens_helper(f, &node.semi_token.spans)), len: f.fold_expr(node.len), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_bare_fn(f: &mut F, node: TypeBareFn) -> TypeBareFn where F: Fold + ?Sized, { TypeBareFn { lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)), unsafety: (node.unsafety).map(|it| Token![unsafe](tokens_helper(f, &it.span))), abi: (node.abi).map(|it| f.fold_abi(it)), fn_token: Token![fn](tokens_helper(f, &node.fn_token.span)), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), inputs: FoldHelper::lift(node.inputs, |it| f.fold_bare_fn_arg(it)), variadic: (node.variadic).map(|it| f.fold_variadic(it)), output: f.fold_return_type(node.output), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_group(f: &mut F, node: TypeGroup) -> TypeGroup where F: Fold + ?Sized, { TypeGroup { group_token: Group(tokens_helper(f, &node.group_token.span)), elem: Box::new(f.fold_type(*node.elem)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_impl_trait(f: &mut F, node: TypeImplTrait) -> TypeImplTrait where F: Fold + ?Sized, { TypeImplTrait { impl_token: Token![impl](tokens_helper(f, &node.impl_token.span)), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_infer(f: &mut F, node: TypeInfer) -> TypeInfer where F: Fold + ?Sized, { TypeInfer { underscore_token: Token![_](tokens_helper(f, &node.underscore_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_macro(f: &mut F, node: TypeMacro) -> TypeMacro where F: Fold + ?Sized, { TypeMacro { mac: f.fold_macro(node.mac), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_never(f: &mut F, node: TypeNever) -> TypeNever where F: Fold + ?Sized, { TypeNever { bang_token: Token![!](tokens_helper(f, &node.bang_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_param(f: &mut F, node: TypeParam) -> TypeParam where F: Fold + ?Sized, { TypeParam { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), ident: f.fold_ident(node.ident), colon_token: (node.colon_token).map(|it| Token![:](tokens_helper(f, &it.spans))), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), eq_token: (node.eq_token).map(|it| Token![=](tokens_helper(f, &it.spans))), default: (node.default).map(|it| f.fold_type(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_param_bound(f: &mut F, node: TypeParamBound) -> TypeParamBound where F: Fold + ?Sized, { match node { TypeParamBound::Trait(_binding_0) => { TypeParamBound::Trait(f.fold_trait_bound(_binding_0)) } TypeParamBound::Lifetime(_binding_0) => { TypeParamBound::Lifetime(f.fold_lifetime(_binding_0)) } } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_paren(f: &mut F, node: TypeParen) -> TypeParen where F: Fold + ?Sized, { TypeParen { paren_token: Paren(tokens_helper(f, &node.paren_token.span)), elem: Box::new(f.fold_type(*node.elem)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_path(f: &mut F, node: TypePath) -> TypePath where F: Fold + ?Sized, { TypePath { qself: (node.qself).map(|it| f.fold_qself(it)), path: f.fold_path(node.path), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_ptr(f: &mut F, node: TypePtr) -> TypePtr where F: Fold + ?Sized, { TypePtr { star_token: Token![*](tokens_helper(f, &node.star_token.spans)), const_token: (node.const_token) .map(|it| Token![const](tokens_helper(f, &it.span))), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), elem: Box::new(f.fold_type(*node.elem)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_reference(f: &mut F, node: TypeReference) -> TypeReference where F: Fold + ?Sized, { TypeReference { and_token: Token![&](tokens_helper(f, &node.and_token.spans)), lifetime: (node.lifetime).map(|it| f.fold_lifetime(it)), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), elem: Box::new(f.fold_type(*node.elem)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_slice(f: &mut F, node: TypeSlice) -> TypeSlice where F: Fold + ?Sized, { TypeSlice { bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), elem: Box::new(f.fold_type(*node.elem)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_trait_object(f: &mut F, node: TypeTraitObject) -> TypeTraitObject where F: Fold + ?Sized, { TypeTraitObject { dyn_token: (node.dyn_token).map(|it| Token![dyn](tokens_helper(f, &it.span))), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_type_tuple(f: &mut F, node: TypeTuple) -> TypeTuple where F: Fold + ?Sized, { TypeTuple { paren_token: Paren(tokens_helper(f, &node.paren_token.span)), elems: FoldHelper::lift(node.elems, |it| f.fold_type(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_un_op(f: &mut F, node: UnOp) -> UnOp where F: Fold + ?Sized, { match node { UnOp::Deref(_binding_0) => { UnOp::Deref(Token![*](tokens_helper(f, &_binding_0.spans))) } UnOp::Not(_binding_0) => { UnOp::Not(Token![!](tokens_helper(f, &_binding_0.spans))) } UnOp::Neg(_binding_0) => { UnOp::Neg(Token![-](tokens_helper(f, &_binding_0.spans))) } } } #[cfg(feature = "full")] pub fn fold_use_glob(f: &mut F, node: UseGlob) -> UseGlob where F: Fold + ?Sized, { UseGlob { star_token: Token![*](tokens_helper(f, &node.star_token.spans)), } } #[cfg(feature = "full")] pub fn fold_use_group(f: &mut F, node: UseGroup) -> UseGroup where F: Fold + ?Sized, { UseGroup { brace_token: Brace(tokens_helper(f, &node.brace_token.span)), items: FoldHelper::lift(node.items, |it| f.fold_use_tree(it)), } } #[cfg(feature = "full")] pub fn fold_use_name(f: &mut F, node: UseName) -> UseName where F: Fold + ?Sized, { UseName { ident: f.fold_ident(node.ident), } } #[cfg(feature = "full")] pub fn fold_use_path(f: &mut F, node: UsePath) -> UsePath where F: Fold + ?Sized, { UsePath { ident: f.fold_ident(node.ident), colon2_token: Token![::](tokens_helper(f, &node.colon2_token.spans)), tree: Box::new(f.fold_use_tree(*node.tree)), } } #[cfg(feature = "full")] pub fn fold_use_rename(f: &mut F, node: UseRename) -> UseRename where F: Fold + ?Sized, { UseRename { ident: f.fold_ident(node.ident), as_token: Token![as](tokens_helper(f, &node.as_token.span)), rename: f.fold_ident(node.rename), } } #[cfg(feature = "full")] pub fn fold_use_tree(f: &mut F, node: UseTree) -> UseTree where F: Fold + ?Sized, { match node { UseTree::Path(_binding_0) => UseTree::Path(f.fold_use_path(_binding_0)), UseTree::Name(_binding_0) => UseTree::Name(f.fold_use_name(_binding_0)), UseTree::Rename(_binding_0) => UseTree::Rename(f.fold_use_rename(_binding_0)), UseTree::Glob(_binding_0) => UseTree::Glob(f.fold_use_glob(_binding_0)), UseTree::Group(_binding_0) => UseTree::Group(f.fold_use_group(_binding_0)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_variadic(f: &mut F, node: Variadic) -> Variadic where F: Fold + ?Sized, { Variadic { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), dots: Token![...](tokens_helper(f, &node.dots.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_variant(f: &mut F, node: Variant) -> Variant where F: Fold + ?Sized, { Variant { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), ident: f.fold_ident(node.ident), fields: f.fold_fields(node.fields), discriminant: (node.discriminant) .map(|it| (Token![=](tokens_helper(f, &(it).0.spans)), f.fold_expr((it).1))), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_vis_crate(f: &mut F, node: VisCrate) -> VisCrate where F: Fold + ?Sized, { VisCrate { crate_token: Token![crate](tokens_helper(f, &node.crate_token.span)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_vis_public(f: &mut F, node: VisPublic) -> VisPublic where F: Fold + ?Sized, { VisPublic { pub_token: Token![pub](tokens_helper(f, &node.pub_token.span)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_vis_restricted(f: &mut F, node: VisRestricted) -> VisRestricted where F: Fold + ?Sized, { VisRestricted { pub_token: Token![pub](tokens_helper(f, &node.pub_token.span)), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), in_token: (node.in_token).map(|it| Token![in](tokens_helper(f, &it.span))), path: Box::new(f.fold_path(*node.path)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_visibility(f: &mut F, node: Visibility) -> Visibility where F: Fold + ?Sized, { match node { Visibility::Public(_binding_0) => { Visibility::Public(f.fold_vis_public(_binding_0)) } Visibility::Crate(_binding_0) => Visibility::Crate(f.fold_vis_crate(_binding_0)), Visibility::Restricted(_binding_0) => { Visibility::Restricted(f.fold_vis_restricted(_binding_0)) } Visibility::Inherited => Visibility::Inherited, } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_where_clause(f: &mut F, node: WhereClause) -> WhereClause where F: Fold + ?Sized, { WhereClause { where_token: Token![where](tokens_helper(f, &node.where_token.span)), predicates: FoldHelper::lift(node.predicates, |it| f.fold_where_predicate(it)), } } #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_where_predicate(f: &mut F, node: WherePredicate) -> WherePredicate where F: Fold + ?Sized, { match node { WherePredicate::Type(_binding_0) => { WherePredicate::Type(f.fold_predicate_type(_binding_0)) } WherePredicate::Lifetime(_binding_0) => { WherePredicate::Lifetime(f.fold_predicate_lifetime(_binding_0)) } WherePredicate::Eq(_binding_0) => { WherePredicate::Eq(f.fold_predicate_eq(_binding_0)) } } }