fn on_insert(&self, btree_key: OwnerKey, value: OwnerValue, old_value: Option<OwnerValue>) {
        let index_key = (self.make_index_key_callback)(&value);
        let old_value_index_key = if let Some(old_value) = old_value {
            Some((self.make_index_key_callback)(&old_value))
        } else {
            None
        };

        let mut map = self.map.write()
            .unwrap_or_else(|err| unreachable!(err)); // unreachable because no code with possible panic under lock of this map

        if let Some(old_value_index_key) = old_value_index_key {
            if let Some(keys) = map.get_mut(&old_value_index_key) {
                keys.remove(&btree_key);
            }
        }

        match map.get_mut(&index_key) {
            Some(keys) => {
                keys.insert(btree_key);
            }
            None => {
                let mut set = BTreeSet::new();
                set.insert(btree_key);
                map.insert(index_key, set);
            }
        }
    }
/// Implementation of updating of index when insert operation on owner map.
Implementation of updating of index when insert operation on owner map.
Implementation of updating of index when insert operation on owner map .
fn on_insert(&self, btree_key: OwnerKey, value: OwnerValue, old_value: Option<OwnerValue>) {
        let index_key = (self.make_index_key_callback)(&value);
        let old_value_index_key = if let Some(old_value) = old_value {
            Some((self.make_index_key_callback)(&old_value))
        } else {
            None
        };
        let mut map = self.map.write()
            .unwrap_or_else(|err| unreachable!(err)); // unreachable because no code with possible panic under lock of this map
        if let Some(old_value_index_key) = old_value_index_key {
            if let Some(keys) = map.get_mut(&old_value_index_key) {
                keys.remove(&btree_key);
            }
        }
        match map.get_mut(&index_key) {
            Some(keys) => {
                keys.insert(btree_key);
            }
            None => {
                let mut set = BTreeSet::new();
                set.insert(btree_key);
                map.insert(index_key, set);
            }
        }
    }
fn on_insert ( & self , btree_key : OwnerKey , value : OwnerValue , old_value : Option < OwnerValue > ) { let index_key = ( self . make_index_key_callback ) ( & value ) ; let old_value_index_key = if let Some ( old_value ) = old_value { Some ( ( self . make_index_key_callback ) ( & old_value ) ) } else { None } ; let mut map = self . map . write ( ) . unwrap_or_else ( | err | unreachable ! ( err ) ) ; // unreachable because no code with possible panic under lock of this map if let Some ( old_value_index_key ) = old_value_index_key { if let Some ( keys ) = map . get_mut ( & old_value_index_key ) { keys . remove ( & btree_key ) ; } } match map . get_mut ( & index_key ) { Some ( keys ) => { keys . insert ( btree_key ) ; } None => { let mut set = BTreeSet :: new ( ) ; set . insert ( btree_key ) ; map . insert ( index_key , set ) ; } } }
Implementation of updating of index when insert operation on owner map.
Implementation of updating of index when insert operation on owner map .
&self
btree_key
OwnerKey
value
OwnerValue
old_value
Option<OwnerValue>
&self
btree_key
OwnerKey
value
OwnerValue
old_value
Option<OwnerValue>