#byte #map #mapping #transform #input #order-inverting

bytes-inverse

A Rust library that provides order-inverting mapping for bytes where for any bytes a < b, we have map(a) > map(b)

3 releases

new 0.1.3 Dec 16, 2024
0.1.2 Dec 13, 2024
0.1.1 Dec 13, 2024

#35 in #mapping

Download history 193/week @ 2024-12-08

193 downloads per month

MIT/Apache

9KB
132 lines

bytes-inverse

Rust codecov Crates.io Documentation

A Rust library that provides order-inverting mapping for bytes. It transforms input bytes while preserving their ordinal relationships in reverse order.

  1. For any input bytes a and b where a < b, the mapping guarantees map(a) > map(b).
  2. For any input bytes a, the mapping guarantees unmap(map(a)) = a.

Usage

let e = bytes_inverse::map(b"");
let a = bytes_inverse::map(b"a");
assert!(e > a);

let b = bytes_inverse::map(b"b");
assert!(e > b);
assert!(a > b);

let aa = bytes_inverse::map(b"aa");
assert!(e > aa);
assert!(a > aa);
assert!(aa > b);

No runtime deps