3 unstable releases

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

#637 in Encoding

Download history 1250/week @ 2024-12-15 1095/week @ 2024-12-22 2715/week @ 2024-12-29 4163/week @ 2025-01-05 3696/week @ 2025-01-12 3369/week @ 2025-01-19 1161/week @ 2025-01-26 2772/week @ 2025-02-02 4051/week @ 2025-02-09 1473/week @ 2025-02-16 1572/week @ 2025-02-23 3086/week @ 2025-03-02 2022/week @ 2025-03-09 2184/week @ 2025-03-16 1999/week @ 2025-03-23 1237/week @ 2025-03-30

7,488 downloads per month

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.5–1.2MB
~25K SLoC