Skip to main content

qubit_json/
lib.rs

1// =============================================================================
2//    Copyright (c) 2025 - 2026 Haixing Hu.
3//
4//    SPDX-License-Identifier: Apache-2.0
5//
6//    Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Resource-aware JSON infrastructure organized into decoding, encoding, and
9//! materialized-value domains.
10//!
11//! * [`decode`] validates strict JSON and normalizes explicitly configured
12//!   non-standard text.
13//! * [`encode`] serializes values with explicit output and value budgets.
14//! * [`mod@format`] validates and reformats JSON token streams while preserving
15//!   their scalar token spellings.
16//! * [`value`] constructs and traverses materialized JSON values.
17//!
18//! `qubit-budget` owns limits, resource identities, and sessions. This crate
19//! owns JSON-specific normalization, syntax validation, value construction,
20//! and traversal.
21//!
22//! # Number contract
23//!
24//! Ordinary strict and normalizing text decoding defaults to the `Integer64`
25//! model: negative integers fit `i64`, non-negative integers fit `u64`, and
26//! fractional or exponential tokens are finite `f64`. An explicit supported
27//! decode entry point can select finite fallback for out-of-range integer
28//! tokens; this may round them. `JcsDecoder` instead converts every number to
29//! finite binary64. Strict encoding retains its own range checks and does not
30//! inherit a decode fallback. Wider exact integers and exact decimals should
31//! use strings or an explicit domain wire format. `NumberBytes` limits lexical
32//! size; it does not expand the supported numeric range.
33
34#![deny(missing_docs)]
35
36#[cfg(doctest)]
37#[doc(hidden)]
38mod documentation_examples;
39
40#[cfg(test)]
41mod tests;
42
43pub mod decode;
44pub mod encode;
45pub mod format;
46mod internal;
47mod lexical;
48pub mod value;