memcomparable

Crates.iomemcomparable
lib.rsmemcomparable
version0.2.0
sourcesrc
created_at2022-11-29 04:24:31.287443
updated_at2023-05-16 04:20:34.155922
descriptionA memcomparable serialization format.
homepagehttps://github.com/risingwavelabs/memcomparable
repositoryhttps://github.com/risingwavelabs/memcomparable
max_upload_size
id725058
size72,262
crates-io (github:risingwavelabs:crates-io)

documentation

README

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.

Commit count: 16

cargo fmt