Trait midenc_hir::pass::AnalysisKey

source ·
pub trait AnalysisKey: 'static {
    type Key: Hash + PartialEq + Eq;

    // Required method
    fn key(&self) -> Self::Key;
}
Expand description

The AnalysisKey trait is implemented for compiler entities that are targeted for one or more Analysis, and have a stable, unique identifier which can be used to cache the results of each analysis computed for that entity.

You must ensure that the key uniquely identifies the entity to which it applies, or incorrect analysis results will be returned from the AnalysisManager. Note, however, that it is not necessary to ensure that the key reflect changes to the underlying entity (see AnalysisManager::invalidate for how invalidation is done).

Required Associated Types§

source

type Key: Hash + PartialEq + Eq

The type of the unique identifier associated with Self

Required Methods§

source

fn key(&self) -> Self::Key

Get the key to associate with the current entity

Implementors§