toon_core/lib.rs
1//! # temporal-cortex-toon
2//!
3//! Pure-Rust encoder and decoder for **TOON (Token-Oriented Object Notation)** v3.0.
4//!
5//! TOON is a compact, human-readable serialization format designed to reduce LLM token
6//! consumption when processing structured data. It achieves this through key folding
7//! (indentation instead of braces), tabular compression for uniform arrays, and
8//! context-dependent quoting that eliminates unnecessary quote tokens.
9//!
10//! ## Quick start
11//!
12//! ```rust
13//! use toon_core::{encode, decode};
14//!
15//! // JSON → TOON
16//! let json = r#"{"name":"Alice","scores":[95,87,92]}"#;
17//! let toon = encode(json).unwrap();
18//! assert_eq!(toon, "name: Alice\nscores[3]: 95,87,92");
19//!
20//! // TOON → JSON (roundtrip)
21//! let back = decode(&toon).unwrap();
22//! assert_eq!(back, json);
23//! ```
24//!
25//! ## Modules
26//!
27//! - [`encoder`] — JSON string → TOON string
28//! - [`decoder`] — TOON string → JSON string
29//! - [`filter`] — Semantic filtering + TOON encode (`filter_and_encode`, `CalendarFilter`)
30//! - [`error`] — Error types for parse/encode failures
31//! - [`types`] — `ToonValue` AST (reserved for future direct-manipulation use)
32
33pub mod decoder;
34pub mod encoder;
35pub mod error;
36pub mod filter;
37pub mod types;
38
39pub use decoder::decode;
40pub use encoder::encode;
41pub use error::ToonError;
42pub use filter::{filter_and_encode, filter_fields, CalendarFilter};