#comparison #serde #values #memcmp

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

#521 in Encoding

Download history 4662/week @ 2023-12-18 5760/week @ 2023-12-25 4815/week @ 2024-01-01 5752/week @ 2024-01-08 6494/week @ 2024-01-15 5920/week @ 2024-01-22 8228/week @ 2024-01-29 4176/week @ 2024-02-05 1432/week @ 2024-02-12 3695/week @ 2024-02-19 5656/week @ 2024-02-26 5162/week @ 2024-03-04 4279/week @ 2024-03-11 4969/week @ 2024-03-18 4954/week @ 2024-03-25 4688/week @ 2024-04-01

18,921 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.6–1.4MB
~30K SLoC