Struct rowan::api::SyntaxToken
source · [−]pub struct SyntaxToken<L: Language> { /* private fields */ }
Implementations
sourceimpl<L: Language> SyntaxToken<L>
impl<L: Language> SyntaxToken<L>
sourcepub fn replace_with(&self, new_token: GreenToken) -> GreenNode
pub fn replace_with(&self, new_token: GreenToken) -> GreenNode
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 kind(&self) -> L::Kind
pub fn text_range(&self) -> TextRange
pub fn index(&self) -> usize
pub fn text(&self) -> &str
pub fn green(&self) -> &GreenTokenData
pub fn parent(&self) -> Option<SyntaxNode<L>>
sourcepub fn ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>
👎 Deprecated: use SyntaxToken::parent_ancestors
instead
pub fn ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>
use SyntaxToken::parent_ancestors
instead
Iterator over all the ancestors of this token excluding itself.
sourcepub fn parent_ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>
pub fn parent_ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>
Iterator over all the ancestors of this token excluding itself.
pub fn next_sibling_or_token(&self) -> Option<SyntaxElement<L>>
pub fn prev_sibling_or_token(&self) -> Option<SyntaxElement<L>>
pub fn siblings_with_tokens(
&self,
direction: Direction
) -> impl Iterator<Item = SyntaxElement<L>>
sourcepub fn next_token(&self) -> Option<SyntaxToken<L>>
pub fn next_token(&self) -> Option<SyntaxToken<L>>
Next token in the tree (i.e, not necessary a sibling).
sourcepub fn prev_token(&self) -> Option<SyntaxToken<L>>
pub fn prev_token(&self) -> Option<SyntaxToken<L>>
Previous token in the tree (i.e, not necessary a sibling).
pub fn detach(&self)
Trait Implementations
sourceimpl<L: Clone + Language> Clone for SyntaxToken<L>
impl<L: Clone + Language> Clone for SyntaxToken<L>
sourcefn clone(&self) -> SyntaxToken<L>
fn clone(&self) -> SyntaxToken<L>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<L: Language> Debug for SyntaxToken<L>
impl<L: Language> Debug for SyntaxToken<L>
sourceimpl<L: Language> Display for SyntaxToken<L>
impl<L: Language> Display for SyntaxToken<L>
sourceimpl<L: Language> From<SyntaxToken<L>> for SyntaxElement<L>
impl<L: Language> From<SyntaxToken<L>> for SyntaxElement<L>
sourcefn from(token: SyntaxToken<L>) -> SyntaxElement<L>
fn from(token: SyntaxToken<L>) -> SyntaxElement<L>
Converts to this type from the input type.
sourceimpl<L: Language> From<SyntaxToken<L>> for SyntaxToken
impl<L: Language> From<SyntaxToken<L>> for SyntaxToken
sourcefn from(token: SyntaxToken<L>) -> SyntaxToken
fn from(token: SyntaxToken<L>) -> SyntaxToken
Converts to this type from the input type.
sourceimpl<L: Language> From<SyntaxToken> for SyntaxToken<L>
impl<L: Language> From<SyntaxToken> for SyntaxToken<L>
sourcefn from(raw: SyntaxToken) -> SyntaxToken<L>
fn from(raw: SyntaxToken) -> SyntaxToken<L>
Converts to this type from the input type.
sourceimpl<L: Hash + Language> Hash for SyntaxToken<L>
impl<L: Hash + Language> Hash for SyntaxToken<L>
sourceimpl<L: PartialEq + Language> PartialEq<SyntaxToken<L>> for SyntaxToken<L>
impl<L: PartialEq + Language> PartialEq<SyntaxToken<L>> for SyntaxToken<L>
sourcefn eq(&self, other: &SyntaxToken<L>) -> bool
fn eq(&self, other: &SyntaxToken<L>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SyntaxToken<L>) -> bool
fn ne(&self, other: &SyntaxToken<L>) -> bool
This method tests for !=
.
impl<L: Eq + Language> Eq for SyntaxToken<L>
impl<L: Language> StructuralEq for SyntaxToken<L>
impl<L: Language> StructuralPartialEq for SyntaxToken<L>
Auto Trait Implementations
impl<L> !RefUnwindSafe for SyntaxToken<L>
impl<L> !Send for SyntaxToken<L>
impl<L> !Sync for SyntaxToken<L>
impl<L> Unpin for SyntaxToken<L> where
L: Unpin,
impl<L> !UnwindSafe for SyntaxToken<L>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more