fn become_empty(&mut self, index: usize) -> Arc<V> {
        self.unlink_index(index);
        let mut old = CacheEntry::Empty(EmptyEntry {
            next_empty: self.empty_head,
        });
        std::mem::swap(&mut old, &mut self.entries[index]);
        self.empty_head = Some(index);
        match old {
            CacheEntry::Occupied(OccupiedEntry {
                key, item, cost, ..
            }) => {
                self.index.remove(&key);
                self.current_cost -= cost;
                item
            }
            _ => panic!("Should have been occupied"),
        }
    }
/// Make a specific index of the map become empty.
Make a specific index of the map become empty.
Make a specific index of the map become empty .
fn become_empty(&mut self, index: usize) -> Arc<V> {
        self.unlink_index(index);
        let mut old = CacheEntry::Empty(EmptyEntry {
            next_empty: self.empty_head,
        });
        std::mem::swap(&mut old, &mut self.entries[index]);
        self.empty_head = Some(index);
        match old {
            CacheEntry::Occupied(OccupiedEntry {
                key, item, cost, ..
            }) => {
                self.index.remove(&key);
                self.current_cost -= cost;
                item
            }
            _ => panic!("Should have been occupied"),
        }
    }
fn become_empty ( & mut self , index : usize ) -> Arc < V > { self . unlink_index ( index ) ; let mut old = CacheEntry :: Empty ( EmptyEntry { next_empty : self . empty_head , } ) ; std :: mem :: swap ( & mut old , & mut self . entries [ index ] ) ; self . empty_head = Some ( index ) ; match old { CacheEntry :: Occupied ( OccupiedEntry { key , item , cost , .. } ) => { self . index . remove ( & key ) ; self . current_cost -= cost ; item } _ => panic ! ( " " ) , } }
Make a specific index of the map become empty.
Make a specific index of the map become empty .
&mut self
index
usize
&mut self
index
usize