Crates.io | json_in_type_derive |
lib.rs | json_in_type_derive |
version | 0.1.2 |
source | src |
created_at | 2018-10-20 23:28:41.770145 |
updated_at | 2018-10-22 06:36:08.937598 |
description | procedural macros for json_in_type |
homepage | https://lovasoa.github.io/json_in_type/ |
repository | https://github.com/lovasoa/json_in_type |
max_upload_size | |
id | 91731 |
size | 8,020 |
This crate defines a derive mode macro allowing the automatic derivation of the JSONValue trait for custom data structures.
extern crate json_in_type;
#[macro_use]
extern crate json_in_type_derive;
use json_in_type::JSONValue;
#[derive(JSONValue)]
struct MyObject { // This will be encoded as a JSON object
void: (),
list: Vec<u8>,
hello: String,
}
#[derive(JSONValue)]
struct WrapperStruct(u8, u8); // This will be encoded as a JSON list