mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Add doc example for HashSet::hasher.
This commit is contained in:
@@ -215,6 +215,17 @@ pub fn with_capacity_and_hasher(capacity: usize, hasher: 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()
|
||||
|
||||
Reference in New Issue
Block a user