Struct rowan::api::SyntaxToken
source · pub struct SyntaxToken<L: Language> { /* private fields */ }
Implementations§
source§impl<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 to, except with this token substituted. The complexity of the 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>>
SyntaxToken::parent_ancestors
insteadIterator 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§
source§impl<L: Clone + Language> Clone for SyntaxToken<L>
impl<L: Clone + Language> Clone for SyntaxToken<L>
source§fn clone(&self) -> SyntaxToken<L>
fn clone(&self) -> SyntaxToken<L>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<L: Language> Debug for SyntaxToken<L>
impl<L: Language> Debug for SyntaxToken<L>
source§impl<L: Language> Display for SyntaxToken<L>
impl<L: Language> Display for SyntaxToken<L>
source§impl<L: Language> From<SyntaxToken<L>> for SyntaxElement<L>
impl<L: Language> From<SyntaxToken<L>> for SyntaxElement<L>
source§fn from(token: SyntaxToken<L>) -> SyntaxElement<L>
fn from(token: SyntaxToken<L>) -> SyntaxElement<L>
Converts to this type from the input type.
source§impl<L: Language> From<SyntaxToken<L>> for SyntaxToken
impl<L: Language> From<SyntaxToken<L>> for SyntaxToken
source§fn from(token: SyntaxToken<L>) -> SyntaxToken
fn from(token: SyntaxToken<L>) -> SyntaxToken
Converts to this type from the input type.
source§impl<L: Language> From<SyntaxToken> for SyntaxToken<L>
impl<L: Language> From<SyntaxToken> for SyntaxToken<L>
source§fn from(raw: SyntaxToken) -> SyntaxToken<L>
fn from(raw: SyntaxToken) -> SyntaxToken<L>
Converts to this type from the input type.
source§impl<L: PartialEq + Language> PartialEq for SyntaxToken<L>
impl<L: PartialEq + Language> PartialEq for SyntaxToken<L>
source§fn 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 ==
.impl<L: Eq + Language> Eq for SyntaxToken<L>
impl<L: Language> StructuralPartialEq for SyntaxToken<L>
Auto Trait Implementations§
impl<L> Freeze for SyntaxToken<L>
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)