mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
bump slab to 0.4.0
Makes some of the code easier to read.
This commit is contained in:
+3
-3
@@ -42,10 +42,10 @@ impl<T: Ord> Heap<T> {
|
||||
pub fn push(&mut self, t: T) -> Slot {
|
||||
self.assert_consistent();
|
||||
let len = self.items.len();
|
||||
if self.index.available() == 0 {
|
||||
if self.index.len() == self.index.capacity() {
|
||||
self.index.reserve_exact(len);
|
||||
}
|
||||
let slot_idx = self.index.insert(len).unwrap();
|
||||
let slot_idx = self.index.insert(len);
|
||||
self.items.push((t, slot_idx));
|
||||
self.percolate_up(len);
|
||||
self.assert_consistent();
|
||||
@@ -68,7 +68,7 @@ impl<T: Ord> Heap<T> {
|
||||
|
||||
pub fn remove(&mut self, slot: Slot) -> T {
|
||||
self.assert_consistent();
|
||||
let idx = self.index.remove(slot.idx).unwrap();
|
||||
let idx = self.index.remove(slot.idx);
|
||||
let (item, slot_idx) = self.items.swap_remove(idx);
|
||||
debug_assert_eq!(slot.idx, slot_idx);
|
||||
if idx < self.items.len() {
|
||||
|
||||
Reference in New Issue
Block a user