pub enum DecodedMap {
    Regular(SourceMap),
    Index(SourceMapIndex),
    Hermes(SourceMapHermes),
}
Expand description

Represents the result of a decode operation

This represents either an actual sourcemap or a source map index. Usually the two things are too distinct to provide a common interface however for token lookup and writing back into a writer general methods are provided.

Variants§

§

Regular(SourceMap)

Indicates a regular sourcemap

§

Index(SourceMapIndex)

Indicates a sourcemap index

§

Hermes(SourceMapHermes)

Indicates a sourcemap as generated by Metro+Hermes, as used by react-native

Implementations§

source§

impl DecodedMap

source

pub fn from_reader<R: Read>(rdr: R) -> Result<DecodedMap>

Alias for decode.

source

pub fn to_writer<W: Write>(&self, w: W) -> Result<()>

Writes a decoded sourcemap to a writer.

source

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

Shortcut to look up a token on either an index or a regular sourcemap. This method can only be used if the contained index actually contains embedded maps or it will not be able to look up anything.

source

pub fn get_original_function_name( &self, line: u32, col: u32, minified_name: Option<&str>, source_view: Option<&SourceView<'_>> ) -> Option<&str>

Returns the original function name.

minified_name and source_view are not always necessary. For instance hermes source maps can provide this information without access to the original sources.

Trait Implementations§

source§

impl Clone for DecodedMap

source§

fn clone(&self) -> DecodedMap

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DecodedMap

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.