blob: 53904bfb1c55f1d7bc87faa3b7a39969a3b0a420 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
use anyhow::Result;
use std::fs;
use std::path::Path;
use syn_codegen::Definitions;
pub fn generate(defs: &Definitions) -> Result<()> {
let mut j = serde_json::to_string_pretty(&defs)?;
j.push('\n');
let check: Definitions = serde_json::from_str(&j)?;
assert_eq!(*defs, check);
let codegen_root = Path::new(env!("CARGO_MANIFEST_DIR"));
let json_path = codegen_root.join("../syn.json");
fs::write(json_path, j)?;
Ok(())
}
|