aboutsummaryrefslogtreecommitdiff
path: root/src/specialize.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/specialize.rs')
-rw-r--r--src/specialize.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/specialize.rs b/src/specialize.rs
index 7dddb9a..d94a4ee 100644
--- a/src/specialize.rs
+++ b/src/specialize.rs
@@ -25,9 +25,19 @@ use alloc::vec::Vec;
///
/// let hash_builder = RandomState::new();
/// //...
-/// let value = 17;
+/// let value: u32 = 17;
/// let hash = u32::get_hash(&value, &hash_builder);
/// ```
+/// Note that the type used to invoke `get_hash` must be the same a the type of value passed.
+/// For example get a hasher specialized on `[u8]` can invoke:
+/// ```
+/// /// use std::hash::BuildHasher;
+/// # use ahash::RandomState;
+/// # use ahash::CallHasher;
+/// # let hash_builder = RandomState::new();
+/// let bytes: [u8; 4] = [1, 2, 3, 4];
+/// let hash = <[u8]>::get_hash(&bytes, &hash_builder);
+/// ```
pub trait CallHasher {
fn get_hash<H: Hash + ?Sized, B: BuildHasher>(value: &H, build_hasher: &B) -> u64;
}