[−][src]Struct sourcemap::SourceView
Provides efficient access to minified sources.
This type is used to implement fairly efficient source mapping operations.
Implementations
impl<'a> SourceView<'a>
[src]
pub fn new(source: &'a str) -> SourceView<'a>
[src]
Creates an optimized view of a given source.
pub fn from_string(source: String) -> SourceView<'static>
[src]
Creates an optimized view from a given source string
pub fn get_line(&self, idx: u32) -> Option<&str>
[src]
Returns a requested minified line.
pub fn get_line_slice(&self, line: u32, col: u32, span: u32) -> Option<&str>
[src]
Returns a line slice.
Note that columns are indexed as JavaScript WTF-16 columns.
pub fn lines(&'a self) -> Lines<'a>
[src]
Returns an iterator over all lines.
pub fn source(&self) -> &str
[src]
Returns the source.
pub fn get_original_function_name<'map>(
&self,
token: Token<'map>,
minified_name: &str
) -> Option<&'map str>
[src]
&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).
pub fn line_count(&self) -> usize
[src]
Returns the number of lines.
pub fn sourcemap_reference(&self) -> Result<Option<SourceMapRef>>
[src]
Returns the source map reference in the source view.
Trait Implementations
impl<'a> Clone for SourceView<'a>
[src]
fn clone(&self) -> SourceView<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Debug for SourceView<'a>
[src]
Auto Trait Implementations
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> UnwindSafe for SourceView<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,