feat: add drop key functionality #6

Merged
mvhutz merged 12 commits from feat/drop-item into main 2026-03-20 01:59:55 +00:00
Showing only changes of commit 74ed81761c - Show all commits

View File

@@ -26,11 +26,12 @@ func (b bucket[K, V]) get(key K) (value V, found bool) {
return slot.value, slot.occupied && b.compare(slot.key, key) return slot.value, slot.occupied && b.compare(slot.key, key)
} }
func (b bucket[K, V]) drop(key K) (occupied bool) { func (b *bucket[K, V]) drop(key K) (occupied bool) {
slot := &b.slots[b.location(key)] slot := &b.slots[b.location(key)]
if slot.occupied && b.compare(slot.key, key) { if slot.occupied && b.compare(slot.key, key) {
slot.occupied = false slot.occupied = false
b.size--
return true return true
} }