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

Represents a react-native-style SourceMap, which has additional scope information embedded.

Implementations§

Creates a sourcemap from a reader over a JSON stream in UTF-8 format.

See SourceMap::from_reader

Creates a sourcemap from a reader over a JSON byte slice in UTF-8 format.

See SourceMap::from_slice

Writes a sourcemap into a writer.

See SourceMap::to_writer

Given a bytecode offset, this will find the enclosing scopes function name.

Resolves the name of the enclosing function for the given Token.

This rewrites the sourcemap according to the provided rewrite options.

See SourceMap::rewrite

Methods from Deref<Target = SourceMap>§

Writes a sourcemap into a writer.

Note that this operation will generate an equivalent sourcemap to the one that was generated on load however there might be small differences in the generated JSON and layout. For instance sourceRoot will not be set as upon parsing of the sourcemap the sources will already be expanded.

let sm = SourceMap::from_reader(input).unwrap();
let mut output : Vec<u8> = vec![];
sm.to_writer(&mut output).unwrap();

Returns the embedded filename in case there is one.

Sets a new value for the file.

Returns the embedded source_root in case there is one.

Sets a new value for the source_root.

Looks up a token by its index.

Returns the number of tokens in the sourcemap.

Returns an iterator over the tokens.

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

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

Returns the number of sources in the sourcemap.

Looks up a source for a specific index.

Sets a new source value for an index. This cannot add new sources.

This panics if a source is set that does not exist.

Iterates over all sources

Returns the sources content as source view.

Looks up the content for a source.

Sets source contents for a source.

Iterates over all source contents

Returns an iterator over the names.

Returns the number of names in the sourcemap.

Returns true if there are any names in the map.

Looks up a name for a specific index.

Removes all names from the sourcemap.

Returns the number of items in the index

Returns the number of items in the index

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
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.

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.