syntax::ast

Trait AstToken

source
pub trait AstToken {
    // Required methods
    fn can_cast(token: SyntaxKind) -> bool
       where Self: Sized;
    fn cast(syntax: SyntaxToken) -> Option<Self>
       where Self: Sized;
    fn syntax(&self) -> &SyntaxToken;

    // Provided method
    fn text(&self) -> &str { ... }
}
Expand description

Like AstNode, but wraps tokens rather than interior nodes.

Required Methods§

source

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

source

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

source

fn syntax(&self) -> &SyntaxToken

Provided Methods§

source

fn text(&self) -> &str

Implementors§