Waysyou/toon4/advisor does not have a README file

    CostReport

    pub(all) struct CostReport {
    pretty_json : FormatStats
    compact_json : FormatStats
    toon_comma : FormatStats
    toon_tab : FormatStats
    toon_pipe : FormatStats
    best_toon : FormatStats
    audit : StructuralAudit
    verdict : VerdictKind
    reason : String
    } derive(Eq,
    Debug
    )

    Complete cost-efficiency and tabular diagnostic report for a JSON document.

    CostReport::render_report

    fn CostReport::render_report(self : CostReport) -> String

    Renders a human-readable CLI / Markdown comparison table with ASCII bars, tabular coverage breakdown, fallback diagnostics, and final verdict.

    CostReport::to_json

    Serializes CostReport as a JSON summary (omitting full rendered payload strings so report size stays compact for automation/CLI --json).

    FallbackFinding

    pub(all) struct FallbackFinding {
    path : String
    reason : FallbackReason
    item_count : Int
    explanation : String
    } derive(Eq,
    Debug
    )

    Path-level diagnostic explaining why a nested collection fell back from compact tabular encoding.

    FallbackReason

    pub(all) enum FallbackReason {
    NonUniformObjectKeys(String)
    NonPrimitiveColumn(String)
    SingleEntryKeyedObject
    MixedElementTypes
    ListItemPosition
    EmptyCollection
    } derive(Eq,
    Debug
    )

    Reason why a JSON array or object could not use TOON tabular/keyed-tabular compression.

    FormatStats

    pub(all) struct FormatStats {
    name : String
    delimiter :
    Delimiter
    ?
    text : String
    utf8_bytes : Int
    chars : Int
    structural_bytes : Int
    estimated_tokens : Int
    delta_vs_compact_pct : Double
    delta_vs_pretty_pct : Double
    } derive(Eq,
    Debug
    )

    Per-format serialization and efficiency measurement.

    StructuralAudit

    pub(all) struct StructuralAudit {
    tabular_items : Int
    non_tabular_items : Int
    array_tabular_blocks : Int
    keyed_tabular_blocks : Int
    tabular_coverage_pct : Double
    fallbacks : Array[FallbackFinding]
    } derive(Eq,
    Debug
    )

    Summary of tabular eligibility across a JSON payload.

    TextMetrics

    pub(all) struct TextMetrics {
    utf8_bytes : Int
    chars : Int
    structural_bytes : Int
    estimated_tokens : Int
    } derive(Eq,
    Debug
    )

    Byte, structural syntax overhead, and BPE-aware heuristic token metrics for a serialized text payload.

    VerdictKind

    pub(all) enum VerdictKind {
    RecommendToon
    Marginal
    KeepCompactJson
    } derive(Eq,
    Debug
    )

    High-level actionable recommendation from comparing TOON vs Compact JSON.

    VerdictKind::label

    fn VerdictKind::label(self : VerdictKind) -> String

    Returns a stable uppercase tag for CLI/JSON reporting.

    analyze

    Evaluates value across Pretty JSON, Compact JSON, and TOON (comma, tab, pipe), returning byte/token measurements, tabular coverage audit, and an explicit recommendation on whether TOON is worthwhile.

    audit_structure

    fn audit_structure(value :
    Json
    ) -> StructuralAudit

    Audits a JSON document to measure tabular coverage and pinpoint exact paths that fall back from TOON tabular or §9.5 keyed-tabular compression.

    measure_text

    fn measure_text(text : String) -> TextMetrics

    Computes exact UTF-8 byte count, Unicode scalar count, syntax overhead bytes, and a deterministic BPE-aware token estimate (modeled on o200k/cl100k chunking: <=8-char words with optional leading space, <=3-digit number chunks, merged JSON punctuation clusters like {", ":", ",", "},{", newline+indent runs, and per-scalar CJK/emoji).