Skip to main content

AstNode

Trait AstNode 

Source
pub trait AstNode: Sized {
    // Required methods
    fn can_cast(kind: SyntaxKind) -> bool;
    fn cast(node: GdNode) -> Option<Self>;
    fn syntax(&self) -> &GdNode;
}
Expand description

A typed node: a checked view over a red node of one SyntaxKind.

Required Methods§

Source

fn can_cast(kind: SyntaxKind) -> bool

Whether a node of kind can be viewed as Self.

Source

fn cast(node: GdNode) -> Option<Self>

View node as Self, if its kind matches.

Source

fn syntax(&self) -> &GdNode

The underlying red node.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§