File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,6 +203,9 @@ impl<T> Copy for NoHashHasher<T> {}
203203/// # Example
204204///
205205/// ```
206+ /// use std::hash::{BuildHasher, Hasher, Hash};
207+ /// use fp_nohash_hasher::NoHashHasher;
208+ ///
206209/// #[derive(PartialEq, Eq)]
207210/// struct SomeType(u32);
208211///
@@ -213,14 +216,21 @@ impl<T> Copy for NoHashHasher<T> {}
213216/// }
214217///
215218/// impl fp_nohash_hasher::IsEnabled for SomeType {}
216- ///
219+ ///#[cfg(feature = "std")] {
217220/// let mut m = fp_nohash_hasher::IntMap::default();
218221///
219222/// m.insert(SomeType(1), 't');
220223/// m.insert(SomeType(0), 'f');
221224///
222225/// assert_eq!(Some(&'t'), m.get(&SomeType(1)));
223226/// assert_eq!(Some(&'f'), m.get(&SomeType(0)));
227+ /// }
228+ ///
229+ /// let mut hasher: NoHashHasher<SomeType> = fp_nohash_hasher::BuildNoHashHasher::default().build_hasher();
230+ ///
231+ /// SomeType(12345).hash(&mut hasher);
232+ ///
233+ /// assert_eq!(12345u64, hasher.finish());
224234/// ```
225235pub trait IsEnabled { }
226236
You can’t perform that action at this time.
0 commit comments