Expand description
§OxiCode
OxiCode is a modern binary serialization library for Rust, serving as the successor to bincode.
It provides a compact, efficient binary encoding scheme with zero-fluff serialization. The encoded size is typically equal to or smaller than the in-memory representation.
§Features
- Compact encoding: Minimal overhead in serialized format
- Fast: Optimized for performance
- Flexible: Support for various encoding configurations
- Safe: No unwrap() policy, comprehensive error handling
- Modern: Built with latest Rust practices and patterns
§Example
ⓘ
use oxicode::{Encode, Decode};
#[derive(Encode, Decode, PartialEq, Debug)]
struct Point {
x: f32,
y: f32,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let point = Point { x: 1.0, y: 2.0 };
// Encode to bytes
let encoded = oxicode::encode(&point)?;
// Decode from bytes
let decoded: Point = oxicode::decode(&encoded)?;
assert_eq!(point, decoded);
Ok(())
}§Relation to bincode
OxiCode is designed as the spiritual successor to bincode, maintaining compatibility with the core concepts while introducing modern improvements and best practices.
Re-exports§
Modules§
- compression
compression-lz4orcompression-zstd - Built-in compression support for oxicode.
- config
- The config module is used to change the behavior of oxicode’s encoding and decoding logic.
- de
- Decoder-based structs and traits
- enc
- Encoder-based structs and traits
- error
- Error types for OxiCode
- serde
serde - Serde compatibility layer
- simd
simd - SIMD-optimized encoding and decoding for oxicode.
- streaming
alloc - Streaming serialization support for oxicode.
- validation
- Validation middleware for oxicode.
- versioning
- Schema versioning and evolution support for oxicode.
Macros§
- impl_
borrow_ decode - Helper macro to implement BorrowDecode for types that implement Decode. This is useful for types that don’t need to borrow from the input.
Functions§
- borrow_
decode_ from_ slice - Borrow decode a value from a byte slice (zero-copy) using standard configuration
- borrow_
decode_ from_ slice_ with_ config - Borrow decode a value from a byte slice (zero-copy) with custom configuration
- decode_
from_ reader - Decode a value from a reader using the given configuration
- decode_
from_ slice - Decode a value from a byte slice using the standard configuration
- decode_
from_ slice_ with_ config - Decode a value from a byte slice with a custom configuration
- decode_
from_ slice_ with_ context - Decode a value from a byte slice with custom context
- decode_
from_ std_ read std - Decode a value from a std::io::Read using the given configuration
- encode_
into_ slice - Encode a value into a byte slice
- encode_
into_ std_ write std - Encode a value into a std::io::Write using the given configuration
- encode_
into_ writer - Encode a value into a writer using the given configuration
- encode_
to_ vec alloc - Encode a value to a
Vec<u8>using the standard configuration - encode_
to_ vec_ with_ config alloc - Encode a value to a
Vec<u8>with a custom configuration