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

Method insert_unique

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

Source from the content-addressed store, hash-verified

185 #[inline]
186 #[track_caller]
187 pub fn insert_unique(&mut self, key: K, value: V) -> &mut V {
188 debug_assert!(!self.contains_key(key));
189 let idx = self.dense.len();
190 debug_assert!(idx <= u32::MAX as usize, "SparseMap overflow");
191 self.dense.push((key, value));
192 self.sparse[key] = idx as u32;
193 &mut self.dense.last_mut().unwrap().1
194 }
195
196 /// Remove a value from the map and return it.
197 ///

Callers 2

initial_valueMethod · 0.80
insertMethod · 0.80

Calls 4

pushMethod · 0.80
unwrapMethod · 0.80
last_mutMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected