pub trait AnyNode<'a>:
BasicNode<'a>
+ AnyNodeData
+ Display
+ Send
+ Sync {
// Required methods
fn id(&self) -> NodeId;
fn span(&self) -> Span;
fn order(&self) -> usize;
// Provided methods
fn human_span(&self) -> Span { ... }
fn get_parent(&self) -> Option<&'a dyn AnyNode<'a>> { ... }
fn link(&'a self, parent: Option<&'a dyn AnyNode<'a>>, order: &mut usize) { ... }
fn link_attach(&'a self, parent: &'a dyn AnyNode<'a>, order: usize) { ... }
fn as_ptr(&self) -> *const u8 { ... }
}Expand description
An AST node.
Required Methods§
Provided Methods§
Sourcefn human_span(&self) -> Span
fn human_span(&self) -> Span
Get a span that is terse and suitable to pinpoint the node for a human.
Sourcefn get_parent(&self) -> Option<&'a dyn AnyNode<'a>>
fn get_parent(&self) -> Option<&'a dyn AnyNode<'a>>
Get this node’s parent.
Sourcefn link_attach(&'a self, parent: &'a dyn AnyNode<'a>, order: usize)
fn link_attach(&'a self, parent: &'a dyn AnyNode<'a>, order: usize)
Link up this node as an expansion of another node.
All subnodes inherit the order from their parent. Useful if a node is generated as part of a later expansion/analysis pass, but needs to hook into the AST somewhere.