ron2 0.2.0

RON parser with full AST access, perfect round-trip fidelity, and formatting tools
Documentation

RON2 - Rusty Object Notation parser with full AST access

This crate provides a standalone RON parser with three APIs:

  • AST API: Full fidelity parsing with perfect round-trip support
  • Value API: Simplified access to semantic content only
  • Typed Conversions: [FromRon] and [ToRon] traits for Rust types

No serde dependency required.

AST Example (full fidelity)

use ron2::ast::{parse_document, serialize_document};

let source = "// config\nPoint(x: 1, y: 2)";
let doc = parse_document(source).unwrap();
let output = serialize_document(&doc).unwrap();
assert_eq!(source, output); // Perfect round-trip

Value Example (semantic only)

use ron2::Value;

let value: Value = "[1, 2, 3]".parse().unwrap();
assert!(matches!(value, Value::Seq(_)));

Typed Conversions

use ron2::{FromRon, ToRon};

let numbers: Vec<i32> = Vec::from_ron("[1, 2, 3]").unwrap();
assert_eq!(numbers, vec![1, 2, 3]);

let ron_string = numbers.to_ron().unwrap();