Struct SourceMapView

Source
pub struct SourceMapView { /* private fields */ }
Expand description

Represents a source map.

Implementations§

Source§

impl SourceMapView

Source

pub fn from_json_slice(buffer: &[u8]) -> Result<Self, ParseSourceMapError>

Constructs a sourcemap from a slice.

If the sourcemap is an index it is being flattened. If flattening is not possible then an error is raised.

Source

pub fn lookup_token(&self, line: u32, col: u32) -> Option<TokenMatch<'_>>

Looks up a token and returns it.

Source

pub fn get_token(&self, idx: u32) -> Option<TokenMatch<'_>>

Returns a token for a specific index.

Source

pub fn get_token_count(&self) -> u32

Returns the number of tokens.

Source

pub fn get_source_view(&self, idx: u32) -> Option<&SourceView<'_>>

Returns a source view for the given source.

Source

pub fn get_source_name(&self, idx: u32) -> Option<&str>

Returns the source name for an index.

Source

pub fn get_source_count(&self) -> u32

Returns the number of sources.

Source

pub fn lookup_token_with_function_name<'a, 'b>( &'a self, line: u32, col: u32, minified_name: &str, source: &SourceView<'b>, ) -> Option<TokenMatch<'a>>

Looks up a token and the original function name.

This is similar to lookup_token but if a minified function name and the sourceview to the minified source is available this function will also resolve the original function name. This is used to fully resolve tracebacks.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,