File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,18 @@ const PRIME: u32 = 0x1000193;
88/// Specifically this implements the [FNV-1a hash].
99///
1010/// [FNV-1a hash]: https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash
11+ ///
12+ /// # Examples
13+ ///
14+ /// ```
15+ /// use core::hash::Hasher as _;
16+ /// use hash32::{FnvHasher, Hasher as _};
17+ ///
18+ /// let mut hasher: FnvHasher = Default::default();
19+ /// hasher.write(b"Hello, World!");
20+ ///
21+ /// println!("Hash is {:x}!", hasher.finish32());
22+ /// ```
1123#[ derive( Debug , Clone ) ]
1224pub struct FnvHasher {
1325 state : u32 ,
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ mod murmur3;
8686/// # Examples
8787///
8888/// ```
89- /// use core::hash::{ Hasher as _} ;
89+ /// use core::hash::Hasher as _;
9090/// use hash32::{FnvHasher, Hasher as _};
9191///
9292/// let mut hasher: FnvHasher = Default::default();
Original file line number Diff line number Diff line change @@ -4,6 +4,18 @@ use core::slice;
44use crate :: Hasher as _;
55
66/// 32-bit `MurmurHash3` hasher
7+ ///
8+ /// # Examples
9+ ///
10+ /// ```
11+ /// use core::hash::Hasher as _;
12+ /// use hash32::{Hasher as _, Murmur3Hasher};
13+ ///
14+ /// let mut hasher: Murmur3Hasher = Default::default();
15+ /// hasher.write(b"Hello, World!");
16+ ///
17+ /// println!("Hash is {:x}!", hasher.finish32());
18+ /// ```
719#[ derive( Debug , Clone ) ]
820pub struct Murmur3Hasher {
921 buf : Buffer ,
You can’t perform that action at this time.
0 commit comments