Trait cityhash_sys::CityHash
source · [−]pub trait CityHash {
fn city_hash_32(&self) -> u32;
fn city_hash_64(&self) -> u64;
fn city_hash_64_with_seed(&self, seed: u64) -> u64;
fn city_hash_64_with_seeds(&self, seed_0: u64, seed_1: u64) -> u64;
fn city_hash_128(&self) -> u128;
fn city_hash_128_with_seed(&self, seed: u128) -> u128;
}
Expand description
CityHash
trait provides CityHash functions to type that implement this trait.
This trait is a syntax sugar for city_hash_...
functions.
Required Methods
fn city_hash_32(&self) -> u32
fn city_hash_32(&self) -> u32
Retrieves a 32-bit hash of a value.
Example
use cityhash_sys::CityHash;
assert_eq!([0u8,1,2,3,4].city_hash_32(), 0xFE6E37D4);
fn city_hash_64(&self) -> u64
fn city_hash_64(&self) -> u64
Retrieves a 64-bit hash of a value.
Example
use cityhash_sys::CityHash;
assert_eq!([0u8,1,2,3,4].city_hash_64(), 0xB4BFA9E87732C149);
fn city_hash_64_with_seed(&self, seed: u64) -> u64
fn city_hash_64_with_seed(&self, seed: u64) -> u64
Retrieves a 64-bit hash of a value, a seed is also hashed into the result.
Example
use cityhash_sys::CityHash;
assert_eq!([0u8,1,2,3,4].city_hash_64_with_seed(123), 0xCE1706019C5E61A7);
fn city_hash_64_with_seeds(&self, seed_0: u64, seed_1: u64) -> u64
fn city_hash_64_with_seeds(&self, seed_0: u64, seed_1: u64) -> u64
Retrieves a 64-bit hash of a value, two seeds is also hashed into the result.
Example
use cityhash_sys::CityHash;
assert_eq!([0u8,1,2,3,4].city_hash_64_with_seeds(123, 456), 0xD83C81881E3A35E3);
fn city_hash_128(&self) -> u128
fn city_hash_128(&self) -> u128
Retrieves a 128-bit hash of a slice of bytes.
Example
use cityhash_sys::CityHash;
assert_eq!([0u8,1,2,3,4].city_hash_128(), 0xE3CB1F3F3AB9643BEF3668C150012EEC);
fn city_hash_128_with_seed(&self, seed: u128) -> u128
fn city_hash_128_with_seed(&self, seed: u128) -> u128
Retrieves a 128-bit hash of a value, a seed is also hashed into the result.
Example
use cityhash_sys::CityHash;
assert_eq!([0u8,1,2,3,4].city_hash_128_with_seed(123), 0x68DA6334DE1F04C9CE255B9613AD58B7);