toon-format-rs 0.1.0

Token-Oriented Object Notation (TOON) parser and serializer for Rust
Documentation
//! # TOON Format - Token-Oriented Object Notation
//!
//! A Rust implementation of the TOON (Token-Oriented Object Notation) format.
//! TOON is a compact, human-readable serialization format designed to minimize
//! tokens when sending structured data to Large Language Models (LLMs).
//!
//! ## Quick Start
//!
//! ```rust
//! use toon_format_rs::{parse, to_string, Value};
//!
//! // Parse TOON string
//! let input = r#"id: 123
//! name: Alice
//! active: true"#;
//!
//! let value = parse(input).unwrap();
//! assert_eq!(value.get("id").unwrap().as_i64(), Some(123));
//!
//! // Serialize to TOON
//! let output = to_string(&value).unwrap();
//! assert!(output.contains("id: 123"));
//! ```
//!
//! ## Features
//!
//! - **Compact**: 30-60% fewer tokens than JSON for uniform arrays
//! - **Human-readable**: YAML-like indentation with CSV-like tabular arrays
//! - **Schema-aware**: Explicit array lengths and field lists
//! - **Lossless**: Convert JSON → TOON → JSON without data loss
//! - **LLM-optimized**: Designed specifically for LLM prompts

pub mod error;
pub mod lexer;
pub mod parser;
pub mod serializer;
pub mod value;

// Re-export main types
pub use error::{Error, Result};
pub use lexer::{Lexer, Token};
pub use parser::{parse, Parser};
pub use serializer::{to_string, to_string_pretty, Delimiter, SerializeOptions, Serializer};
pub use value::Value;

#[cfg(feature = "json")]
mod json_convert;

#[cfg(feature = "json")]
pub use json_convert::{json_to_toon, toon_to_json, toon_to_json_pretty};