SourceMap

Struct SourceMap 

Source
pub struct SourceMap { /* private fields */ }

Implementations§

Source§

impl SourceMap

Source

pub fn new( file: Option<Arc<str>>, names: Vec<Arc<str>>, source_root: Option<String>, sources: Vec<Arc<str>>, source_contents: Vec<Option<Arc<str>>>, tokens: Box<[Token]>, token_chunks: Option<Vec<TokenChunk>>, ) -> Self

Source

pub fn from_json(value: JSONSourceMap) -> Result<Self, Error>

Convert the vlq sourcemap to to SourceMap.

§Errors

The serde_json deserialize Error.

Source

pub fn from_json_string(value: &str) -> Result<Self, Error>

Convert the vlq sourcemap string to SourceMap.

§Errors

The serde_json deserialize Error.

Source

pub fn to_json(&self) -> JSONSourceMap

Convert SourceMap to vlq sourcemap.

Source

pub fn to_json_string(&self) -> String

Convert SourceMap to vlq sourcemap string.

Source

pub fn to_data_url(&self) -> String

Convert SourceMap to vlq sourcemap data url.

Source

pub fn get_file(&self) -> Option<&Arc<str>>

Source

pub fn set_file(&mut self, file: &str)

Source

pub fn get_source_root(&self) -> Option<&str>

Source

pub fn get_x_google_ignore_list(&self) -> Option<&[u32]>

Source

pub fn set_x_google_ignore_list(&mut self, x_google_ignore_list: Vec<u32>)

Set x_google_ignoreList.

Source

pub fn set_debug_id(&mut self, debug_id: &str)

Source

pub fn get_debug_id(&self) -> Option<&str>

Source

pub fn get_names(&self) -> impl Iterator<Item = &Arc<str>>

Source

pub fn set_sources<S: AsRef<str>, I: IntoIterator<Item = S>>( &mut self, sources: I, )

Adjust sources.

Source

pub fn get_sources(&self) -> impl Iterator<Item = &Arc<str>>

Source

pub fn set_source_contents(&mut self, source_contents: Vec<Option<&str>>)

Adjust source_content.

Source

pub fn get_source_contents(&self) -> impl Iterator<Item = Option<&Arc<str>>>

Source

pub fn get_token(&self, index: u32) -> Option<Token>

Source

pub fn get_source_view_token(&self, index: u32) -> Option<SourceViewToken<'_>>

Source

pub fn get_tokens(&self) -> impl Iterator<Item = Token>

Get raw tokens.

Source

pub fn get_source_view_tokens( &self, ) -> impl Iterator<Item = SourceViewToken<'_>>

Get source view tokens. See SourceViewToken for more information.

Source

pub fn get_name(&self, id: u32) -> Option<&Arc<str>>

Source

pub fn get_source(&self, id: u32) -> Option<&Arc<str>>

Source

pub fn get_source_content(&self, id: u32) -> Option<&Arc<str>>

Source

pub fn get_source_and_content(&self, id: u32) -> Option<(&Arc<str>, &Arc<str>)>

Source

pub fn generate_lookup_table<'a>(&'a self) -> Vec<&'a [Token]>

Generate a lookup table, it will be used at lookup_token or lookup_source_view_token.

Source

pub fn lookup_token( &self, lookup_table: &[&'_ [Token]], line: u32, col: u32, ) -> Option<Token>

Lookup a token by line and column, it will used at remapping.

Source

pub fn lookup_source_view_token( &self, lookup_table: &[&'_ [Token]], line: u32, col: u32, ) -> Option<SourceViewToken<'_>>

Lookup a token by line and column, it will used at remapping. See SourceViewToken.

Trait Implementations§

Source§

impl Clone for SourceMap

Source§

fn clone(&self) -> SourceMap

Returns a duplicate 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 Debug for SourceMap

Source§

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

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

impl Default for SourceMap

Source§

fn default() -> SourceMap

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.