| Crates.io | sirius |
| lib.rs | sirius |
| version | 0.1.1 |
| created_at | 2025-06-19 12:55:09.796927+00 |
| updated_at | 2025-06-21 06:01:41.817756+00 |
| description | A binary serialization/deserialization library |
| homepage | |
| repository | https://github.com/thatmagicalcat/sirius |
| max_upload_size | |
| id | 1718328 |
| size | 20,187 |
A fast, zero-allocation binary serialization/deserialization library for Rust. Sirius provides a simple derive macro to automatically implement efficient binary serialization for your structs and enums, with a focus on performance and minimal overhead.
Note: This crate originally started as
Schemouin github.com/Colabie/Colabie, but is now extracted as a standalone repository. This repo will continue to be used inColabie/Colabiefor serialization needs.
#[derive(Sirius)] to auto-implement the Sirius trait for your types.Write, or use serialize_buffered() for convenience.use sirius::Sirius;
#[derive(Sirius)]
struct MyStruct {
a: u32,
b: String,
c: Vec<char>,
}
fn main() {
let value = MyStruct {
a: 42,
b: "Hello".to_string(),
c: vec!['H', 'i'],
};
let serialized = value.serialize_buffered();
let (deserialized, bytes_read) = MyStruct::deserialize(&serialized).unwrap();
assert_eq!(value, deserialized);
assert_eq!(bytes_read, serialized.len());
}
Sirius is designed for speed. Here are real benchmark results (run on a modern x86_64 CPU, Rust nightly):
| Type | Sirius Serialize | Sirius Deserialize |
|---|---|---|
u32 |
~1.14 ns/iter | ~1.81 ns/iter |
String (16 bytes) |
~21.17 ns/iter | ~14.66 ns/iter |
Vec<u32> (100 items) |
~267.95 ns/iter | ~271.41 ns/iter |
Note: Actual performance may vary depending on your hardware and compiler settings. For real benchmarks, run cargo +nightly bench.
MIT