[][src]Struct rowan::SyntaxToken

pub struct SyntaxToken<'a> { /* fields omitted */ }

A token (leaf node) in a syntax tree.

A token can't exist in isolation, it is always attached to a parent Node.

Methods

impl<'a> SyntaxToken<'a>[src]

pub fn kind(&self) -> SyntaxKind[src]

Kind of this token.

pub fn text(&self) -> &'a SmolStr[src]

Text of this token.

pub fn range(&self) -> TextRange[src]

Text range, covered by this token.

pub fn parent(&self) -> &'a SyntaxNode[src]

Parent node, containing this token.

pub fn next_sibling_or_token(&self) -> Option<SyntaxElement<'a>>[src]

Next sibling of this tokens, including both nodes and tokens.

pub fn prev_sibling_or_token(&self) -> Option<SyntaxElement<'a>>[src]

Previous sibling of this tokens, including both nodes and tokens.

pub fn next_token(&self) -> Option<SyntaxToken<'a>>[src]

Next token in the file (i.e, not necessary a sibling)

pub fn prev_token(&self) -> Option<SyntaxToken<'a>>[src]

Previous token in the file (i.e, not necessary a sibling)

pub fn replace_with(&self, replacement: GreenToken) -> GreenNode[src]

Returns a green tree, equal to the green tree this token belongs two, except with this token substitute. The complexity of operation is proportional to the depth of the tree

Trait Implementations

impl<'a> From<SyntaxToken<'a>> for SyntaxElement<'a>[src]

impl<'a> PartialEq<SyntaxToken<'a>> for SyntaxToken<'a>[src]

impl<'a> Clone for SyntaxToken<'a>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> Eq for SyntaxToken<'a>[src]

impl<'a> Copy for SyntaxToken<'a>[src]

impl<'a> Display for SyntaxToken<'a>[src]

impl<'a> Debug for SyntaxToken<'a>[src]

impl<'a> Hash for SyntaxToken<'a>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl<'a> Unpin for SyntaxToken<'a>

impl<'a> Sync for SyntaxToken<'a>

impl<'a> Send for SyntaxToken<'a>

impl<'a> RefUnwindSafe for SyntaxToken<'a>

impl<'a> UnwindSafe for SyntaxToken<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]