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

Method insert

src/entity/sparse.rs:171–178  ·  view source on GitHub ↗
(&mut self, key: K, value: V)

Source from the content-addressed store, hash-verified

169 #[inline]
170 #[track_caller]
171 pub fn insert(&mut self, key: K, value: V) -> Option<V> {
172 if let Some(entry) = self.get_mut(key) {
173 Some(mem::replace(entry, value))
174 } else {
175 self.insert_unique(key, value);
176 None
177 }
178 }
179
180 /// Insert a value into the map without checking for an existing element.
181 ///

Callers 4

or_insertMethod · 0.45
or_insert_withMethod · 0.45
or_insert_with_keyMethod · 0.45
or_defaultMethod · 0.45

Calls 2

insert_uniqueMethod · 0.80
get_mutMethod · 0.45

Tested by

no test coverage detected