Skip to content

Conversation

@Tuntii
Copy link
Owner

@Tuntii Tuntii commented Jan 1, 2026

feat: Add TOON format support with rustapi-toon crate

Summary

This PR introduces TOON (Text Object-Oriented Notation) format support
through the new rustapi-toon crate, enabling AI/LLM-friendly response
serialization alongside JSON.

Changes

  • Add new rustapi-toon crate with:
    • TOON format serialization/deserialization
    • Content negotiation (Accept header based)
    • LLM response handling utilities
    • OpenAPI integration support
  • Update rustapi-rs to re-export toon module
  • Add toon-api example demonstrating usage
  • Improve cookie extraction test for duplicate cookie names
  • Update README with TOON documentation

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • Unit tests for TOON serialization
  • Cookie extraction regression tests
  • Example API for manual testing

Tuntii added 2 commits January 1, 2026 13:21
Introduces the rustapi-toon crate for TOON (Token-Oriented Object Notation) support, enabling LLM-optimized data serialization and extraction. Updates workspace and rustapi-rs to support a new 'toon' feature, adds content negotiation, LLM response wrappers, and OpenAPI integration for TOON. Also includes a new example (toon-api) and benchmarking setup (toon_bench).
The cookie extraction test now verifies that only the last value for duplicate cookie names is kept, matching expected behavior. The test counts unique cookie names and ensures the extractor returns the correct values and count.
Copilot AI review requested due to automatic review settings January 1, 2026 11:16
Tuntii added 3 commits January 1, 2026 14:18
Introduces a full benchmarking suite under the benches/ directory, including micro-benchmarks (routing, JSON, TOON format), HTTP load test servers for RustAPI and Actix-web, and a PowerShell script for automated performance comparison. Updates .gitignore to allow benches/ tracking. These additions enable performance profiling and framework comparison for RustAPI development.
Updated Cargo.toml and Cargo.lock to set the workspace and all member packages to version 0.1.3.
Applied minor refactoring and formatting improvements to test code in extract.rs, layer.rs, metrics.rs, and mod.rs. Updated CHANGELOG.md for new TOON format support and related features. Improved code readability in toon-api example.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Replaced manual token estimation rounding with div_ceil for improved clarity and accuracy in benches and llm_response. Added #[allow(dead_code)] to test-only code to suppress warnings. Minor formatting improvements in imports and test code for readability.
@Tuntii Tuntii merged commit 406273f into main Jan 1, 2026
3 of 4 checks passed
@Tuntii Tuntii deleted the 0-5v-Toon-Support branch January 14, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants