pub trait QueryCache: QueryStorage + Sized {
    type Key: Hash + Eq + Clone + Debug;

    fn lookup<R, OnHit>(&self, key: &Self::Key, on_hit: OnHit) -> Result<R, ()>
   where
        OnHit: FnOnce(&Self::Stored, DepNodeIndex) -> R
; fn complete(
        &self,
        key: Self::Key,
        value: Self::Value,
        index: DepNodeIndex
    ) -> Self::Stored; fn iter(&self, f: &mut dyn FnMut(&Self::Key, &Self::Value, DepNodeIndex)); }

Required Associated Types

Required Methods

Checks if the query is already computed and in the cache. It returns the shard index and a lock guard to the shard, which will be used if the query is not in the cache and we need to compute it.

Implementors