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.
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>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> !Freeze for SourceView<'a>
impl<'a> !RefUnwindSafe for SourceView<'a>
impl<'a> !Send for SourceView<'a>
impl<'a> !Sync for SourceView<'a>
impl<'a> Unpin for SourceView<'a>
impl<'a> UnsafeUnpin for SourceView<'a>
impl<'a> UnwindSafe for SourceView<'a>
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