pub fn update(&mut self, slot: Slot, account_info: T, reclaims: &mut SlotList<T>) {
        let mut addref = !account_info.is_cached();
        self.slot_list_mut(|list| {
            // find other dirty entries from the same slot
            for list_index in 0..list.len() {
                let (s, previous_update_value) = &list[list_index];
                if *s == slot {
                    addref = addref && previous_update_value.is_cached();

                    let mut new_item = (slot, account_info);
                    std::mem::swap(&mut new_item, &mut list[list_index]);
                    reclaims.push(new_item);
                    list[(list_index + 1)..]
                        .iter()
                        .for_each(|item| assert!(item.0 != slot));
                    return; // this returns from self.slot_list_mut above
                }
            }

            // if we make it here, we did not find the slot in the list
            list.push((slot, account_info));
        });
        if addref {
            // If it's the first non-cache insert, also bump the stored ref count
            self.ref_count().fetch_add(1, Ordering::Relaxed);
        }
    }
// Try to update an item in the slot list the given `slot` If an item for the slot
// already exists in the list, remove the older item, add it to `reclaims`, and insert
// the new item.
Try to update an item in the slot list the given `slot` If an item for the slot
already exists in the list, remove the older item, add it to `reclaims`, and insert
the new item.
Try to update an item in the slot list the given ` slot ` If an item for the slot already exists in the list remove the older item add it to ` reclaims ` and insert the new item .
pub fn update(&mut self, slot: Slot, account_info: T, reclaims: &mut SlotList<T>) {
        let mut addref = !account_info.is_cached();
        self.slot_list_mut(|list| {
            // find other dirty entries from the same slot
            for list_index in 0..list.len() {
                let (s, previous_update_value) = &list[list_index];
                if *s == slot {
                    addref = addref && previous_update_value.is_cached();
                    let mut new_item = (slot, account_info);
                    std::mem::swap(&mut new_item, &mut list[list_index]);
                    reclaims.push(new_item);
                    list[(list_index + 1)..]
                        .iter()
                        .for_each(|item| assert!(item.0 != slot));
                    return; // this returns from self.slot_list_mut above
                }
            }
            // if we make it here, we did not find the slot in the list
            list.push((slot, account_info));
        });
        if addref {
            // If it's the first non-cache insert, also bump the stored ref count
            self.ref_count().fetch_add(1, Ordering::Relaxed);
        }
    }
pub fn update ( & mut self , slot : Slot , account_info : T , reclaims : & mut SlotList < T > ) { let mut addref = ! account_info . is_cached ( ) ; self . slot_list_mut ( | list | { // find other dirty entries from the same slot for list_index in 0 .. list . len ( ) { let ( s , previous_update_value ) = & list [ list_index ] ; if * s == slot { addref = addref && previous_update_value . is_cached ( ) ; let mut new_item = ( slot , account_info ) ; std :: mem :: swap ( & mut new_item , & mut list [ list_index ] ) ; reclaims . push ( new_item ) ; list [ ( list_index + 1 ) .. ] . iter ( ) . for_each ( | item | assert ! ( item 0 slot ) ) ; return ; // this returns from self.slot_list_mut above } } // if we make it here, we did not find the slot in the list list . push ( ( slot , account_info ) ) ; } ) ; if addref { // If it's the first non-cache insert, also bump the stored ref count self . ref_count ( ) . fetch_add ( 1 , Ordering :: Relaxed ) ; } }
Try to update an item in the slot list the given `slot` If an item for the slot
already exists in the list, remove the older item, add it to `reclaims`, and insert
the new item.
Try to update an item in the slot list the given ` slot ` If an item for the slot already exists in the list remove the older item add it to ` reclaims ` and insert the new item .
&mut self
slot
Slot
account_info
T
reclaims
&mut SlotList<T>
&mut self
slot
Slot
account_info
T
reclaims
&mut SlotList<T>