Function min_key_needed

Source
pub const fn min_key_needed(lists: &[&[Key]]) -> usize
Expand description

Calculates at const time the minimum number of bytes (1, 2, 4, or 8) to avoid hash collisions in the lists of keys provided.

If there are any duplicates, this function will panic at compile time. Otherwise, this function will return 1, 2, 4, or 8.

This function takes a very dumb “brute force” approach, that is of the order O(4 * N^2 * M^2), where N is lists.len(), and M is the length of each sub-list. It is not recommended to call this outside of const context.