[][src]Struct sourcemap::SourceView

pub struct SourceView<'a> { /* fields omitted */ }

Provides efficient access to minified sources.

This type is used to implement fairly efficient source mapping operations.


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>(
    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]

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.