#serialization #serde

memcomparable

A memcomparable serialization format

3 unstable releases

0.2.0 May 16, 2023
0.1.1 Apr 12, 2023
0.1.0 Nov 29, 2022

#976 in Encoding

Download history 2318/week @ 2025-10-12 1251/week @ 2025-10-19 1813/week @ 2025-10-26 2413/week @ 2025-11-02 2062/week @ 2025-11-09 1685/week @ 2025-11-16 6780/week @ 2025-11-23 2738/week @ 2025-11-30 1905/week @ 2025-12-07 1693/week @ 2025-12-14 1004/week @ 2025-12-21 546/week @ 2025-12-28 1373/week @ 2026-01-04 1157/week @ 2026-01-11 1472/week @ 2026-01-18 1289/week @ 2026-01-25

5,324 downloads per month
Used in masstree

Apache-2.0

59KB
1.5K SLoC

memcomparable

Crate Docs CI

A memcomparable serialization format.

The memcomparable format allows comparison of two values by using the simple memcmp function.

Installation

Add the memcomparable to your Cargo.toml:

$ cargo add memcomparable

Usage

// serialize
let key1 = memcomparable::to_vec(&"hello").unwrap();
let key2 = memcomparable::to_vec(&"world").unwrap();
assert!(key1 < key2);

// deserialize
let v1: String = memcomparable::from_slice(&key1).unwrap();
let v2: String = memcomparable::from_slice(&key2).unwrap();
assert_eq!(v1, "hello");
assert_eq!(v2, "world");

Optional Features

  • decimal: Enable (de)serialization for Decimal type.

See the documentation for more details.

License

Apache License 2.0. Please refer to LICENSE for more information.

Dependencies

~0.4–1.3MB
~26K SLoC