Laravel TOON Rust
=================

*v0.2.0*

TOON encoding and decoding for Laravel for Rust. The same data as JSON, in far fewer tokens.

```
cargo add laravel-toon-rust
```

[View on crates.io](https://crates.io/crates/laravel-toon-rust) [View on GitHub](https://github.com/mischasigtermans/laravel-toon-rust)

The Rust version of [Laravel TOON](/project/laravel-toon). Paste your own JSON in the demo above to see what it saves.

What it does
------------

- Built to the spec

  Passes all 590 fixtures of the TOON v4.1 spec test suite, and writes the same TOON as Laravel TOON for PHP. Decoding gives back the original structure.

- Anything that serializes

  encode() takes any Serialize value, decode\_as::\() reads into a type of your own, and every serializable value gets to\_toon().

- A response type

  Return a ToonResponse from a handler to answer with text/toon, such as a list of models for an agent.

- Fewer tokens on request

  Leave out nulls, empty strings or keys at every depth, alias long keys, truncate strings and cap float precision. diff() measures the saving first.

[View on crates.io](https://crates.io/crates/laravel-toon-rust).
