pub struct NodeView<'a> {
pub node: &'a Node,
pub arena: &'a NodeArena,
pub index: NodeIndex,
}Expand description
A view into a node that provides convenient access to both the Node header and its type-specific data. This avoids the need to pass the arena around when working with node data.
Fields§
§node: &'a Node§arena: &'a NodeArena§index: NodeIndexImplementations§
Source§impl<'a> NodeView<'a>
impl<'a> NodeView<'a>
Sourcepub fn extended(&self) -> Option<&'a ExtendedNodeInfo>
pub fn extended(&self) -> Option<&'a ExtendedNodeInfo>
Get extended node info (parent, id, modifier/transform flags).
Sourcepub fn as_identifier(&self) -> Option<&'a IdentifierData>
pub fn as_identifier(&self) -> Option<&'a IdentifierData>
Get identifier data (for Identifier, PrivateIdentifier nodes).
Sourcepub fn as_literal(&self) -> Option<&'a LiteralData>
pub fn as_literal(&self) -> Option<&'a LiteralData>
Get literal data (for StringLiteral, NumericLiteral, etc.).
Sourcepub fn as_binary_expr(&self) -> Option<&'a BinaryExprData>
pub fn as_binary_expr(&self) -> Option<&'a BinaryExprData>
Get binary expression data
Sourcepub fn as_call_expr(&self) -> Option<&'a CallExprData>
pub fn as_call_expr(&self) -> Option<&'a CallExprData>
Get call expression data
Sourcepub fn as_function(&self) -> Option<&'a FunctionData>
pub fn as_function(&self) -> Option<&'a FunctionData>
Get function data
Sourcepub fn as_source_file(&self) -> Option<&'a SourceFileData>
pub fn as_source_file(&self) -> Option<&'a SourceFileData>
Get source file data
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for NodeView<'a>
impl<'a> RefUnwindSafe for NodeView<'a>
impl<'a> Send for NodeView<'a>
impl<'a> Sync for NodeView<'a>
impl<'a> Unpin for NodeView<'a>
impl<'a> UnsafeUnpin for NodeView<'a>
impl<'a> UnwindSafe for NodeView<'a>
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