1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! **jzon** — purpose-built, zero-copy JSON serialization for specific structs.
//!
//! # Design
//!
//! Use `#[derive(ToJson, FromJson)]` to generate a **monomorphised** JSON
//! (de)serializer for each of your types at compile time. No generic visitor
//! indirection, no intermediate `Value` allocation, no format-string overhead.
//!
//! ## Cargo features
//!
//! | Feature | Default | Effect |
//! |---------|---------|--------|
//! | `derive` | ✓ | `#[derive(ToJson, FromJson)]` proc-macros |
//! | `simd` | | u128 SWAR scanning (16 B/iter) |
//! | `simd + unstable` | | `std::simd` portable SIMD (32–64 B/iter, nightly) |
//! | `fast-float` | | `ryu` serialization, `fast_float2` parsing |
//! | `stats` | | `ScannerStats` allocation/cache-hit counters |
//!
//! For serde integration see [`jzon-rs-serde`](https://crates.io/crates/jzon-rs-serde).
//! For a `serde_json` drop-in see [`jzon-rs-compat`](https://crates.io/crates/jzon-rs-compat).
//!
//! ## Zero-copy deserialization
//!
//! Fields typed `&'de str` borrow **directly** from the input — no `String` is
//! allocated unless the JSON string contains escape sequences.
//!
//! ## Field-hint cache
//!
//! The generated `FromJson` impl maintains a one-word *field-hint* variable
//! that predicts which field key to expect next. For JSON whose field order
//! matches the struct definition — the common case — almost every key dispatch
//! is O(1) without hashing.
//!
//! ## Safe Rust only
//!
//! There are **no `unsafe` blocks** in this crate. All SIMD scanning uses
//! `std::simd` (nightly) or pure u64/u128 arithmetic (SWAR).
//!
//! # Quick start
//!
//! ```rust,ignore
//! use jzon::{ToJson, FromJson};
//!
//! #[derive(ToJson, FromJson, Debug, PartialEq)]
//! #[serde(rename_all = "camelCase")]
//! struct User<'a> {
//! user_id: u64,
//! name: &'a str,
//! #[serde(skip_serializing_if = "Option::is_none")]
//! email: Option<String>,
//! #[serde(default)]
//! score: f64,
//! }
//!
//! let input = r#"{"userId":1,"name":"alice","score":9.5}"#;
//! let user: User = User::from_json_str(input).unwrap();
//! let out = user.to_json_string();
//! ```
// Enable `std::simd` portable SIMD on nightly when both features are set.
pub use Error;
pub use ;
pub use ToJson;
pub use FromJson;
pub use ;
pub use ;