about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-07-24 15:18:48 +0530
committerGitHub <noreply@github.com>2016-07-24 15:18:48 +0530
commit10be6e6c9e5af5344cc85ff642128335f791d498 (patch)
tree44d981917eaaef1d79f93c3f474f1489e9bede8b /src
parent33ad70521bfaf305b6ce21428e465db85c07e46f (diff)
parent890706070dee22035032f936a51a122670d1cd40 (diff)
downloadrust-10be6e6c9e5af5344cc85ff642128335f791d498.tar.gz
rust-10be6e6c9e5af5344cc85ff642128335f791d498.zip
Rollup merge of #34976 - GuillaumeGomez:build_hasher_doc, r=steveklabnik
Add BuildHasher example

r? @steveklabnik
Diffstat (limited to 'src')
-rw-r--r--src/libcore/hash/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs
index 9e3f7a4a84a..27fdbd38301 100644
--- a/src/libcore/hash/mod.rs
+++ b/src/libcore/hash/mod.rs
@@ -234,6 +234,16 @@ pub trait BuildHasher {
     type Hasher: Hasher;
 
     /// Creates a new hasher.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::collections::hash_map::RandomState;
+    /// use std::hash::BuildHasher;
+    ///
+    /// let s = RandomState::new();
+    /// let new_s = s.build_hasher();
+    /// ```
     #[stable(since = "1.7.0", feature = "build_hasher")]
     fn build_hasher(&self) -> Self::Hasher;
 }