Struct rustc_query_system::query::caches::ArenaCache[−][src]

pub struct ArenaCache<'tcx, K, V> {
    arena: WorkerLocal<TypedArena<(V, DepNodeIndex)>>,
    phantom: PhantomData<(K, &'tcx V)>,
}

Fields

arena: WorkerLocal<TypedArena<(V, DepNodeIndex)>>phantom: PhantomData<(K, &'tcx V)>

Trait Implementations

impl<'tcx, K, V> Default for ArenaCache<'tcx, K, V>[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

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)>

fn lookup<'s, R, OnHit>(
    &self,
    state: &'s QueryCacheStore<Self>,
    key: &K,
    on_hit: OnHit
) -> Result<R, QueryLookup> where
    OnHit: FnOnce(&&'tcx V, 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. Read more

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

fn iter(
    &self,
    shards: &Sharded<Self::Sharded>,
    f: &mut dyn FnMut(&Self::Key, &Self::Value, DepNodeIndex)
)
[src]

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

type Value = V

type Stored = &'tcx V

fn store_nocache(&self, value: Self::Value) -> Self::Stored[src]

Store a value without putting it in the cache. This is meant to be used with cycle errors. Read more

Auto Trait Implementations

impl<'tcx, K, V> !RefUnwindSafe for ArenaCache<'tcx, K, V>

impl<'tcx, K, V> Send for ArenaCache<'tcx, K, V> where
    K: Send,
    V: Send + Sync, 

impl<'tcx, K, V> !Sync for ArenaCache<'tcx, K, V>

impl<'tcx, K, V> Unpin for ArenaCache<'tcx, K, V> where
    K: Unpin,
    V: Unpin, 

impl<'tcx, K, V> UnwindSafe for ArenaCache<'tcx, K, V> where
    K: UnwindSafe,
    V: RefUnwindSafe + UnwindSafe, 

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.