pub trait AstNode {
// Required methods
fn cast(node: &NodeOrToken) -> Option<Self>
where Self: Sized;
fn range(&self) -> Range<usize>;
// Provided method
fn iter(&self) -> ChildIter<'_> { ... }
}
Expand description
A trait for types that exist in the AST.
Implementations of this type are generally generated via macro.
Required Methods§
Sourcefn cast(node: &NodeOrToken) -> Option<Self>where
Self: Sized,
fn cast(node: &NodeOrToken) -> Option<Self>where
Self: Sized,
Attempt to cast from some node or token to this type.