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

Method get

cranelift/codegen/src/ctxhash.rs:106–116  ·  view source on GitHub ↗

Look up a key, returning a borrow of the value if present.

(&'a self, k: &Q, ctx: &Ctx)

Source from the content-addressed store, hash-verified

104
105 /// Look up a key, returning a borrow of the value if present.
106 pub fn get<'a, Q, Ctx>(&'a self, k: &Q, ctx: &Ctx) -> Option<&'a V>
107 where
108 Ctx: CtxEq<K, Q> + CtxHash<Q> + CtxHash<K>,
109 {
110 let hash = compute_hash(ctx, k);
111 self.raw
112 .find(hash as u64, |bucket| {
113 hash == bucket.hash && ctx.ctx_eq(&bucket.k, k)
114 })
115 .map(|bucket| &bucket.v)
116 }
117
118 /// Look up a key, returning an `Entry` that refers to an existing
119 /// value or allows inserting a new one.

Callers

nothing calls this directly

Calls 4

compute_hashFunction · 0.85
mapMethod · 0.45
findMethod · 0.45
ctx_eqMethod · 0.45

Tested by

no test coverage detected