Struct cstree::syntax::SyntaxToken[][src]

pub struct SyntaxToken<L: Language, D: 'static = (), R: 'static = ()> { /* fields omitted */ }

Syntax tree token.

Implementations

impl<L: Language, D, R> SyntaxToken<L, D, R>[src]

pub fn debug(&self, resolver: &impl Resolver) -> String[src]

pub fn display(&self, resolver: &impl Resolver) -> String[src]

impl<L: Language, D, R> SyntaxToken<L, D, R>[src]

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

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

The internal representation of the kind of this token.

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

The kind of this token in terms of your language.

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

The range this token covers in the source text, in bytes.

pub fn resolve_text<'i, I: ?Sized>(&self, resolver: &'i I) -> &'i str where
    I: Resolver
[src]

Uses the provided resolver to return the source text of this token.

pub fn green(&self) -> &GreenToken[src]

Returns the unterlying green tree token of this token.

pub fn parent(&self) -> &SyntaxNode<L, D, R>[src]

The parent node of this token.

pub fn ancestors(&self) -> impl Iterator<Item = &SyntaxNode<L, D, R>>[src]

Returns an iterator along the chain of parents of this token.

pub fn next_sibling_or_token(&self) -> Option<SyntaxElementRef<'_, L, D, R>>[src]

The tree element to the right of this one, i.e. the next child of this token's parent after this token.

pub fn prev_sibling_or_token(&self) -> Option<SyntaxElementRef<'_, L, D, R>>[src]

The tree element to the left of this one, i.e. the previous child of this token's parent after this token.

pub fn siblings_with_tokens(
    &self,
    direction: Direction
) -> impl Iterator<Item = SyntaxElementRef<'_, L, D, R>>
[src]

Returns an iterator over all siblings of this token in the given direction, i.e. all of this token's parent's children from this token on to the left or the right. The first item in the iterator will always be this token.

pub fn next_token(&self) -> Option<&SyntaxToken<L, D, R>>[src]

Returns the next token in the tree. This is not necessary a direct sibling of this token, but will always be further right in the tree.

pub fn prev_token(&self) -> Option<&SyntaxToken<L, D, R>>[src]

Returns the previous token in the tree. This is not necessary a direct sibling of this token, but will always be further left in the tree.

impl<L: Language, D, R> SyntaxToken<L, D, R> where
    R: Resolver
[src]

pub fn text(&self) -> &str[src]

Uses the resolver associated with this tree to return the source text of this token.

Trait Implementations

impl<L: Language, D, R> Clone for SyntaxToken<L, D, R>[src]

impl<L: Language, D, R> Debug for SyntaxToken<L, D, R> where
    R: Resolver
[src]

impl<L: Language, D, R> Display for SyntaxToken<L, D, R> where
    R: Resolver
[src]

impl<L: Language, D, R> Eq for SyntaxToken<L, D, R>[src]

impl<'a, L: Language, D, R> From<&'a SyntaxToken<L, D, R>> for SyntaxElementRef<'a, L, D, R>[src]

impl<L: Language, D, R> From<SyntaxToken<L, D, R>> for SyntaxElement<L, D, R>[src]

impl<L: Language, D, R> Hash for SyntaxToken<L, D, R>[src]

impl<L: Language, D, R> PartialEq<SyntaxToken<L, D, R>> for SyntaxToken<L, D, R>[src]

Auto Trait Implementations

impl<L, D = (), R = ()> !RefUnwindSafe for SyntaxToken<L, D, R>

impl<L, D, R> Send for SyntaxToken<L, D, R>

impl<L, D, R> Sync for SyntaxToken<L, D, R>

impl<L, D, R> Unpin for SyntaxToken<L, D, R>

impl<L, D = (), R = ()> !UnwindSafe for SyntaxToken<L, D, R>

Blanket Implementations

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

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

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

impl<T> CallHasher for T where
    T: Hash

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.