Skip to content

Commit

Permalink
Add doc example to HashMap::hasher
Browse files Browse the repository at this point in the history
  • Loading branch information
napen123 committed Sep 24, 2017
1 parent a83c3e7 commit bc43e17
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/libstd/collections/hash/map.rs
Expand Up @@ -691,6 +691,17 @@ impl<K, V, S> HashMap<K, V, S>
/// Returns a reference to the map's [`BuildHasher`].
///
/// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html
///
/// # Examples
///
/// ```
/// use std::collections::HashMap;
/// use std::collections::hash_map::RandomState;
///
/// let hasher = RandomState::new();
/// let map: HashMap<isize, isize> = HashMap::with_hasher(hasher);
/// let hasher: &RandomState = map.hasher();
/// ```
#[stable(feature = "hashmap_public_hasher", since = "1.9.0")]
pub fn hasher(&self) -> &S {
&self.hash_builder
Expand Down

0 comments on commit bc43e17

Please sign in to comment.