Type Alias rowan::api::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.