Skip to content

Commit b8895b3

Browse files
committed
Add JsValue::{from_serde, into_serde}
These functions are activated with the `serde-serialization` feature of the `wasm-bindgen` crate. When activated they will allow passing any arbitrary value into JS that implements the `Serialize` trait and receiving any value from JS using the `Deserialize` trait. The interchange between JS and Rust is JSON. Closes #96
1 parent acb5eac commit b8895b3

File tree

5 files changed

+407
-224
lines changed

5 files changed

+407
-224
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ doctest = false
2020
default = ["spans", "std"]
2121
spans = ["wasm-bindgen-macro/spans"]
2222
std = []
23+
serde-serialize = ["serde", "serde_json", "std"]
2324

2425
[dependencies]
2526
wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.6" }
27+
serde = { version = "1.0", optional = true }
28+
serde_json = { version = "1.0", optional = true }
2629

2730
[dev-dependencies]
2831
wasm-bindgen-cli-support = { path = "crates/cli-support", version = '=0.2.6' }

0 commit comments

Comments
 (0)