[][src]Struct sourcemap::SourceView

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

Provides efficient access to minified sources.

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

Methods

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]

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.

Trait Implementations

impl<'a> Clone for SourceView<'a>[src]

impl<'a> Debug for SourceView<'a>[src]

Auto Trait Implementations

impl<'a> Unpin for SourceView<'a>

impl<'a> !Sync for SourceView<'a>

impl<'a> !Send for SourceView<'a>

impl<'a> UnwindSafe for SourceView<'a>

impl<'a> !RefUnwindSafe for SourceView<'a>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]