Struct oxc_sourcemap::SourceMap
source · pub struct SourceMap { /* private fields */ }
Implementations§
source§impl SourceMap
impl SourceMap
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
sourcepub fn from_json(value: JSONSourceMap) -> Result<Self, Error>
pub fn from_json(value: JSONSourceMap) -> Result<Self, Error>
sourcepub fn from_json_string(value: &str) -> Result<Self, Error>
pub fn from_json_string(value: &str) -> Result<Self, Error>
sourcepub fn to_json_string(&self) -> Result<String, Error>
pub fn to_json_string(&self) -> Result<String, Error>
sourcepub fn to_data_url(&self) -> Result<String, Error>
pub fn to_data_url(&self) -> Result<String, Error>
pub fn get_file(&self) -> Option<&str>
pub fn set_file(&mut self, file: &str)
pub fn get_source_root(&self) -> Option<&str>
sourcepub fn set_x_google_ignore_list(&mut self, x_google_ignore_list: Vec<u32>)
pub fn set_x_google_ignore_list(&mut self, x_google_ignore_list: Vec<u32>)
Set x_google_ignoreList
.
pub fn get_names(&self) -> impl Iterator<Item = &str>
sourcepub fn set_sources(&mut self, sources: Vec<&str>)
pub fn set_sources(&mut self, sources: Vec<&str>)
Adjust sources
.
pub fn get_sources(&self) -> impl Iterator<Item = &str>
sourcepub fn set_source_contents(&mut self, source_contents: Vec<&str>)
pub fn set_source_contents(&mut self, source_contents: Vec<&str>)
Adjust source_content
.
pub fn get_source_contents(&self) -> Option<impl Iterator<Item = &str>>
pub fn get_token(&self, index: u32) -> Option<&Token>
pub fn get_source_view_token(&self, index: u32) -> Option<SourceViewToken<'_>>
sourcepub fn get_tokens(&self) -> impl Iterator<Item = &Token>
pub fn get_tokens(&self) -> impl Iterator<Item = &Token>
Get raw tokens.
sourcepub fn get_source_view_tokens(
&self,
) -> impl Iterator<Item = SourceViewToken<'_>>
pub fn get_source_view_tokens( &self, ) -> impl Iterator<Item = SourceViewToken<'_>>
Get source view tokens. See SourceViewToken
for more information.
pub fn get_name(&self, id: u32) -> Option<&str>
pub fn get_source(&self, id: u32) -> Option<&str>
pub fn get_source_content(&self, id: u32) -> Option<&str>
pub fn get_source_and_content(&self, id: u32) -> Option<(&str, &str)>
sourcepub fn generate_lookup_table(&self) -> Vec<(u32, u32, u32)>
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
.
sourcepub fn lookup_token(
&self,
lookup_table: &[(u32, u32, u32)],
line: u32,
col: u32,
) -> Option<&Token>
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.
sourcepub fn lookup_source_view_token(
&self,
lookup_table: &[(u32, u32, u32)],
line: u32,
col: u32,
) -> Option<SourceViewToken<'_>>
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§
Auto Trait Implementations§
impl Freeze for SourceMap
impl RefUnwindSafe for SourceMap
impl Send for SourceMap
impl Sync for SourceMap
impl Unpin for SourceMap
impl UnwindSafe for SourceMap
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