Skip to content

Commit 0ffc75b

Browse files
authored
Merge pull request rust-lang#35 from bluss/hasher
Add with_hasher, hasher methods
2 parents 1fd3f60 + 94d5638 commit 0ffc75b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,20 @@ impl<K, V, S> OrderMap<K, V, S>
381381
/// Computes in **O(1)** time.
382382
pub fn is_empty(&self) -> bool { self.len() == 0 }
383383

384+
/// Create a new map with `hash_builder`
385+
pub fn with_hasher(hash_builder: S) -> Self
386+
where S: BuildHasher
387+
{
388+
Self::with_capacity_and_hasher(0, hash_builder)
389+
}
390+
391+
/// Return a reference to the map's `BuildHasher`.
392+
pub fn hasher(&self) -> &S
393+
where S: BuildHasher
394+
{
395+
&self.hash_builder
396+
}
397+
384398
// Return whether we need 32 or 64 bits to specify a bucket or entry index
385399
#[cfg(not(feature = "test_low_transition_point"))]
386400
fn size_class_is_64bit(&self) -> bool {

0 commit comments

Comments
 (0)