diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 173214eda44c7..d8748d09d0464 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -642,6 +642,13 @@ impl HashMap HashMap::with_capacity_and_hasher(capacity, hash_state) } + /// Returns a reference to the map's hasher. + #[unstable(feature = "hashmap_public_hasher", reason = "don't want to make insta-stable", + issue = "31262")] + pub fn hasher(&self) -> &S { + &self.hash_builder + } + /// Returns the number of elements the map can hold without reallocating. /// /// This number is a lower bound; the `HashMap` might be able to hold diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index b5f47853afd4e..5c58cd9dfbf7c 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -193,6 +193,13 @@ impl HashSet } } + /// Returns a reference to the set's hasher. + #[unstable(feature = "hashmap_public_hasher", reason = "don't want to make insta-stable", + issue = "31262")] + pub fn hasher(&self) -> &S { + self.map.hasher() + } + /// Deprecated, renamed to `with_hasher` #[inline] #[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",