mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-17 17:21:04 +00:00
Compile serde_derive to wasm
This commit is contained in:
@@ -0,0 +1 @@
|
||||
*.wasm
|
||||
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "wa-serde-derive"
|
||||
version = "0.1.137"
|
||||
authors = ["David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "serde_derive compiled to wasm"
|
||||
repository = "https://github.com/dtolnay/watt"
|
||||
include = ["src"]
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
watt = "0.4"
|
||||
|
||||
[workspace]
|
||||
@@ -0,0 +1,18 @@
|
||||
extern crate proc_macro;
|
||||
extern crate watt;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use watt::WasmMacro;
|
||||
|
||||
static MACRO: WasmMacro = WasmMacro::new(WASM);
|
||||
static WASM: &[u8] = include_bytes!("serde_derive.wasm");
|
||||
|
||||
#[proc_macro_derive(Serialize, attributes(serde))]
|
||||
pub fn derive_serialize(input: TokenStream) -> TokenStream {
|
||||
MACRO.proc_macro_derive("derive_serialize", input)
|
||||
}
|
||||
|
||||
#[proc_macro_derive(Deserialize, attributes(serde))]
|
||||
pub fn derive_deserialize(input: TokenStream) -> TokenStream {
|
||||
MACRO.proc_macro_derive("derive_deserialize", input)
|
||||
}
|
||||
Reference in New Issue
Block a user