feldera_ijson/
lib.rs

1//! This crate offers a replacement for `serde-json`'s `Value` type, which is
2//! significantly more memory efficient.
3//!
4//! As a ballpark figure, it will typically use half as much memory as
5//! `serde-json` when deserializing a value and the memory footprint of cloning
6//! a value is more than 7x smaller.
7//!
8//! The primary type exposed by this crate is the [`IValue`] type. It is guaranteed
9//! to be pointer-sized and has a niche (so `Option<IValue>` is also guaranteed
10//! to be pointer-sized).
11//!
12//! Cargo features:
13//!
14//! - `ctor`
15//!   A global string cache is used when interning strings. This cache is normally
16//!   initialized lazily on first use. Enabling the `ctor` feature will cause it
17//!   to be eagerly initialized on startup.
18//!   There is no performance benefit to this, but it can help avoid false positives
19//!   from tools like `mockalloc` which try to detect memory leaks during tests.
20#![deny(missing_docs, missing_debug_implementations)]
21
22#[macro_use]
23mod macros;
24
25pub mod array;
26pub mod number;
27pub mod object;
28pub mod string;
29mod thin;
30mod value;
31
32pub use array::IArray;
33pub use number::INumber;
34pub use object::IObject;
35pub use string::IString;
36pub use value::{
37    BoolMut, Destructured, DestructuredMut, DestructuredRef, IValue, ValueIndex, ValueType,
38};
39
40mod de;
41#[cfg(feature = "rkyv")]
42mod rkyv;
43mod ser;
44pub use de::from_value;
45pub use ser::to_value;
46
47#[cfg(all(test, not(miri)))]
48mod tests {
49    use mockalloc::Mockalloc;
50    use std::alloc::System;
51
52    #[global_allocator]
53    static ALLOCATOR: Mockalloc<System> = Mockalloc(System);
54}