-
-
Save tgnottingham/9eb4b84ea82a6578628a7b7ae2ffc191 to your computer and use it in GitHub Desktop.
serde_json::from_reader benchmark 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use serde::{Deserialize, Serialize}; | |
use serde_json::Value; | |
#[derive(Serialize, Deserialize)] | |
pub struct RawSectionOffset { | |
pub line: u32, | |
pub column: u32, | |
} | |
#[derive(Serialize, Deserialize)] | |
pub struct RawSection { | |
pub offset: RawSectionOffset, | |
pub url: Option<String>, | |
pub map: Option<Box<RawSourceMap>>, | |
} | |
#[derive(Serialize, Deserialize)] | |
pub struct RawSourceMap { | |
pub version: u32, | |
pub file: Option<String>, | |
pub sources: Vec<String>, | |
#[serde(rename="sourceRoot")] | |
pub source_root: Option<String>, | |
#[serde(rename="sourcesContent")] | |
pub sources_content: Option<Vec<Option<String>>>, | |
pub sections: Option<Vec<RawSection>>, | |
pub names: Vec<Value>, | |
pub mappings: String, | |
} | |
fn main() { | |
let reader = std::fs::File::open("vendor2.js.map").unwrap(); | |
//let reader = std::io::BufReader::new(reader); | |
let map: RawSourceMap = serde_json::from_reader(reader).unwrap(); | |
println!("{}", map.version); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment