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.

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.

  • version: the version is typically 3 which is the current darft version
  • file: an optional filename of the index
  • sections: a vector of source map index sections

Returns the version of the sourcemap index.

Returns the embedded filename in case there is one.

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.