# Trait rustc_query_system::query::QueryCache

source ·

    pub trait QueryCache: Sized {
        type Key: Hash + Eq + Copy + Debug;
        type Value: Copy;

        // Required methods
        fn lookup(&self, key: &Self::Key) -> Option<(Self::Value, DepNodeIndex)>;
        fn complete(&self, key: Self::Key, value: Self::Value, index: DepNodeIndex);
        fn iter(&self, f: &mut dyn FnMut(&Self::Key, &Self::Value, DepNodeIndex));
    }

## Required Associated Types§

source

#### type Key: Hash + Eq + Copy + Debug

source

#### type Value: Copy

## Required Methods§

source

#### fn lookup(&self, key: &Self::Key) -> Option<(Self::Value, DepNodeIndex)>

Checks if the query is already computed and in the cache.

source

#### fn complete(&self, key: Self::Key, value: Self::Value, index: DepNodeIndex)

source

#### fn iter(&self, f: &mut dyn FnMut(&Self::Key, &Self::Value, DepNodeIndex))

## Object Safety§

This trait is not object safe.

## Implementors§

source§

### impl<K, V> QueryCache for DefaultCache<K, V>
where K: Eq + Hash + Copy + Debug, V: Copy,

§

#### type Key = K

§

#### type Value = V

source§

### impl<K, V> QueryCache for VecCache<K, V>
where K: Eq + Idx + Copy + Debug, V: Copy,

§

#### type Key = K

§

#### type Value = V

source§

### impl<V> QueryCache for DefIdCache<V>
where V: Copy,

§

#### type Key = DefId

§

#### type Value = V

source§

### impl<V> QueryCache for SingleCache<V>
where V: Copy,

§

#### type Key = ()

§

#### type Value = V