Trait rustc_query_system::query::caches::QueryCache [−][src]
pub trait QueryCache: QueryStorage + Sized { type Key: Hash + Eq + Clone + Debug; type Sharded: Default; fn lookup<'s, R, OnHit>(
&self,
state: &'s QueryCacheStore<Self>,
key: &Self::Key,
on_hit: OnHit
) -> Result<R, QueryLookup>
where
OnHit: FnOnce(&Self::Stored, DepNodeIndex) -> R; fn complete(
&self,
lock_sharded_storage: &mut Self::Sharded,
key: Self::Key,
value: Self::Value,
index: DepNodeIndex
) -> Self::Stored; fn iter(
&self,
shards: &Sharded<Self::Sharded>,
f: &mut dyn FnMut(&Self::Key, &Self::Value, DepNodeIndex)
); }
Associated Types
Required methods
fn lookup<'s, R, OnHit>(
&self,
state: &'s QueryCacheStore<Self>,
key: &Self::Key,
on_hit: OnHit
) -> Result<R, QueryLookup> where
OnHit: FnOnce(&Self::Stored, DepNodeIndex) -> R,
fn lookup<'s, R, OnHit>(
&self,
state: &'s QueryCacheStore<Self>,
key: &Self::Key,
on_hit: OnHit
) -> Result<R, QueryLookup> where
OnHit: FnOnce(&Self::Stored, DepNodeIndex) -> R, 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
impl<'tcx, K, V: 'tcx> QueryCache for ArenaCache<'tcx, K, V> where
K: Eq + Hash + Clone + Debug,
V: Debug, impl<K, V> QueryCache for DefaultCache<K, V> where
K: Eq + Hash + Clone + Debug,
V: Clone + Debug,