Struct oxc_sourcemap::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: Option<Vec<Arc<str>>>, tokens: Vec<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_string(&self) -> Result<String, Error>

Convert SourceMap to vlq sourcemap string.

§Errors

The serde_json serialization Error.

source

pub fn to_data_url(&self) -> Result<String, Error>

Convert SourceMap to vlq sourcemap data url.

§Errors

The serde_json serialization Error.

source

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

source

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

source

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

source

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

Set x_google_ignoreList.

source

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

source

pub fn set_sources(&mut self, sources: Vec<&str>)

Adjust sources.

source

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

source

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

Adjust source_content.

source

pub fn get_source_contents(&self) -> Option<impl Iterator<Item = &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<&str>

source

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

source

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

source

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

source

pub fn generate_lookup_table(&self) -> Vec<(u32, u32, u32)>

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

source

pub fn lookup_token( &self, lookup_table: &[(u32, u32, u32)], 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: &[(u32, u32, u32)], 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 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 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> 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,

§

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>,

§

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>,

§

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.