pub trait AstNode {
    type Language: Language;

    fn can_cast(kind: <Self::Language as Language>::Kind) -> bool
    where
        Self: Sized
; fn cast(node: SyntaxNode<Self::Language>) -> Option<Self>
    where
        Self: Sized
; fn syntax(&self) -> &SyntaxNode<Self::Language>; 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 Associated Types

Required Methods

Provided Methods

Implementors