bincake 1.0.1

Serde-free deterministic binary serialization.
Documentation

bincake

Serde-free deterministic binary serialization.

Rust Crates.io

Documentation

https://docs.rs/bincake

Overview

bincake serializes and deserializes Rust types to and from compact little-endian binary, with no dependency on serde.

  • Deterministic output — identical data always produces identical bytes
  • Derive macros for automatic implementation on custom types
    • Controlled by derive feature flag
  • Built on taped for zero-allocation byte reading
  • Numeric types, strings, vecs, and tuples supported out of the box

Originally developed as the bytecode serialization format for rvm, extracted as a standalone library after proving stable under real usage.

Example

use bincake::{Serialize, Tape};

#[derive(Serialize)]
struct Instruction {
    opcode: u8,
    operand: u32,
}

// serialize
let instr = Instruction { opcode: 0x01, operand: 42 };
let mut bytes = vec![];
instr.write_to(&mut bytes)?;

// deserialize
let mut tape = Tape::new(&bytes);
let instr = Instruction::read_from(&mut tape)?;

When to use this

  • Serializing bytecode, binary protocols, or other compact binary formats
  • Anywhere deterministic output is required (content hashing, signing)
  • Projects where serde compile times are a concern
  • no_std environments

When not to use this

  • Human-readable formats → use serde with serde_json or toml
  • Schema evolution and forward compatibility → use prost (protobuf)
  • Maximum encode/decode performance → use rkyv
  • Interoperability with other languages or systems → use bincode