pub trait AstNode<'a>: Sized {
// Required methods
fn from_untyped(node: &'a SyntaxNode) -> Option<Self>;
fn to_untyped(self) -> &'a SyntaxNode;
fn placeholder() -> Self;
// Provided method
fn span(self) -> Span { ... }
}Expand description
A typed AST node.
Required Methods§
Sourcefn from_untyped(node: &'a SyntaxNode) -> Option<Self>
fn from_untyped(node: &'a SyntaxNode) -> Option<Self>
Convert a node into its typed variant.
Sourcefn to_untyped(self) -> &'a SyntaxNode
fn to_untyped(self) -> &'a SyntaxNode
A reference to the underlying syntax node.
Sourcefn placeholder() -> Self
fn placeholder() -> Self
A placeholder for this node type. If the underlying CST has syntax errors or did not come from the parser, the AST is not guaranteed to be valid. But instead of panicking in that case, we return placeholder nodes.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".