pub struct TokenId(/* private fields */);
Expand description
A TokenId represents a unique value that is used to access a token. A token ID cannot be created directly by the user. Instead, the value must be taken from the AST.
Implementations§
source§impl TokenId
impl TokenId
The TokenId represents an index into an array of tokens.
As access is restricted (only the token stream creates and raw access to the
vector of tokens is done using the parse context), a TokenId
is always guaranteed to
point to a valid token.
pub fn pos<'a>(&'a self, ctx: &'a dyn TokenAccess) -> &SrcPos
Trait Implementations§
source§impl HasTokenSpan for TokenId
impl HasTokenSpan for TokenId
fn get_start_token(&self) -> TokenId
fn get_end_token(&self) -> TokenId
fn get_token_slice<'a>(&self, tokens: &'a dyn TokenAccess) -> &'a [Token]
fn get_pos(&self, tokens: &dyn TokenAccess) -> SrcPos
fn get_span(&self, ctx: &dyn TokenAccess) -> SrcPos
fn span(&self) -> TokenSpan
source§impl Ord for TokenId
impl Ord for TokenId
source§impl PartialEq for TokenId
impl PartialEq for TokenId
source§impl PartialOrd for TokenId
impl PartialOrd for TokenId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for TokenId
impl Eq for TokenId
impl StructuralPartialEq for TokenId
Auto Trait Implementations§
impl Freeze for TokenId
impl RefUnwindSafe for TokenId
impl Send for TokenId
impl Sync for TokenId
impl Unpin for TokenId
impl UnwindSafe for TokenId
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more