json-sourcemap

Crates.iojson-sourcemap
lib.rsjson-sourcemap
version0.1.2
sourcesrc
created_at2023-03-11 07:36:40.008056
updated_at2023-05-05 08:09:38.003781
descriptionA library for parsing and generating JSON sourcemaps
homepagehttps://github.com/attila-lin/json-sourcemap-rs
repositoryhttps://github.com/attila-lin/json-sourcemap-rs
max_upload_size
id807076
size21,209
Yiyu Lin (attila-lin)

documentation

https://docs.rs/json-sourcemap/

README

json-sourcemap.rs

Just a json-source-map's port to Rust.

Usage

Add this to your Cargo.toml:

[dependencies]
json-sourcemap = "0.1"

Example

use json_sourcemap::Options;

fn main() {
    let json = r#"{
        "foo": "bar",
        "baz": 42
    }"#;

    let options = Options::default();
    let map = json_sourcemap::parse(json, options).unwrap();

    println!("{:?}", map);

    println!("{:?}", map.get_location("/foo").unwrap());

    let locs = map.get_location("/baz").unwrap();
    println!("{:?}", locs.key())
}
Commit count: 11

cargo fmt