Skip to content

Commit

Permalink
Merge pull request rust-lang#35 from bluss/hasher
Browse files Browse the repository at this point in the history
Add with_hasher, hasher methods
  • Loading branch information
bluss committed Sep 11, 2017
2 parents 1fd3f60 + 94d5638 commit 0ffc75b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,20 @@ impl<K, V, S> OrderMap<K, V, S>
/// Computes in **O(1)** time.
pub fn is_empty(&self) -> bool { self.len() == 0 }

/// Create a new map with `hash_builder`
pub fn with_hasher(hash_builder: S) -> Self
where S: BuildHasher
{
Self::with_capacity_and_hasher(0, hash_builder)
}

/// Return a reference to the map's `BuildHasher`.
pub fn hasher(&self) -> &S
where S: BuildHasher
{
&self.hash_builder
}

// Return whether we need 32 or 64 bits to specify a bucket or entry index
#[cfg(not(feature = "test_low_transition_point"))]
fn size_class_is_64bit(&self) -> bool {
Expand Down

0 comments on commit 0ffc75b

Please sign in to comment.