Skip to content

Commit 6046c4e

Browse files
authored
Merge pull request #19 from cuviper/buckets
Use the bucket API from hashbrown v0.16.1
2 parents 36c5486 + 8ef1692 commit 6046c4e

File tree

7 files changed

+331
-423
lines changed

7 files changed

+331
-423
lines changed

Cargo.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "ringmap"
33
edition = "2021"
4-
version = "0.2.0"
4+
version = "0.2.1"
55
documentation = "https://docs.rs/ringmap/"
66
repository = "https://github.com/indexmap-rs/ringmap"
77
license = "Apache-2.0 OR MIT"
@@ -15,6 +15,7 @@ bench = false
1515

1616
[dependencies]
1717
equivalent = { version = "1.0", default-features = false }
18+
hashbrown = { version = "0.16.1", default-features = false }
1819

1920
arbitrary = { version = "1.0", optional = true, default-features = false }
2021
quickcheck = { version = "1.0", optional = true, default-features = false }
@@ -23,10 +24,6 @@ borsh = { version = "1.2", optional = true, default-features = false }
2324
rayon = { version = "1.9", optional = true }
2425
sval = { version = "2", optional = true, default-features = false }
2526

26-
[dependencies.hashbrown]
27-
version = "0.16.0"
28-
default-features = false
29-
3027
# serde v1.0.220 is the first version that released with `serde_core`.
3128
# This is required to avoid conflict with other `serde` users which may require an older version.
3229
[target.'cfg(any())'.dependencies]

RELEASES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Releases
22

3+
## 0.2.1 (2025-11-20)
4+
5+
- Simplified a lot of internals using `hashbrown`'s new bucket API.
6+
37
## 0.2.0 (2025-10-18)
48

59
- **MSRV**: Rust 1.82.0 or later is now required.

src/map.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ where
760760
/// Computes in **O(1)** time (amortized average).
761761
pub fn entry(&mut self, key: K) -> Entry<'_, K, V> {
762762
let hash = self.hash(&key);
763-
self.core.entry(hash, key)
763+
Entry::new(&mut self.core, hash, key)
764764
}
765765

766766
/// Creates a splicing iterator that replaces the specified range in the map
@@ -1564,10 +1564,7 @@ impl<K, V, S> RingMap<K, V, S> {
15641564
///
15651565
/// Computes in **O(1)** time.
15661566
pub fn get_index_entry(&mut self, index: usize) -> Option<IndexedEntry<'_, K, V>> {
1567-
if index >= self.len() {
1568-
return None;
1569-
}
1570-
Some(IndexedEntry::new(&mut self.core, index))
1567+
IndexedEntry::new(&mut self.core, index)
15711568
}
15721569

15731570
/// Get an array of `N` key-value pairs by `N` indices

0 commit comments

Comments
 (0)