MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / index

Method index

cranelift/entity/src/sparse.rs:126–136  ·  view source on GitHub ↗

Return the index into `dense` of the value corresponding to `key`.

(&self, key: K)

Source from the content-addressed store, hash-verified

124
125 /// Return the index into `dense` of the value corresponding to `key`.
126 fn index(&self, key: K) -> Option<usize> {
127 if let Some(idx) = self.sparse.get(key).cloned() {
128 let idx = idx as usize;
129 if let Some(entry) = self.dense.get(idx) {
130 if entry.key() == key {
131 return Some(idx);
132 }
133 }
134 }
135 None
136 }
137
138 /// Return `true` if the map contains a value corresponding to `key`.
139 pub fn contains_key(&self, key: K) -> bool {

Callers 1

removeMethod · 0.45

Calls 2

getMethod · 0.45
keyMethod · 0.45

Tested by

no test coverage detected