pub struct Token<'a> { /* private fields */ }
Expand description
Represents a token from a sourcemap
Implementations
sourceimpl<'a> Token<'a>
impl<'a> Token<'a>
sourcepub fn get_dst_line(&self) -> u32
pub fn get_dst_line(&self) -> u32
get the destination (minified) line number
sourcepub fn get_dst_col(&self) -> u32
pub fn get_dst_col(&self) -> u32
get the destination (minified) column number
sourcepub fn get_src_line(&self) -> u32
pub fn get_src_line(&self) -> u32
get the source line number
sourcepub fn get_src_col(&self) -> u32
pub fn get_src_col(&self) -> u32
get the source column number
sourcepub fn get_src_id(&self) -> u32
pub fn get_src_id(&self) -> u32
Return the source ID of the token
sourcepub fn get_source(&self) -> Option<&'a str>
pub fn get_source(&self) -> Option<&'a str>
get the source if it exists as string
sourcepub fn has_source(&self) -> bool
pub fn has_source(&self) -> bool
Is there a source for this token?
sourcepub fn get_name_id(&self) -> u32
pub fn get_name_id(&self) -> u32
Return the name ID of the token
sourcepub fn to_tuple(&self) -> (&'a str, u32, u32, Option<&'a str>)
pub fn to_tuple(&self) -> (&'a str, u32, u32, Option<&'a str>)
Converts the token into a debug tuple in the form
(source, src_line, src_col, name)
sourcepub fn get_raw_token(&self) -> RawToken
pub fn get_raw_token(&self) -> RawToken
Get the underlying raw token
sourcepub fn get_source_view(&self) -> Option<&SourceView<'_>>
pub fn get_source_view(&self) -> Option<&SourceView<'_>>
Returns the referenced source view.
Trait Implementations
sourceimpl<'a> Ord for Token<'a>
impl<'a> Ord for Token<'a>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<'a> PartialOrd<Token<'a>> for Token<'a>
impl<'a> PartialOrd<Token<'a>> for Token<'a>
sourcefn partial_cmp(&self, other: &Token<'_>) -> Option<Ordering>
fn partial_cmp(&self, other: &Token<'_>) -> Option<Ordering>
1.0.0 · sourcefn 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<'a> Copy for Token<'a>
impl<'a> Eq for Token<'a>
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Token<'a>
impl<'a> !Send for Token<'a>
impl<'a> !Sync for Token<'a>
impl<'a> Unpin for Token<'a>
impl<'a> !UnwindSafe for Token<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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