| Crates.io | jaguar |
| lib.rs | jaguar |
| version | 1.0.0 |
| created_at | 2025-05-25 22:31:08.414141+00 |
| updated_at | 2025-05-25 22:31:08.414141+00 |
| description | A high-performance, compact binary serialization library |
| homepage | |
| repository | https://github.com/joeymeere/jaguar |
| max_upload_size | |
| id | 1688749 |
| size | 71,923 |
A lightweight binary serialization library designed for high-performance operations in resource-constrained environments like sBPF programs and embedded systems.
Run:
cargo add jaguar
Or add to your Cargo.toml:
[dependencies]
jaguar = "0.1.0"
With primitive types:
use jaguar::{JaguarSerializer, JaguarDeserializer};
let pubkey = [1u8; 32];
let mut ser = JaguarSerializer::new();
pubkey.serialize(&mut ser).unwrap();
let data = ser.finish();
let mut de = JaguarDeserializer::new(&data);
let decoded = <[u8; 32]>::deserialize(&mut de).unwrap();
With custom data structures:
use jaguar::{JaguarSerialize, JaguarDeserialize, JaguarSerializer, JaguarDeserializer};
#[derive(JaguarSerialize, JaguarDeserialize)]
struct MyData {
authority: [u8; 32],
amount: u64,
bump: u8,
}
let mut ser = JaguarSerializer::new();
let instance = MyData { /* struct field values */ }.serialize(&mut ser).unwrap();
let mut de = JaguarDeserializer::new(&instance);
let value = MyData::deserialize(&de).unwrap();
Benchmarks on an M1 Mac Pro:
SimpleStruct: ~60.04nsComplexStruct: ~1.121µsVec<SimpleStruct>: ~46.12µsVec<u8>: ~348.49ns,Vec<i8>: ~19.31µsVec<u16>: ~22.01µsVec<i16>: ~20.50µsVec<u64>: ~22.14µsVec<i64>: ~20.55µsVec<bool>: ~4.07µsSimpleStruct: ~46.7nsComplexStruct: ~1.153µsVec<SimpleStruct>: ~39.4µsVec<u8>: ~171ns,Vec<i8>: ~11.36µsVec<u16>: ~9.71µsVec<i16>: ~12.09µsVec<u64>: ~9.82µsVec<i64>: ~11.92µsVec<bool>: ~4.07µsContributions are welcome! Please read the Contributing Guide for details on the process for submitting pull requests.
This project is MIT licensed - see LICENSE for details.