diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-07-24 15:18:47 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-24 15:18:47 +0530 |
| commit | 33ad70521bfaf305b6ce21428e465db85c07e46f (patch) | |
| tree | d0607d2c8b6cf6b483e501cb0085587b948fffb0 /src/libstd/collections | |
| parent | 87cc1b9330d52833b17bfde93c901521a757041c (diff) | |
| parent | 3c8fae369f54649fe90dc85f284e897974aeb1ca (diff) | |
Rollup merge of #34975 - GuillaumeGomez:random_state_doc, r=steveklabnik
Add Random state doc Last part of #29348. r? @steveklabnik
Diffstat (limited to 'src/libstd/collections')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index a03249e0063..ed5ac3bc0c1 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1699,6 +1699,17 @@ impl<'a, K, V, S> Extend<(&'a K, &'a V)> for HashMap<K, V, S> /// A particular instance `RandomState` will create the same instances of /// `Hasher`, but the hashers created by two different `RandomState` /// instances are unlikely to produce the same result for the same values. +/// +/// # Examples +/// +/// ``` +/// use std::collections::HashMap; +/// use std::collections::hash_map::RandomState; +/// +/// let s = RandomState::new(); +/// let mut map = HashMap::with_hasher(s); +/// map.insert(1, 2); +/// ``` #[derive(Clone)] #[stable(feature = "hashmap_build_hasher", since = "1.7.0")] pub struct RandomState { @@ -1708,6 +1719,14 @@ pub struct RandomState { impl RandomState { /// Constructs a new `RandomState` that is initialized with random keys. + /// + /// # Examples + /// + /// ``` + /// use std::collections::hash_map::RandomState; + /// + /// let s = RandomState::new(); + /// ``` #[inline] #[allow(deprecated)] // rand #[stable(feature = "hashmap_build_hasher", since = "1.7.0")] |
