[][src]Module c2rust_refactor::ast_manip

General-purpose AST manipulation utilities. Everything in here works strictly on the AST, with no reliance on HIR or TyCtxt information.

Modules

ast_map
fn_edit

Helpers for rewriting all fn itemlikes, regardless of item kind.

lr_expr

fold_expr_with_context function, for rewriting exprs with knowledge of their contexts (rvalue / lvalue / mut lvalue).

number_nodes
util

Miscellaneous utility functions.

Traits

AstDeref
AstEquiv

Trait for checking equivalence of AST nodes. This is similar to PartialEq, but less strict, as it ignores some fields that have no bearing on the semantics of the AST (particularly Spans and NodeIds).

AstName
FlatMapNodes

Trait for AST node types that can be rewritten with a flat_map.

GetNodeId

Trait for obtaining the NodeId of a generic AST node.

GetSpan

Trait for obtaining the Span of a generic AST node.

ListNodeIds
MaybeGetNodeId
MutVisit

A trait for AST nodes that can accept a MutVisitor.

MutVisitNodes

Trait for AST node types that can be rewritten with a mutable visit.

Visit

A trait for AST nodes that can accept a Visitor.

VisitNode

Trait for AST node types that can be visited.

Functions

fold_blocks

Rewrite every block by manipulating a Cursor for the Stmts inside.

fold_modules

Rewrite every module by manipulating a Cursor for the Items inside.

fold_output_exprs

Rewrite function output/return expressions.

remove_paren
visit_nodes

Visit nodes of the callback's argument type within target. This function performs a preorder traversal.

visit_nodes_post

Visit nodes of the callback's argument type within target. This function performs a postorder traversal.