Add experiment to produce precompiled builds of serde_derive

This commit is contained in:
David Tolnay
2023-07-18 12:31:35 -07:00
parent 03da66c805
commit 9e8f14816b
18 changed files with 1448 additions and 2 deletions
+22
View File
@@ -0,0 +1,22 @@
extern crate proc_macro2;
use proc_macro2::watt;
use proc_macro2::watt::buffer::InputBuffer;
use std::io::{self, Read, Write};
fn main() {
let mut buf = Vec::new();
io::stdin().read_to_end(&mut buf).unwrap();
let mut buf = InputBuffer::new(&buf);
let derive = match buf.read_u8() {
0 => serde_derive::derive_serialize,
1 => serde_derive::derive_deserialize,
_ => unreachable!(),
};
let input = watt::load(&mut buf);
let output = derive(input);
let bytes = watt::linearize(output);
io::stdout().write_all(&bytes).unwrap();
}