Trait cl_ast::ast_visitor::fold::Fold

source ·
pub trait Fold {
Show 72 methods // Provided methods fn fold_span(&mut self, extents: Span) -> Span { ... } fn fold_mutability(&mut self, mutability: Mutability) -> Mutability { ... } fn fold_visibility(&mut self, visibility: Visibility) -> Visibility { ... } fn fold_sym(&mut self, ident: Sym) -> Sym { ... } fn fold_literal(&mut self, lit: Literal) -> Literal { ... } fn fold_bool(&mut self, b: bool) -> bool { ... } fn fold_char(&mut self, c: char) -> char { ... } fn fold_int(&mut self, i: u128) -> u128 { ... } fn fold_string(&mut self, s: String) -> String { ... } fn fold_file(&mut self, f: File) -> File { ... } fn fold_attrs(&mut self, a: Attrs) -> Attrs { ... } fn fold_meta(&mut self, m: Meta) -> Meta { ... } fn fold_meta_kind(&mut self, kind: MetaKind) -> MetaKind { ... } fn fold_item(&mut self, i: Item) -> Item { ... } fn fold_item_kind(&mut self, kind: ItemKind) -> ItemKind { ... } fn fold_alias(&mut self, a: Alias) -> Alias { ... } fn fold_const(&mut self, c: Const) -> Const { ... } fn fold_static(&mut self, s: Static) -> Static { ... } fn fold_module(&mut self, m: Module) -> Module { ... } fn fold_module_kind(&mut self, m: ModuleKind) -> ModuleKind { ... } fn fold_function(&mut self, f: Function) -> Function { ... } fn fold_param(&mut self, p: Param) -> Param { ... } fn fold_struct(&mut self, s: Struct) -> Struct { ... } fn fold_struct_kind(&mut self, kind: StructKind) -> StructKind { ... } fn fold_struct_member(&mut self, m: StructMember) -> StructMember { ... } fn fold_enum(&mut self, e: Enum) -> Enum { ... } fn fold_enum_kind(&mut self, kind: EnumKind) -> EnumKind { ... } fn fold_variant(&mut self, v: Variant) -> Variant { ... } fn fold_variant_kind(&mut self, kind: VariantKind) -> VariantKind { ... } fn fold_impl(&mut self, i: Impl) -> Impl { ... } fn fold_impl_kind(&mut self, kind: ImplKind) -> ImplKind { ... } fn fold_use(&mut self, u: Use) -> Use { ... } fn fold_use_tree(&mut self, tree: UseTree) -> UseTree { ... } fn fold_ty(&mut self, t: Ty) -> Ty { ... } fn fold_ty_kind(&mut self, kind: TyKind) -> TyKind { ... } fn fold_ty_tuple(&mut self, t: TyTuple) -> TyTuple { ... } fn fold_ty_ref(&mut self, t: TyRef) -> TyRef { ... } fn fold_ty_fn(&mut self, t: TyFn) -> TyFn { ... } fn fold_path(&mut self, p: Path) -> Path { ... } fn fold_path_part(&mut self, p: PathPart) -> PathPart { ... } fn fold_stmt(&mut self, s: Stmt) -> Stmt { ... } fn fold_stmt_kind(&mut self, kind: StmtKind) -> StmtKind { ... } fn fold_semi(&mut self, s: Semi) -> Semi { ... } fn fold_let(&mut self, l: Let) -> Let { ... } fn fold_expr(&mut self, e: Expr) -> Expr { ... } fn fold_expr_kind(&mut self, kind: ExprKind) -> ExprKind { ... } fn fold_assign(&mut self, a: Assign) -> Assign { ... } fn fold_modify(&mut self, m: Modify) -> Modify { ... } fn fold_modify_kind(&mut self, kind: ModifyKind) -> ModifyKind { ... } fn fold_binary(&mut self, b: Binary) -> Binary { ... } fn fold_binary_kind(&mut self, kind: BinaryKind) -> BinaryKind { ... } fn fold_unary(&mut self, u: Unary) -> Unary { ... } fn fold_unary_kind(&mut self, kind: UnaryKind) -> UnaryKind { ... } fn fold_member(&mut self, m: Member) -> Member { ... } fn fold_member_kind(&mut self, kind: MemberKind) -> MemberKind { ... } fn fold_index(&mut self, i: Index) -> Index { ... } fn fold_structor(&mut self, s: Structor) -> Structor { ... } fn fold_fielder(&mut self, f: Fielder) -> Fielder { ... } fn fold_array(&mut self, a: Array) -> Array { ... } fn fold_array_rep(&mut self, a: ArrayRep) -> ArrayRep { ... } fn fold_addrof(&mut self, a: AddrOf) -> AddrOf { ... } fn fold_block(&mut self, b: Block) -> Block { ... } fn fold_group(&mut self, g: Group) -> Group { ... } fn fold_tuple(&mut self, t: Tuple) -> Tuple { ... } fn fold_loop(&mut self, l: Loop) -> Loop { ... } fn fold_while(&mut self, w: While) -> While { ... } fn fold_if(&mut self, i: If) -> If { ... } fn fold_for(&mut self, f: For) -> For { ... } fn fold_else(&mut self, e: Else) -> Else { ... } fn fold_break(&mut self, b: Break) -> Break { ... } fn fold_return(&mut self, r: Return) -> Return { ... } fn fold_continue(&mut self, c: Continue) -> Continue { ... }
}
Expand description

Deconstructs the entire AST, and reconstructs it from scratch.

Each method acts as a customization point.

There are a set of default implementations for enums under the name or_fold_*, provided for ease of use.

For all other nodes, traversal is explicit.

Provided Methods§

source

fn fold_span(&mut self, extents: Span) -> Span

source

fn fold_mutability(&mut self, mutability: Mutability) -> Mutability

source

fn fold_visibility(&mut self, visibility: Visibility) -> Visibility

source

fn fold_sym(&mut self, ident: Sym) -> Sym

source

fn fold_literal(&mut self, lit: Literal) -> Literal

source

fn fold_bool(&mut self, b: bool) -> bool

source

fn fold_char(&mut self, c: char) -> char

source

fn fold_int(&mut self, i: u128) -> u128

source

fn fold_string(&mut self, s: String) -> String

source

fn fold_file(&mut self, f: File) -> File

source

fn fold_attrs(&mut self, a: Attrs) -> Attrs

source

fn fold_meta(&mut self, m: Meta) -> Meta

source

fn fold_meta_kind(&mut self, kind: MetaKind) -> MetaKind

source

fn fold_item(&mut self, i: Item) -> Item

source

fn fold_item_kind(&mut self, kind: ItemKind) -> ItemKind

source

fn fold_alias(&mut self, a: Alias) -> Alias

source

fn fold_const(&mut self, c: Const) -> Const

source

fn fold_static(&mut self, s: Static) -> Static

source

fn fold_module(&mut self, m: Module) -> Module

source

fn fold_module_kind(&mut self, m: ModuleKind) -> ModuleKind

source

fn fold_function(&mut self, f: Function) -> Function

source

fn fold_param(&mut self, p: Param) -> Param

source

fn fold_struct(&mut self, s: Struct) -> Struct

source

fn fold_struct_kind(&mut self, kind: StructKind) -> StructKind

source

fn fold_struct_member(&mut self, m: StructMember) -> StructMember

source

fn fold_enum(&mut self, e: Enum) -> Enum

source

fn fold_enum_kind(&mut self, kind: EnumKind) -> EnumKind

source

fn fold_variant(&mut self, v: Variant) -> Variant

source

fn fold_variant_kind(&mut self, kind: VariantKind) -> VariantKind

source

fn fold_impl(&mut self, i: Impl) -> Impl

source

fn fold_impl_kind(&mut self, kind: ImplKind) -> ImplKind

source

fn fold_use(&mut self, u: Use) -> Use

source

fn fold_use_tree(&mut self, tree: UseTree) -> UseTree

source

fn fold_ty(&mut self, t: Ty) -> Ty

source

fn fold_ty_kind(&mut self, kind: TyKind) -> TyKind

source

fn fold_ty_tuple(&mut self, t: TyTuple) -> TyTuple

source

fn fold_ty_ref(&mut self, t: TyRef) -> TyRef

source

fn fold_ty_fn(&mut self, t: TyFn) -> TyFn

source

fn fold_path(&mut self, p: Path) -> Path

source

fn fold_path_part(&mut self, p: PathPart) -> PathPart

source

fn fold_stmt(&mut self, s: Stmt) -> Stmt

source

fn fold_stmt_kind(&mut self, kind: StmtKind) -> StmtKind

source

fn fold_semi(&mut self, s: Semi) -> Semi

source

fn fold_let(&mut self, l: Let) -> Let

source

fn fold_expr(&mut self, e: Expr) -> Expr

source

fn fold_expr_kind(&mut self, kind: ExprKind) -> ExprKind

source

fn fold_assign(&mut self, a: Assign) -> Assign

source

fn fold_modify(&mut self, m: Modify) -> Modify

source

fn fold_modify_kind(&mut self, kind: ModifyKind) -> ModifyKind

source

fn fold_binary(&mut self, b: Binary) -> Binary

source

fn fold_binary_kind(&mut self, kind: BinaryKind) -> BinaryKind

source

fn fold_unary(&mut self, u: Unary) -> Unary

source

fn fold_unary_kind(&mut self, kind: UnaryKind) -> UnaryKind

source

fn fold_member(&mut self, m: Member) -> Member

source

fn fold_member_kind(&mut self, kind: MemberKind) -> MemberKind

source

fn fold_index(&mut self, i: Index) -> Index

source

fn fold_structor(&mut self, s: Structor) -> Structor

source

fn fold_fielder(&mut self, f: Fielder) -> Fielder

source

fn fold_array(&mut self, a: Array) -> Array

source

fn fold_array_rep(&mut self, a: ArrayRep) -> ArrayRep

source

fn fold_addrof(&mut self, a: AddrOf) -> AddrOf

source

fn fold_block(&mut self, b: Block) -> Block

source

fn fold_group(&mut self, g: Group) -> Group

source

fn fold_tuple(&mut self, t: Tuple) -> Tuple

source

fn fold_loop(&mut self, l: Loop) -> Loop

source

fn fold_while(&mut self, w: While) -> While

source

fn fold_if(&mut self, i: If) -> If

source

fn fold_for(&mut self, f: For) -> For

source

fn fold_else(&mut self, e: Else) -> Else

source

fn fold_break(&mut self, b: Break) -> Break

source

fn fold_return(&mut self, r: Return) -> Return

source

fn fold_continue(&mut self, c: Continue) -> Continue

Implementors§