Expand description
§Serde Binary Advanced
Serde Binary Advanced is a Serde library enabling the serialization and deserialization of Rust objects to binary representations.
§Features
- Serialization and deserialization of Rust data structures to and from binary format
- Full support for ASCII (through
lowlevel-types) and UTF-8 characters and strings - Support for Big Endian and Little Endian (default) encoding
- Comprehensive error reporting
- Compression of
usizemarkers for sequences and structures - Support for
u128andi128types - Enums and variants stored as
u32
§Limitations
- No support foe serializing or deserializing sequences or maps of unknown length
§Installation
Installation
Add this to your Cargo.toml:
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_binary_adv = { version = "1.0.0-beta.3" }
lowlevel_types = { version = "1.0.0-beta.3" }§Usage
Here’s a quick example on how to use Serde Binary Advanced to serialize and deserialize a struct to and from binary:
use serde::{Serialize, Deserialize};
use serde_binary_adv::{Serializer, Deserializer, BinaryError, Result}
struct Point {
x: f64,
y: f64,
}
fn main() {
let point = Point { x: 1.0, y: 2.0 };
let serialized = Serializer::to_bytes(&point, false).unwrap();
let deserialized: Point = Deserializer::from_bytes(&serialized, false).unwrap();
assert_eq!(value, deserialized,);
}§Legal
Serde Binary Advanced is copyright © 2025 JEleniel and released under either The MIT License or The Apache License, at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you shall be licensed as above, without any additional terms or conditions.
Modules§
- stream
- Versions of the Serde Binary Advanced Serializer and Deserializer optimized for use with streams that implement Read/Write
Structs§
- Deserializer
- Deserializes binary data into Rust types
- Serializer
- A structure for serializing Rust values into binary.
Enums§
- Binary
Error - Errors that can be thrown by the Serializer or Deserializer
- Byte
Format - How to serialize multibyte sequences (e.g. u128, i128, f64)
Type Aliases§
- Result
- an Ok(()) or Err(serde_binary_adv::BinaryError)