about summary refs log tree commit diff
path: root/src/libstd/collections
diff options
context:
space:
mode:
authorEthan Dagner <napen123@gmail.com>2017-09-23 11:47:21 -0600
committerEthan Dagner <napen123@gmail.com>2017-09-24 10:29:37 -0600
commitbc43e1739234727ebddaf475c2851eab00353324 (patch)
tree7455a2e8dd21c316b38b6af5751e8c0f134d6bda /src/libstd/collections
parenta83c3e777145bd2fd127857b3b73d5a174e1f2dd (diff)
downloadrust-bc43e1739234727ebddaf475c2851eab00353324.tar.gz
rust-bc43e1739234727ebddaf475c2851eab00353324.zip
Add doc example to HashMap::hasher
Diffstat (limited to 'src/libstd/collections')
-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 96af2272578..f28577d257e 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