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

Method or_insert_with

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

Source from the content-addressed store, hash-verified

392 where
393 F: FnOnce() -> V,
394 {
395 match self {
396 Entry::Occupied(entry) => entry.into_mut(),
397 Entry::Vacant(entry) => entry.insert(call()),
398 }
399 }
400
401 /// Inserts the result of the `call` function with a reference to the entry's key if it is
402 /// vacant, and returns a mutable reference to the new value. Otherwise a mutable reference to
403 /// an already existent value is returned.
404 #[inline]
405 pub fn or_insert_with_key<F>(self, call: F) -> &'a mut V

Callers

nothing calls this directly

Calls 2

into_mutMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected