Crate oxicode

Crate oxicode 

Source
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§

pub use de::Decode;
pub use enc::Encode;
pub use error::Error;
pub use error::Result;

Modules§

compressioncompression-lz4 or compression-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
serdeserde
Serde compatibility layer
simdsimd
SIMD-optimized encoding and decoding for oxicode.
streamingalloc
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_readstd
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_writestd
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_vecalloc
Encode a value to a Vec<u8> using the standard configuration
encode_to_vec_with_configalloc
Encode a value to a Vec<u8> with a custom configuration

Derive Macros§

Decodederive
Derive macro for the Decode trait
Encodederive
Derive macro for the Encode trait