Skip to main content

CppAstToken

Trait CppAstToken 

Source
pub trait CppAstToken {
    // Required methods
    fn syntax(&self) -> &CppSyntaxToken;
    fn can_cast(kind: CppTokenKind) -> bool
       where Self: Sized;
    fn cast(syntax: CppSyntaxToken) -> Option<Self>
       where Self: Sized;

    // Provided methods
    fn get_token_kind(&self) -> CppTokenKind { ... }
    fn get_token_data(&self) -> CppTokenData { ... }
    fn get_position(&self) -> TextSize { ... }
    fn get_range(&self) -> TextRange { ... }
    fn get_syntax_id(&self) -> CppSyntaxId { ... }
    fn get_text(&self) -> &str { ... }
    fn get_parent<N: CppAstNode>(&self) -> Option<N> { ... }
    fn ancestors<N: CppAstNode>(&self) -> impl Iterator<Item = N> { ... }
    fn dump(&self) -> String { ... }
}
Expand description

A typed syntax token.

Required Methods§

Source

fn syntax(&self) -> &CppSyntaxToken

Source

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

Source

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

Provided Methods§

Source

fn get_token_kind(&self) -> CppTokenKind

Source

fn get_token_data(&self) -> CppTokenData

The token’s own data, for callers that want to pass it around without the tree.

Source

fn get_position(&self) -> TextSize

Source

fn get_range(&self) -> TextRange

Source

fn get_syntax_id(&self) -> CppSyntaxId

Source

fn get_text(&self) -> &str

Source

fn get_parent<N: CppAstNode>(&self) -> Option<N>

Source

fn ancestors<N: CppAstNode>(&self) -> impl Iterator<Item = N>

Source

fn dump(&self) -> String

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§