Skip to main content

DecodedMap

Enum DecodedMap 

Source
pub enum DecodedMap {
    Regular(SourceMap),
}
Expand description

A unified type that can hold any decoded source map variant.

Dispatches lookups to the underlying type. Currently only supports regular source maps; the Hermes variant will be added when the hermes crate is integrated.

Variants§

§

Regular(SourceMap)

A regular source map.

Implementations§

Source§

impl DecodedMap

Source

pub fn from_json(json: &str) -> Result<Self, ParseError>

Parse a JSON string and auto-detect the source map type.

Source

pub fn original_position_for( &self, line: u32, column: u32, ) -> Option<OriginalLocation>

Look up the original source position for a generated position (0-based).

Source

pub fn generated_position_for( &self, source: &str, line: u32, column: u32, ) -> Option<GeneratedLocation>

Look up the generated position for an original source position (0-based).

Source

pub fn sources(&self) -> &[String]

All source filenames.

Source

pub fn names(&self) -> &[String]

All name strings.

Source

pub fn source(&self, idx: u32) -> &str

Resolve a source index to its filename.

§Panics

Panics if idx is out of bounds.

Source

pub fn name(&self, idx: u32) -> &str

Resolve a name index to its string.

§Panics

Panics if idx is out of bounds.

Source

pub fn debug_id(&self) -> Option<&str>

The debug ID, if present.

Source

pub fn set_debug_id(&mut self, id: impl Into<String>)

Set the debug ID.

Source

pub fn to_json(&self) -> String

Serialize to JSON.

Source

pub fn into_source_map(self) -> Option<SourceMap>

Extract the inner SourceMap if this is the Regular variant.

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.