MCPcopy Create free account
hub / github.com/Amanieu/regalloc3 / or_insert_with_key

Method or_insert_with_key

src/entity/sparse.rs:408–419  ·  view source on GitHub ↗
(self, call: F)

Source from the content-addressed store, hash-verified

406 where
407 F: FnOnce(&K) -> V,
408 {
409 match self {
410 Entry::Occupied(entry) => entry.into_mut(),
411 Entry::Vacant(entry) => {
412 let value = call(&entry.key);
413 entry.insert(value)
414 }
415 }
416 }
417
418 /// Gets the entry's key.
419 #[inline]
420 pub fn key(&self) -> K {
421 match *self {
422 Entry::Occupied(ref entry) => entry.key(),

Callers

nothing calls this directly

Calls 2

into_mutMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected