about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2017-09-29 17:58:56 -0600
committerGitHub <noreply@github.com>2017-09-29 17:58:56 -0600
commitf2feb83b730656e4b884d7d8881aa2a2ea12aba4 (patch)
tree13635e32801d4d62a02331b63cc24321d2337b70 /src
parent808387798711f6a87d2aed6e5476dc9229e40987 (diff)
parentbc43e1739234727ebddaf475c2851eab00353324 (diff)
downloadrust-f2feb83b730656e4b884d7d8881aa2a2ea12aba4.tar.gz
rust-f2feb83b730656e4b884d7d8881aa2a2ea12aba4.zip
Rollup merge of #44794 - napen123:master, r=frewsxcv
Add doc example to HashMap::hasher

None
Diffstat (limited to 'src')
-rw-r--r--src/libstd/collections/hash/map.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 026b863b963..7d000d7c859 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -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