pub trait LuaAstNode {
// Required methods
fn syntax(&self) -> &LuaSyntaxNode;
fn can_cast(kind: LuaSyntaxKind) -> bool
where Self: Sized;
fn cast(syntax: LuaSyntaxNode) -> Option<Self>
where Self: Sized;
// Provided methods
fn child<N: LuaAstNode>(&self) -> Option<N> { ... }
fn token<N: LuaAstToken>(&self) -> Option<N> { ... }
fn token_by_kind(&self, kind: LuaTokenKind) -> Option<LuaGeneralToken> { ... }
fn tokens<N: LuaAstToken>(&self) -> LuaAstTokenChildren<N> ⓘ { ... }
fn children<N: LuaAstNode>(&self) -> LuaAstChildren<N> ⓘ { ... }
fn descendants<N: LuaAstNode>(&self) -> impl Iterator<Item = N> { ... }
fn ancestors<N: LuaAstNode>(&self) -> impl Iterator<Item = N> { ... }
fn dump(&self) { ... }
}Required Methods§
fn syntax(&self) -> &LuaSyntaxNode
fn can_cast(kind: LuaSyntaxKind) -> boolwhere
Self: Sized,
fn cast(syntax: LuaSyntaxNode) -> Option<Self>where
Self: Sized,
Provided Methods§
fn child<N: LuaAstNode>(&self) -> Option<N>
fn token<N: LuaAstToken>(&self) -> Option<N>
fn token_by_kind(&self, kind: LuaTokenKind) -> Option<LuaGeneralToken>
fn tokens<N: LuaAstToken>(&self) -> LuaAstTokenChildren<N> ⓘ
fn children<N: LuaAstNode>(&self) -> LuaAstChildren<N> ⓘ
fn descendants<N: LuaAstNode>(&self) -> impl Iterator<Item = N>
fn ancestors<N: LuaAstNode>(&self) -> impl Iterator<Item = N>
fn dump(&self)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.