Struct cstree::syntax::SyntaxToken [−][src]
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]
I: Resolver,
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]
&self,
direction: Direction
) -> impl Iterator<Item = SyntaxElementRef<'_, L, D, R>>
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]
R: Resolver,
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]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<L: Language, D, R> Debug for SyntaxToken<L, D, R> where
R: Resolver,
[src]
R: Resolver,
impl<L: Language, D, R> Display for SyntaxToken<L, D, R> where
R: Resolver,
[src]
R: Resolver,
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]
fn from(token: &'a SyntaxToken<L, D, R>) -> Self
[src]
impl<L: Language, D, R> From<SyntaxToken<L, D, R>> for SyntaxElement<L, D, R>
[src]
fn from(token: SyntaxToken<L, D, R>) -> SyntaxElement<L, D, R>
[src]
impl<L: Language, D, R> Hash for SyntaxToken<L, D, R>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
T: Hash,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,