about summary refs log tree commit diff
path: root/src/libstd/collections
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-08-01 07:41:06 -0400
committerCorey Farwell <coreyf@rwell.org>2017-08-01 19:51:00 -0400
commit881062776afe4575f3c9d6534f688a70cf34a7db (patch)
treee1fe78e9ab2ce88ca71150d21ad570abdd5f8ac1 /src/libstd/collections
parentdd53dd5f9e21dce1fbc06b7f9f451d1009bdcfd8 (diff)
downloadrust-881062776afe4575f3c9d6534f688a70cf34a7db.tar.gz
rust-881062776afe4575f3c9d6534f688a70cf34a7db.zip
Add doc example for HashSet::hasher.
Diffstat (limited to 'src/libstd/collections')
-rw-r--r--src/libstd/collections/hash/set.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs
index d80df5f18b6..040595bbb04 100644
--- a/src/libstd/collections/hash/set.rs
+++ b/src/libstd/collections/hash/set.rs
@@ -215,6 +215,17 @@ impl<T, S> HashSet<T, S>
     /// Returns a reference to the set's [`BuildHasher`].
     ///
     /// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::collections::HashSet;
+    /// use std::collections::hash_map::RandomState;
+    ///
+    /// let hasher = RandomState::new();
+    /// let set: HashSet<i32> = HashSet::with_hasher(hasher);
+    /// let hasher: &RandomState = set.hasher();
+    /// ```
     #[stable(feature = "hashmap_public_hasher", since = "1.9.0")]
     pub fn hasher(&self) -> &S {
         self.map.hasher()