#binary-encoding #ron #string #default #fork #struct #derive

no-std nanoserde

Fork of makepad-tinyserde without any external dependencies. Supports json, binary and ron. #[derive(Clone, Debug, Default, DeJson, SerJson)] pub struct Property { pub name: String, #[nserde(default)] pub value: String, #[nserde(rename = "type")] pub ty: String, }

35 releases

0.2.0-beta.0 Jul 28, 2024
0.1.37 Jan 25, 2024
0.1.35 Sep 1, 2023
0.1.33 Jul 22, 2023
0.1.18 Jul 20, 2020

#142 in Encoding

Download history 4941/week @ 2024-09-21 3207/week @ 2024-09-28 2705/week @ 2024-10-05 3205/week @ 2024-10-12 2943/week @ 2024-10-19 3151/week @ 2024-10-26 4331/week @ 2024-11-02 3380/week @ 2024-11-09 2533/week @ 2024-11-16 4337/week @ 2024-11-23 3194/week @ 2024-11-30 3316/week @ 2024-12-07 4103/week @ 2024-12-14 2127/week @ 2024-12-21 3078/week @ 2024-12-28 2767/week @ 2025-01-04

12,470 downloads per month
Used in 49 crates (35 directly)

MIT/Apache

120KB
3.5K SLoC

nanoserde

Github Actions Crates.io version Documentation Discord chat

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)

Example:

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

Features support matrix:

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

Crate features:

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

Dependencies