pub struct Cache {
pub source_root: String,
/* private fields */
}
Fields§
§source_root: String
The path prefix of mapping source paths
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn mapping_for_generated_position(&self, line: u32, column: u32) -> Mapping
pub fn mapping_for_generated_position(&self, line: u32, column: u32) -> Mapping
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§
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more