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
//! # RSON Core
//!
//! Core parsing and value types for RSON (Rust Serialized Object Notation).
//!
//! RSON is a human-readable data serialization format designed as a superset of JSON,
//! with support for richer data structures like enums, structs, tuples, and optionals.
//!
//! ## Features
//!
//! - **JSON Compatibility**: Any valid JSON is valid RSON
//! - **Rich Types**: Structs, enums, tuples, optionals beyond JSON's types
//! - **Developer-Friendly**: Comments, trailing commas, unquoted identifiers
//! - **Efficient**: Zero-copy parsing where possible
//!
//! ## Example
//!
//! ```rson
//! // Example RSON document
//! User(
//! id: 1,
//! name: "Dedan",
//! email: Some("dedan@example.com"),
//! roles: ["admin", "editor"],
//! settings: {
//! theme: "dark",
//! notifications: true,
//! },
//! )
//! ```
extern crate alloc;
pub use ;
pub use ;
pub use ;
pub use ;
/// Parse an RSON string into a `RsonValue`.
///
/// This is the main entry point for parsing RSON text.
///
/// # Examples
///
/// ```
/// use rson_core::parse;
///
/// let input = r#"User(name: "Alice", age: 30)"#;
/// let value = parse(input).unwrap();
/// ```
/// Format a `RsonValue` as an RSON string.
///
/// # Examples
///
/// ```
/// use rson_core::{RsonValue, format};
///
/// let value = RsonValue::String("Hello, RSON!".to_string());
/// let formatted = format(&value).unwrap();
/// assert_eq!(formatted, r#""Hello, RSON!""#);
/// ```