Enum sourcemap::DecodedMap
source · [−]pub enum DecodedMap {
Regular(SourceMap),
Index(SourceMapIndex),
Hermes(SourceMapHermes),
}
Expand description
Represents the result of a decode operation
This represents either an actual sourcemap or a source map index. Usually the two things are too distinct to provide a common interface however for token lookup and writing back into a writer general methods are provided.
Variants
Regular(SourceMap)
Indicates a regular sourcemap
Index(SourceMapIndex)
Indicates a sourcemap index
Hermes(SourceMapHermes)
Indicates a sourcemap as generated by Metro+Hermes, as used by react-native
Implementations
sourceimpl DecodedMap
impl DecodedMap
sourcepub fn from_reader<R: Read>(rdr: R) -> Result<DecodedMap>
pub fn from_reader<R: Read>(rdr: R) -> Result<DecodedMap>
Alias for decode
.
sourcepub fn lookup_token(&self, line: u32, col: u32) -> Option<Token<'_>>
pub fn lookup_token(&self, line: u32, col: u32) -> Option<Token<'_>>
Shortcut to look up a token on either an index or a regular sourcemap. This method can only be used if the contained index actually contains embedded maps or it will not be able to look up anything.
sourcepub fn get_original_function_name(
&self,
line: u32,
col: u32,
minified_name: Option<&str>,
source_view: Option<&SourceView<'_>>
) -> Option<&str>
pub fn get_original_function_name(
&self,
line: u32,
col: u32,
minified_name: Option<&str>,
source_view: Option<&SourceView<'_>>
) -> Option<&str>
Returns the original function name.
minified_name
and source_view
are not always necessary. For
instance hermes source maps can provide this information without
access to the original sources.
Trait Implementations
sourceimpl Clone for DecodedMap
impl Clone for DecodedMap
sourcefn clone(&self) -> DecodedMap
fn clone(&self) -> DecodedMap
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more