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.