Struct sourcemap::SourceMapIndex [] [src]

pub struct SourceMapIndex { /* fields omitted */ }

Represents a sourcemap index in memory

Methods

impl SourceMapIndex
[src]

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

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

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.