Skip to main content

DecodedMap

Enum DecodedMap 

Source
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.

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.