Crate facet_json

Source
Expand description

§facet-json

experimental free of syn crates.io documentation MIT/Apache-2.0 licensed

Thanks to all individual and corporate sponsors, without whom this work could not exist:

Ko-fi GitHub Sponsors Patreon           Zed Namespace

Provides JSON serialization and deserialization for any type that implements Facet.

§Example


#[derive(Debug, Facet, PartialEq)]
struct User {
    name: String,
    age: u64,
}

let json = r#"{"name": "Alice", "age": 30}"#;
let user: User = facet_json::from_str(&json).unwrap();
assert_eq!(user, User { name: "Alice".into(), age: 30 });

§License

Licensed under either of:

at your option.

Functions§

from_str
Deserializes a JSON string into a value of type T that implements Facet.
from_str_opaque
Deserialize a Poke object from a JSON string.
to_json
Serializes any Facet type to JSON
to_json_string
Serializes any Facet type to JSON and returns it as a String