message: Add PinnedMemoryCache::has
diff: @@ -35,6 +35,11 @@ impl PinnedMemoryCache {
  None => Ok(None),
  }
  }
  +
  + /// Returns true if and only if this cache has an entry identified by the given checksum
  + pub fn has(&self, checksum: &Checksum) -> bool {
  + self.modules.contains_key(checksum)
  + }
  }
  #[cfg(test)]
  @@ -94,4 +99,35 @@ mod tests {
  assert_eq!(result[0].unwrap_i32(), 43);
  }
  }
  +
  + #[test]
  + fn has_works() {
  + let mut cache = PinnedMemoryCache::new();
  +
  + // Create module
  + let wasm = wat::parse_str(
  + r#"(module
  + (type $t0 (func (param i32) (result i32)))
  + (func $add_one (export "add_one") (type $t0) (param $p0 i32) (result i32)
  + get_local $p0
  + i32.const 1
  + i32.add)
  + )"#,
  + )
  + .unwrap();
  + let checksum = Checksum::generate(&wasm);
  +
  + assert_eq!(cache.has(&checksum), false);
  +
  + // Add
  + let original = compile(&wasm, None).unwrap();
  + cache.store(&checksum, original).unwrap();
  +
  + assert_eq!(cache.has(&checksum), true);
  +
  + // Remove
  + cache.remove(&checksum).unwrap();
  +
  + assert_eq!(cache.has(&checksum), false);
  + }
  }
  