https://github.com/zoon-format/zoon-rust
https://github.com/zoon-format/zoon-rust
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/zoon-format/zoon-rust
- Owner: zoon-format
- Created: 2025-12-28T20:50:11.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-12-29T05:09:47.000Z (about 2 months ago)
- Last Synced: 2026-01-04T16:56:39.450Z (about 2 months ago)
- Language: Rust
- Size: 29 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# zoon-rust
A Rust implementation of [ZOON (Zero Overhead Object Notation)](https://github.com/zoon-format/zoon/blob/main/SPEC.md) - the most token-efficient data format for LLMs.
[](https://crates.io/crates/zoon-format)
[](LICENSE)
## Installation
Add to your `Cargo.toml`:
```toml
[dependencies]
zoon-format = "1.0"
```
## Usage
### Encoding
```rust
use zoon::encode;
use serde::Serialize;
#[derive(Serialize)]
struct User {
id: i32,
name: String,
role: String,
active: bool,
}
fn main() {
let users = vec![
User { id: 1, name: "Alice".into(), role: "Admin".into(), active: true },
User { id: 2, name: "Bob".into(), role: "User".into(), active: false },
];
let encoded = zoon::encode(&users).unwrap();
println!("{}", encoded);
// # id:i name:s role=Admin|User active:b
// Alice Admin 1
// Bob User 0
}
```
### Decoding
```rust
use zoon::decode;
use serde::Deserialize;
#[derive(Deserialize, Debug)]
struct User {
id: i32,
name: String,
role: String,
active: bool,
}
fn main() {
let input = "# id:i name:s role:s active:b\n1 Alice Admin 1\n2 Bob User 0";
let users: Vec = zoon::decode(input).unwrap();
println!("{:?}", users);
}
```
## API
| Function | Description |
| ------------------------------------------------------- | ------------------------------------- |
| `encode(value: &T) -> Result` | Encode any serializable value to ZOON |
| `decode(input: &str) -> Result` | Decode ZOON into a value |
## Type Mapping
| Rust Type | ZOON Type | Header |
| ------------------ | --------- | ------ |
| `i32`, `i64` | Integer | `:i` |
| `bool` | Boolean | `:b` |
| `String` | String | `:s` |
| `Option` (None) | Null | `~` |
| Auto-increment ID | Implicit | `:i+` |
## License
MIT License. © 2025-PRESENT Carsen Klock.