1 unstable release
0.1.1 | Apr 10, 2021 |
---|---|
0.1.0 |
|
#336 in No standard library
70KB
2K
SLoC
Forked from serde-json-core, removed heapless dependency and changed to using core::fmt::Formatter
Usage
struct AnyStruct {}
impl core::fmt::Display for AnyStruct {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
serde_json_core_fmt::to_fmt(f, self)
}
}
lib.rs
:
serde-json
for no_std
programs
This version of serde-json
is aimed at applications that run on resource constrained
devices.
Current features
- The error type is a simple C like enum (less overhead, smaller memory footprint)
- (De)serialization doesn't require memory allocations
- Deserialization of integers doesn't go through
u64
; instead the string is directly parsed into the requested integer type. This avoids pulling in KBs of compiler intrinsics when targeting a non 64-bit architecture. - Supports deserialization of:
bool
- Integers
str
(This is a zero copy operation.) (*)Option
- Arrays
- Tuples
- Structs
- C like enums
- Supports serialization (compact format only) of:
bool
- Integers
str
(**)Option
- Arrays
- Tuples
- Structs
- C like enums
(*) Deserialization of strings ignores escaped sequences. Escaped sequences might be supported in the future using a different Serializer as this operation is not zero copy.
(**) Serialization of strings doesn't escape stuff. This simply has not been implemented yet.
Planned features
- (De)serialization from / into IO objects once
core::io::{Read,Write}
becomes a thing.
Non-features
This is explicitly out of scope
- Anything that involves dynamic memory allocation
- Like the dynamic
Value
type
- Like the dynamic
Minimum Supported Rust Version (MSRV)
This crate is guaranteed to compile on stable Rust 1.40.0 and up. It might compile with older versions but that may change in any new patch release.
Dependencies
~145–405KB