pub struct SourceMapIndex { /* private fields */ }
Expand description

Represents a sourcemap index in memory

Implementations§

Creates a sourcemap index from a reader over a JSON stream in UTF-8 format. Optionally a “garbage header” as defined by the sourcemap draft specification is supported. In case a regular sourcemap is encountered an error is returned.

Writes a sourcemap index into a writer.

Creates a sourcemap index from a reader over a JSON byte slice in UTF-8 format. Optionally a “garbage header” as defined by the sourcemap draft specification is supported. In case a regular sourcemap is encountered an error is returned.

Constructs a new sourcemap index from raw components.

  • file: an optional filename of the index
  • sections: a vector of source map index sections

Constructs a new sourcemap index from raw components including the facebook RAM bundle extensions.

  • file: an optional filename of the index
  • sections: a vector of source map index sections
  • x_facebook_offsets: a vector of facebook offsets
  • x_metro_module_paths: a vector of metro module paths

Returns the embedded filename in case there is one.

Sets a new value for the file.

Returns the number of sections in this index

Looks up a single section and returns it

Looks up a single section and returns it as a mutable ref

Iterates over all sections

Given a location, name and minified source file resolve a minified 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).

Looks up the closest token to a given line and column.

This requires that the referenced sourcemaps are actually loaded. If a sourcemap is encountered that is not embedded but just externally referenced it is silently skipped.

Flattens an indexed sourcemap into a regular one. This requires that all referenced sourcemaps are attached.

Flattens an indexed sourcemap into a regular one and automatically rewrites it. This is more useful than plain flattening as this will cause the sourcemap to be properly deduplicated.

Returns true if this sourcemap is for a RAM bundle.

Returns embeded x-facebook-offset values.

Returns embedded metro module paths.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.