pub struct AmberToken<'a> { /* private fields */ }Expand description
Leaf token in the amber syntax tree.
It’s a lightweight version of SyntaxToken without access to parent and siblings.
It’s much cheaper than SyntaxToken to create and use.
This is preferred to use for better performance if you don’t need to visit parent and siblings.
Implementations§
Source§impl<'a> AmberToken<'a>
impl<'a> AmberToken<'a>
Sourcepub fn kind(&self) -> SyntaxKind
pub fn kind(&self) -> SyntaxKind
Kind of this token.
Sourcepub fn text_range(&self) -> TextRange
pub fn text_range(&self) -> TextRange
The range that this token covers in the original text.
Sourcepub fn green(&self) -> &'a GreenToken
pub fn green(&self) -> &'a GreenToken
The underlying green token of this red token.
Trait Implementations§
Source§impl<'a> Clone for AmberToken<'a>
impl<'a> Clone for AmberToken<'a>
Source§fn clone(&self) -> AmberToken<'a>
fn clone(&self) -> AmberToken<'a>
Returns a duplicate 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<'a> From<&'a SyntaxToken> for AmberToken<'a>
impl<'a> From<&'a SyntaxToken> for AmberToken<'a>
Source§fn from(token: &'a SyntaxToken) -> Self
fn from(token: &'a SyntaxToken) -> Self
Converts to this type from the input type.
Source§impl<'a> From<AmberToken<'a>> for NodeOrToken<AmberNode<'a>, AmberToken<'a>>
impl<'a> From<AmberToken<'a>> for NodeOrToken<AmberNode<'a>, AmberToken<'a>>
Source§fn from(token: AmberToken<'a>) -> Self
fn from(token: AmberToken<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> Hash for AmberToken<'a>
impl<'a> Hash for AmberToken<'a>
Source§impl<'a> PartialEq for AmberToken<'a>
impl<'a> PartialEq for AmberToken<'a>
impl<'a> Copy for AmberToken<'a>
impl<'a> Eq for AmberToken<'a>
impl<'a> StructuralPartialEq for AmberToken<'a>
Auto Trait Implementations§
impl<'a> Freeze for AmberToken<'a>
impl<'a> RefUnwindSafe for AmberToken<'a>
impl<'a> Send for AmberToken<'a>
impl<'a> Sync for AmberToken<'a>
impl<'a> Unpin for AmberToken<'a>
impl<'a> UnsafeUnpin for AmberToken<'a>
impl<'a> UnwindSafe for AmberToken<'a>
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