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;
8
8
/// Specifically this implements the [FNV-1a hash].
9
9
///
10
10
/// [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
+ /// ```
11
23
#[ derive( Debug , Clone ) ]
12
24
pub struct FnvHasher {
13
25
state : u32 ,
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ mod murmur3;
86
86
/// # Examples
87
87
///
88
88
/// ```
89
- /// use core::hash::{ Hasher as _} ;
89
+ /// use core::hash::Hasher as _;
90
90
/// use hash32::{FnvHasher, Hasher as _};
91
91
///
92
92
/// let mut hasher: FnvHasher = Default::default();
Original file line number Diff line number Diff line change @@ -4,6 +4,18 @@ use core::slice;
4
4
use crate :: Hasher as _;
5
5
6
6
/// 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
+ /// ```
7
19
#[ derive( Debug , Clone ) ]
8
20
pub struct Murmur3Hasher {
9
21
buf : Buffer ,
You can’t perform that action at this time.
0 commit comments