Derive Macro vertigo::AutoJsJson
source · #[derive(AutoJsJson)]
Expand description
Macro for creating JsJson
from structures and structures from JsJson
.
Used for fetching and sending objects over the network.
Enums representation is compatible with serde’s “external tagging” which is the default.
#[derive(vertigo::AutoJsJson)]
pub struct Post {
pub id: i64,
pub name: String,
pub visible: bool,
}
let post = Post {
id: 1,
name: "Hello".to_string(),
visible: true
};
let js_json = vertigo::to_json(post);
let post2 = vertigo::from_json::<Post>(js_json);