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

Method or_insert

src/entity/sparse.rs:384–389  ·  view source on GitHub ↗
(self, default: V)

Source from the content-addressed store, hash-verified

382 /// reference to it. Otherwise a mutable reference to an already existent value is returned.
383 #[inline]
384 pub fn or_insert(self, default: V) -> &'a mut V {
385 match self {
386 Entry::Occupied(entry) => entry.into_mut(),
387 Entry::Vacant(entry) => entry.insert(default),
388 }
389 }
390
391 /// Inserts the result of the `call` function in the entry if it is vacant and returns a mutable
392 /// reference to it. Otherwise a mutable reference to an already existent value is returned.

Callers 1

computeMethod · 0.80

Calls 2

into_mutMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected