Trait ra_ap_syntax::ast::AstNode
source · [−]pub trait AstNode {
fn can_cast(kind: SyntaxKind) -> bool
where
Self: Sized;
fn cast(syntax: SyntaxNode) -> Option<Self>
where
Self: Sized;
fn syntax(&self) -> &SyntaxNode;
fn clone_for_update(&self) -> Self
where
Self: Sized,
{ ... }
fn clone_subtree(&self) -> Self
where
Self: Sized,
{ ... }
}Expand description
The main trait to go from untyped SyntaxNode to a typed ast. The
conversion itself has zero runtime cost: ast and syntax nodes have exactly
the same representation: a pointer to the tree root and a pointer to the
node itself.
Required Methods
sourcefn can_cast(kind: SyntaxKind) -> boolwhere
fn can_cast(kind: SyntaxKind) -> boolwhere
Self: Sized,
sourcefn cast(syntax: SyntaxNode) -> Option<Self>where
fn cast(syntax: SyntaxNode) -> Option<Self>where
Self: Sized,
source
fn syntax(&self) -> &SyntaxNode
Provided Methods
sourcefn clone_for_update(&self) -> Selfwhere
fn clone_for_update(&self) -> Selfwhere
Self: Sized,
sourcefn clone_subtree(&self) -> Selfwhere