Skip to main content

AstNode

Trait AstNode 

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

A typed wrapper over a bib CST node of a single SyntaxKind. Mirrors rust-analyzer’s AstNode (and crate::ast::AstNode): cast succeeds iff can_cast(node.kind()). Re-declared here rather than shared with the LaTeX side because the two CSTs have distinct SyntaxKind enums and Language markers.

Required Methods§

Source

fn can_cast(kind: SyntaxKind) -> bool
where Self: Sized,

Source

fn cast(syntax: SyntaxNode) -> Option<Self>
where Self: Sized,

Source

fn syntax(&self) -> &SyntaxNode

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§