Struct sourcemap::Token

source ·
pub struct Token<'a> { /* private fields */ }
Expand description

Represents a token from a sourcemap

Implementations§

source§

impl<'a> Token<'a>

source

pub fn get_dst_line(&self) -> u32

get the destination (minified) line number

source

pub fn get_dst_col(&self) -> u32

get the destination (minified) column number

source

pub fn get_dst(&self) -> (u32, u32)

get the destination line and column

source

pub fn get_src_line(&self) -> u32

get the source line number

source

pub fn get_src_col(&self) -> u32

get the source column number

source

pub fn get_src(&self) -> (u32, u32)

get the source line and column

source

pub fn get_src_id(&self) -> u32

Return the source ID of the token

source

pub fn get_source(&self) -> Option<&'a str>

get the source if it exists as string

source

pub fn has_source(&self) -> bool

Is there a source for this token?

source

pub fn get_name(&self) -> Option<&'a str>

get the name if it exists as string

source

pub fn has_name(&self) -> bool

returns true if a name exists, false otherwise

source

pub fn get_name_id(&self) -> u32

Return the name ID of the token

source

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)

source

pub fn get_raw_token(&self) -> RawToken

Get the underlying raw token

source

pub fn get_source_view(&self) -> Option<&SourceView<'_>>

Returns the referenced source view.

Trait Implementations§

source§

impl<'a> Clone for Token<'a>

source§

fn clone(&self) -> Token<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Token<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Display for Token<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Ord for Token<'a>

source§

fn cmp(&self, other: &Token<'_>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<'a> PartialEq<Token<'a>> for Token<'a>

source§

fn eq(&self, other: &Token<'_>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialOrd<Token<'a>> for Token<'a>

source§

fn partial_cmp(&self, other: &Token<'_>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> Copy for Token<'a>

source§

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.