pub struct Arena { /* private fields */ }Expand description
Arena that owns all AST nodes and tokens
Implementations§
Source§impl Arena
impl Arena
Sourcepub fn alloc_node(&mut self, node: AstNode) -> NodeId
pub fn alloc_node(&mut self, node: AstNode) -> NodeId
Allocate a new node in the arena
Sourcepub fn get_node_mut(&mut self, id: NodeId) -> &mut AstNode
pub fn get_node_mut(&mut self, id: NodeId) -> &mut AstNode
Get a mutable reference to a node
Sourcepub fn alloc_token(&mut self, token: Token) -> TokenId
pub fn alloc_token(&mut self, token: Token) -> TokenId
Allocate a new token in the arena
Source§impl Arena
impl Arena
Sourcepub fn visit<F>(
&self,
root: NodeId,
f: &mut F,
options: Option<&dyn Any>,
) -> VisitControl
pub fn visit<F>( &self, root: NodeId, f: &mut F, options: Option<&dyn Any>, ) -> VisitControl
Visit all nodes depth-first starting from root.
The closure f receives (node_id, node, arena, depth, options) and returns
a VisitControl to guide traversal. options is an optional caller-supplied
context passed through to every invocation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Arena
impl RefUnwindSafe for Arena
impl Send for Arena
impl Sync for Arena
impl Unpin for Arena
impl UnsafeUnpin for Arena
impl UnwindSafe for Arena
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more