rowan::api

Type Alias SyntaxElement

Source
pub type SyntaxElement<L> = NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>;

Aliased Type§

enum SyntaxElement<L> {
    Node(SyntaxNode<L>),
    Token(SyntaxToken<L>),
}

Variants§

§

Node(SyntaxNode<L>)

§

Token(SyntaxToken<L>)

Implementations§

Source§

impl<L: Language> SyntaxElement<L>

Source

pub fn text_range(&self) -> TextRange

Source

pub fn index(&self) -> usize

Source

pub fn kind(&self) -> L::Kind

Source

pub fn parent(&self) -> Option<SyntaxNode<L>>

Source

pub fn ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>

Source

pub fn next_sibling_or_token(&self) -> Option<SyntaxElement<L>>

Source

pub fn prev_sibling_or_token(&self) -> Option<SyntaxElement<L>>

Source

pub fn detach(&self)

Trait Implementations§

Source§

impl<L: Language> From<NodeOrToken<SyntaxNode, SyntaxToken>> for SyntaxElement<L>

Source§

fn from(raw: SyntaxElement) -> SyntaxElement<L>

Converts to this type from the input type.
Source§

impl<L: Language> From<SyntaxNode<L>> for SyntaxElement<L>

Source§

fn from(node: SyntaxNode<L>) -> SyntaxElement<L>

Converts to this type from the input type.
Source§

impl<L: Language> From<SyntaxToken<L>> for SyntaxElement<L>

Source§

fn from(token: SyntaxToken<L>) -> SyntaxElement<L>

Converts to this type from the input type.