Struct js_source_mapper::Cache [] [src]

pub struct Cache {
    pub source_root: String,
    // some fields omitted
}

Fields

The path prefix of mapping source paths

Methods

impl Cache
[src]

Returns the original source, line, column and name information for the generated source's line and column positions provided.

Arguments

  • line: The line number in the generated source.
  • column: The column number in the generated source.

Examples

use js_source_mapper::consume;

let cache = consume(r#"{ "version": 3, "file": "foo.js", "sources": ["source.js"], "names": ["name1", "name1", "name3"], "mappings": ";EAACA;;IAEEA;;MAEEE", "sourceRoot": "http://example.com" }"#).unwrap();

println!("{:?}", cache.mapping_for_generated_position(2, 2));
// => Mapping {
//   generated: CodePosition { line: 2, column: 2 },
//   original: CodePosition { line: 1, column: 1 },
//   source: "source.js"
//   name: "name1"
// }

Trait Implementations

impl Debug for Cache
[src]

Formats the value using the given formatter.