Add doc example for HashSet::hasher.
This commit is contained in:
parent
dd53dd5f9e
commit
881062776a
1 changed files with 11 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue