Skip to main content

Crate hedl_toon

Crate hedl_toon 

Source
Expand description

HEDL ↔ TOON Conversion

Bidirectional conversion between HEDL documents and TOON (Token-Oriented Object Notation) format. Uses the official toon-format crate for spec-compliant parsing and serialization.

§Overview

This crate provides conversion between HEDL and TOON using the official TOON parser. TOON is designed for efficient processing by Large Language Models while maintaining human readability.

§Quick Start

use hedl_toon::hedl_to_toon;
use hedl_core::Document;

let hedl = r#"%V:2.0
%NULL:~
%QUOTE:"
%S:User:[id, name]
---
users:@User
 |u1, Alice
 |u2, Bob
"#;

let doc = hedl_core::parse(hedl.as_bytes())?;
let toon = hedl_to_toon(&doc)?;
println!("{}", toon);

TOON Spec: https://github.com/toon-format/spec

Structs§

FromToonConfig
Configuration for TOON parsing
ToToonConfig
Configuration for HEDL to TOON conversion
ToToonConfigBuilder
Builder for ToToonConfig

Enums§

Delimiter
TOON delimiter options
ToonError
Errors that can occur during TOON conversion

Constants§

MAX_NESTING_DEPTH
Maximum nesting depth allowed (security limit)

Functions§

from_toon
Parse TOON string to HEDL Document
from_toon_with_config
Parse TOON string to HEDL Document with configuration
hedl_to_toon
Convert HEDL document to TOON string with default configuration
to_toon
Convert HEDL document to TOON string
toon_to_hedl
Parse TOON string to HEDL document

Type Aliases§

Result
Result type for TOON operations