Crate binary_prefix

Source
Expand description

This module is for finding prefixes between binary sequences. The intented use is for making range queries on key-value stores which only accept prefix queries. (e.g. Redis and S3)

§Parameters and Return Types

The base type that all the functions operate on is a slice of booleans. The examples pass array references, but vectors are also compatible. Each element in the slice represents a binary zero or one. Prefixes are returned as slices of the original inputs.

Functions§

pad
Utility function to pad an input value with leading zeros.
range_prefix
Finds the two longest prefixes that cover a binary range.
shared_prefix
Finds the longest possible shared prefix between two binary vectors.