jump_hash_from_str

Function jump_hash_from_str 

Source
pub fn jump_hash_from_str(key: &str, buckets: u32) -> u32
Expand description

hashes an &str to a u32 which is in the range of 0..buckets

expects a number of buckets greater than zero

use jumpconsistenthash::jump_hash_from_str;
//the bucket hashed should always be less than the number of buckets
let number_of_buckets = 10;
let next_bucket = jump_hash_from_str("some_key", number_of_buckets);
assert!(next_bucket < number_of_buckets);