7 releases

Uses new Rust 2024

0.1.3 Jan 9, 2026
0.1.2 Dec 21, 2025
0.1.1 Jul 16, 2025
0.0.3 Jul 16, 2025

#870 in Encoding

Download history 15/week @ 2025-12-28 33/week @ 2026-01-04 8/week @ 2026-01-11 21/week @ 2026-01-18 26/week @ 2026-01-25 47/week @ 2026-02-01 29/week @ 2026-02-08 75/week @ 2026-02-15 106/week @ 2026-02-22 54/week @ 2026-03-01 64/week @ 2026-03-08 122/week @ 2026-03-15 67/week @ 2026-03-22 68/week @ 2026-03-29 68/week @ 2026-04-05 67/week @ 2026-04-12

281 downloads per month
Used in 31 crates (16 directly)

Apache-2.0

130KB
3K SLoC

fexbluffers

Allocation optimized FlexBuffer implementation (Rust).

Slower for struct serialization/deserialization -- faster for some kinds of vector building.

// use flexbuffers;
use fexbluffers;

use stats_alloc::{INSTRUMENTED_SYSTEM, Region, StatsAlloc};
use std::alloc::System;

#[global_allocator]
static GLOBAL: &StatsAlloc<System> = &INSTRUMENTED_SYSTEM;

fn main() {
    let reg = Region::new(&GLOBAL);

    // let mut builder = flexbuffers::Builder::default();
    let mut builder = fexbluffers::Builder::default();
    let mut test_vec = builder.start_vector();

    test_vec.push("hello!");
    test_vec.push(123);
    test_vec.push(());
    test_vec.push("something else!");
    test_vec.push(10_000);

    test_vec.end_vector();

    builder.view();

    println!("stats: {:#?}", reg.change());
}

// This crate (OMM):

// stats: Stats {
//     allocations: 1,
//     deallocations: 0,
//     reallocations: 3,
//     bytes_allocated: 64,
//     bytes_deallocated: 0,
//     bytes_reallocated: 56,
// }
// time:   [195.81 ns 197.43 ns 199.05 ns]

// Official FlexBuffers crate (OMM):

// Stats {
//     allocations: 2,
//     deallocations: 0,
//     reallocations: 4,
//     bytes_allocated: 192,
//     bytes_deallocated: 0,
//     bytes_reallocated: 120,
// }
// time:   [266.06 ns 267.28 ns 268.46 ns]

forked from google's implementation https://github.com/google/flatbuffers/tree/c7b9dc83f58fe72162b076ba9c88d682f5d0eda6/rust/flexbuffers#readme

Flexbuffers

Flexbuffers is a schema-less binary format developed at Google. FlexBuffers can be accessed without parsing, copying, or allocation. This is a huge win for efficiency, memory friendly-ness, and allows for unique use cases such as mmap-ing large amounts of free-form data.

FlexBuffers' design and implementation allows for a very compact encoding, with automatic sizing of containers to their smallest possible representation (8/16/32/64 bits). Many values and offsets can be encoded in just 8 bits.

FlexBuffers supports Serde for automatically serializing Rust data structures into its binary format.

See Examples for Usage:

Flexbuffers is the schema-less cousin of Flatbuffers.

Dependencies

~115–305KB