Crates.io | nanoserde |
lib.rs | nanoserde |
version | 0.2.0-beta.0 |
source | src |
created_at | 2020-06-20 18:22:36.853147 |
updated_at | 2024-07-28 17:02:53.577574 |
description | Fork of makepad-tinyserde without any external dependencies. Supports json, binary and ron. ```rust #[derive(Clone, Debug, Default, DeJson, SerJson)] pub struct Property { pub name: String, #[nserde(default)] pub value: String, #[nserde(rename = "type")] pub ty: String, } ``` |
homepage | |
repository | https://github.com/not-fl3/nanoserde |
max_upload_size | |
id | 256033 |
size | 167,456 |
Fork of https://crates.io/crates/makepad-tinyserde with all the dependencies removed. No more syn, proc_macro2 or quote in the build tree!
> cargo tree
nanoserde v0.1.0 (/../nanoserde)
└── nanoserde-derive v0.1.0 (/../nanoserde/derive)
use nanoserde::{DeJson, SerJson};
#[derive(Clone, Debug, Default, DeJson, SerJson)]
pub struct Property {
pub name: String,
#[nserde(default)]
pub value: String,
#[nserde(rename = "type")]
pub ty: String,
}
For more examples take a look at tests
Feature | json | bin | ron | toml |
---|---|---|---|---|
serialization | yes | yes | yes | no |
deserialization | yes | yes | yes | no |
container: Struct | yes | yes | yes | no |
container: Tuple Struct | no | yes | yes | no |
container: Enum | yes | yes | yes | no |
field: std::collections::HashMap |
yes | yes | yes | no |
field: std::vec::Vec |
yes | yes | yes | no |
field: Option |
yes | yes | yes | no |
field: i* /f* /String /T: De*/Ser* |
yes | yes | yes | no |
field attribute: #[nserde(default)] |
yes | no | yes | no |
field attribute: #[nserde(rename = "")] |
yes | yes | yes | no |
field attribute: #[nserde(proxy = "")] |
no | yes | no | no |
container attribute: #[nserde(default)] |
yes | no | yes | no |
container attribute: #[nserde(rename = "")] |
yes | yes | yes | no |
container attribute: #[nserde(proxy = "")] |
yes | yes | no | no |
container attribute: #[nserde(transparent)] |
yes | no | no | no |
All features are enabled by default. To enable only specific formats, import nanoserde using
nanoserde = { version = "*", default-features = false, features = ["std", "{format feature name}"] }
in your Cargo.toml
and add one or more of the following crate features:
Format | Feature Name |
---|---|
Binary | binary |
JSON | json |
RON | ron |
TOML | toml |