serde_json_core_fmt/
lib.rs

1//! [`serde-json`] for `no_std` programs
2//!
3//! [`serde-json`]: https://crates.io/crates/serde_json
4//!
5//! This version of [`serde-json`] is aimed at applications that run on resource constrained
6//! devices.
7//!
8//! # Current features
9//!
10//! - The error type is a simple C like enum (less overhead, smaller memory footprint)
11//! - (De)serialization doesn't require memory allocations
12//! - Deserialization of integers doesn't go through `u64`; instead the string is directly parsed
13//!   into the requested integer type. This avoids pulling in KBs of compiler intrinsics when
14//!   targeting a non 64-bit architecture.
15//! - Supports deserialization of:
16//!   - `bool`
17//!   - Integers
18//!   - `str` (This is a zero copy operation.) (\*)
19//!   - `Option`
20//!   - Arrays
21//!   - Tuples
22//!   - Structs
23//!   - C like enums
24//! - Supports serialization (compact format only) of:
25//!   - `bool`
26//!   - Integers
27//!   - `str` (\*\*)
28//!   - `Option`
29//!   - Arrays
30//!   - Tuples
31//!   - Structs
32//!   - C like enums
33//!
34//! (\*) Deserialization of strings ignores escaped sequences. Escaped sequences might be supported
35//! in the future using a different Serializer as this operation is not zero copy.
36//!
37//! (\*\*) Serialization of strings doesn't escape stuff. This simply has not been implemented yet.
38//!
39//! # Planned features
40//!
41//! - (De)serialization from / into IO objects once `core::io::{Read,Write}` becomes a thing.
42//!
43//! # Non-features
44//!
45//! This is explicitly out of scope
46//!
47//! - Anything that involves dynamic memory allocation
48//!   - Like the dynamic [`Value`](https://docs.rs/serde_json/1.0.11/serde_json/enum.Value.html)
49//!     type
50//!
51//! # Minimum Supported Rust Version (MSRV)
52//!
53//! This crate is guaranteed to compile on stable Rust 1.40.0 and up. It *might* compile with older
54//! versions but that may change in any new patch release.
55
56#![deny(missing_docs)]
57#![deny(rust_2018_compatibility)]
58#![deny(rust_2018_idioms)]
59#![deny(warnings)]
60#![cfg_attr(not(feature = "std"), no_std)]
61#[cfg(test)]
62#[macro_use]
63extern crate std;
64
65pub mod de;
66pub mod ser;
67
68#[doc(inline)]
69pub use self::de::{from_slice, from_str};
70#[doc(inline)]
71pub use self::ser::to_fmt;