MCPcopy Create free account
hub / github.com/cosdata/cosdata / mutate

Method mutate

src/models/common.rs:541–553  ·  view source on GitHub ↗
(&self, k: K, f: F)

Source from the content-addressed store, hash-verified

539 }
540
541 pub fn mutate<F>(&self, k: K, f: F)
542 where
543 F: FnOnce(Option<V>) -> Option<V>,
544 V: Clone,
545 {
546 let index = self.hash_key(&k);
547 let mut ht = self.hash_table_list[index].lock().unwrap();
548 let v = ht.remove(&k);
549 let new_v = f(v);
550 if let Some(new_v) = new_v {
551 ht.insert(k, new_v);
552 }
553 }
554
555 pub fn get_or_create<F>(&self, k: K, f: F) -> V
556 where

Callers

nothing calls this directly

Calls 3

hash_keyMethod · 0.80
removeMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected