Trait rustc_query_system::query::caches::QueryCache[−][src]

pub trait QueryCache: QueryStorage {
    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<R>(
        &self,
        shards: &Sharded<Self::Sharded>,
        f: impl for<'a> FnOnce(&'a mut dyn Iterator<Item = (&'a Self::Key, &'a Self::Value, DepNodeIndex)>) -> R
    ) -> R; }

Associated Types

type Key: Hash + Eq + Clone + Debug[src]

type Sharded: Default[src]

Loading content...

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, 
[src]

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.

fn complete(
    &self,
    lock_sharded_storage: &mut Self::Sharded,
    key: Self::Key,
    value: Self::Value,
    index: DepNodeIndex
) -> Self::Stored
[src]

fn iter<R>(
    &self,
    shards: &Sharded<Self::Sharded>,
    f: impl for<'a> FnOnce(&'a mut dyn Iterator<Item = (&'a Self::Key, &'a Self::Value, DepNodeIndex)>) -> R
) -> R
[src]

Loading content...

Implementors

impl<'tcx, K, V: 'tcx> QueryCache for ArenaCache<'tcx, K, V> where
    K: Eq + Hash + Clone + Debug,
    V: Debug, 
[src]

type Key = K

type Sharded = FxHashMap<K, &'tcx (V, DepNodeIndex)>

impl<K, V> QueryCache for DefaultCache<K, V> where
    K: Eq + Hash + Clone + Debug,
    V: Clone + Debug, 
[src]

type Key = K

type Sharded = FxHashMap<K, (V, DepNodeIndex)>

Loading content...