#source-map #json #parser #generate

json-sourcemap

用于解析和生成JSON sourcemap的库

3个版本

0.1.2 2023年5月5日
0.1.1 2023年3月11日
0.1.0 2023年3月11日

#2145解析器实现

Download history 9/week @ 2024-04-05

58 每月下载量

MIT/Apache

22KB
626 代码行

json-sourcemap.rs

仅是将json-source-map移植到Rust。

用法

将以下内容添加到您的 Cargo.toml

[dependencies]
json-sourcemap = "0.1"

示例

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())
}

依赖项

~0.8–1.7MB
~36K SLoC