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>>, sources: Vec<Arc<str>>, source_contents: Option<Vec<Arc<str>>>, tokens: Vec<Token>, token_chunks: Option<Vec<TokenChunk>> ) -> Self
sourcepub fn from_json_string(value: &str) -> Result<Self, Error>
pub fn from_json_string(value: &str) -> Result<Self, Error>
Convert SourceMap to vlq sourcemap string.
sourcepub fn to_json_string(&self) -> String
pub fn to_json_string(&self) -> String
Convert the vlq sourcemap string to SourceMap.
sourcepub fn to_data_url(&self) -> String
pub fn to_data_url(&self) -> String
Convert SourceMap to vlq sourcemap data url.
pub fn get_file(&self) -> Option<&str>
pub fn set_file(&mut self, file: &str)
pub fn get_names(&self) -> impl Iterator<Item = &str>
pub fn get_sources(&self) -> impl Iterator<Item = &str>
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