mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #44794 - napen123:master, r=frewsxcv
Add doc example to HashMap::hasher None
This commit is contained in:
@@ -691,6 +691,17 @@ pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> HashMap<K,
|
||||
/// 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
|
||||
|
||||
Reference in New Issue
Block a user