Struct sourcemap::SourceView
source · pub struct SourceView<'a> { /* private fields */ }
Expand description
Provides efficient access to minified sources.
This type is used to implement fairly efficient source mapping operations.
Implementations§
source§impl<'a> SourceView<'a>
impl<'a> SourceView<'a>
sourcepub fn new(source: &'a str) -> SourceView<'a>
pub fn new(source: &'a str) -> SourceView<'a>
Creates an optimized view of a given source.
sourcepub fn from_string(source: String) -> SourceView<'static>
pub fn from_string(source: String) -> SourceView<'static>
Creates an optimized view from a given source string
sourcepub fn get_line_slice(&self, line: u32, col: u32, span: u32) -> Option<&str>
pub fn get_line_slice(&self, line: u32, col: u32, span: u32) -> Option<&str>
Returns a line slice.
Note that columns are indexed as JavaScript WTF-16 columns.
sourcepub fn get_original_function_name<'map>(
&self,
token: Token<'map>,
minified_name: &str
) -> Option<&'map str>
pub fn get_original_function_name<'map>(
&self,
token: Token<'map>,
minified_name: &str
) -> Option<&'map str>
Given a token and minified function name this attemps to resolve the name to an original function name.
This invokes some guesswork and requires access to the original minified source. This will not yield proper results for anonymous functions or functions that do not have clear function names. (For instance it’s recommended that dotted function names are not passed to this function).
sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Returns the number of lines.
sourcepub fn sourcemap_reference(&self) -> Result<Option<SourceMapRef>>
pub fn sourcemap_reference(&self) -> Result<Option<SourceMapRef>>
Returns the source map reference in the source view.
Trait Implementations§
source§impl<'a> Clone for SourceView<'a>
impl<'a> Clone for SourceView<'a>
source§fn clone(&self) -> SourceView<'a>
fn clone(&self) -> SourceView<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more