pub trait NodeAccess {
// Required methods
fn node_info(&self, index: NodeIndex) -> Option<NodeInfo>;
fn kind(&self, index: NodeIndex) -> Option<u16>;
fn pos_end(&self, index: NodeIndex) -> Option<(u32, u32)>;
fn get_identifier_text(&self, index: NodeIndex) -> Option<&str>;
fn get_literal_text(&self, index: NodeIndex) -> Option<&str>;
fn get_children(&self, index: NodeIndex) -> Vec<NodeIndex>;
// Provided method
fn exists(&self, index: NodeIndex) -> bool { ... }
}Expand description
Trait for unified access to AST nodes across different arena implementations. This allows consumers (binder, checker, emitter) to work with either different arena implementations without code changes.
Required Methods§
Sourcefn get_identifier_text(&self, index: NodeIndex) -> Option<&str>
fn get_identifier_text(&self, index: NodeIndex) -> Option<&str>
Get identifier text (if this is an identifier node)
Sourcefn get_literal_text(&self, index: NodeIndex) -> Option<&str>
fn get_literal_text(&self, index: NodeIndex) -> Option<&str>
Get literal value text (if this is a literal node)
Sourcefn get_children(&self, index: NodeIndex) -> Vec<NodeIndex>
fn get_children(&self, index: NodeIndex) -> Vec<NodeIndex>
Get children of a node (for traversal)
Provided Methods§
Implementors§
impl NodeAccess for NodeArena
Implementation of NodeAccess for NodeArena