pub struct BuildVariant {
pub mode: AnalysisMode,
pub languages: LanguageSelection,
pub headers: Option<Language>,
pub normalization_version: u32,
pub builds: Vec<BuildConfiguration>,
}Expand description
The context a set of results belongs to.
Fields§
§mode: AnalysisModeAnalysis mode.
languages: LanguageSelectionLanguages enabled for the run.
headers: Option<Language>The language bare .h headers were read as, when C or C++ is enabled
at all. Two runs that read the same header with different grammars see
different code in it, so this belongs to the variant rather than
alongside it.
normalization_version: u32Normalization ruleset version.
builds: Vec<BuildConfiguration>What each compiler was told, for the runs that resolved it.
Empty in Fast and Structural mode, which read source and ask no compiler anything: there is no build configuration to differ over, so a single implicit variant covers the run.
A list because a tree is answered by one compiler per language, and a run of a tree holding both is one run: what either compiler was told is part of what its results mean, and a variant that named only one of them would give two differently built trees the same identity. Sorted by fingerprint when the variant is made, so that the order helpers happened to be reached in — an accident of what is installed — cannot move it.
Implementations§
Source§impl BuildVariant
impl BuildVariant
Sourcepub const fn fast(languages: LanguageSelection, headers: Language) -> Self
pub const fn fast(languages: LanguageSelection, headers: Language) -> Self
The implicit single variant used by a Fast-mode run over languages,
reading bare .h headers as headers.
Sourcepub const fn structural(languages: LanguageSelection, headers: Language) -> Self
pub const fn structural(languages: LanguageSelection, headers: Language) -> Self
The implicit single variant used by a Structural-mode run over
languages. Like Fast mode, Structural resolves no build configuration,
so one implicit variant covers the run; only the mode differs, which is
enough to keep Fast and Structural fingerprints in separate spaces.
Sourcepub fn semantic(
languages: LanguageSelection,
headers: Language,
builds: Vec<BuildConfiguration>,
) -> Self
pub fn semantic( languages: LanguageSelection, headers: Language, builds: Vec<BuildConfiguration>, ) -> Self
The variant a semantic run analyses one unit under.
Unlike Fast and Structural, semantic mode has as many variants as the project has build configurations: a crate under two feature sets and a header under two sets of defines are different programs that happen to share their text.
Sourcepub fn canonical(&self) -> String
pub fn canonical(&self) -> String
A canonical, order-stable string describing this variant.
Two variants are equal exactly when their canonical strings match, which makes this string safe to use as a grouping key or fingerprint input.
A resolved build configuration is appended as its fingerprint rather than its own canonical form: compiler arguments are arbitrary text and would otherwise be free to contain this string’s own separators. Several are appended comma-separated, which is safe for the same reason it is not safe for the arguments themselves — a fingerprint is fixed-width hex and holds no punctuation to be mistaken for a separator.
Appended only when the run resolved something, so that the modes which resolve nothing keep the identity they had before the field existed — an audit database written by an earlier build still lines up with one written by this one. A run that resolved exactly one configuration keeps its identity too, which is what stops the field growing a list from re-identifying every Rust-only tree already recorded.
Sourcepub fn fingerprint(&self) -> String
pub fn fingerprint(&self) -> String
A stable hex fingerprint of this variant.
Trait Implementations§
Source§impl Clone for BuildVariant
impl Clone for BuildVariant
Source§fn clone(&self) -> BuildVariant
fn clone(&self) -> BuildVariant
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BuildVariant
impl Debug for BuildVariant
impl Eq for BuildVariant
Source§impl PartialEq for BuildVariant
impl PartialEq for BuildVariant
impl StructuralPartialEq for BuildVariant
Auto Trait Implementations§
impl Freeze for BuildVariant
impl RefUnwindSafe for BuildVariant
impl Send for BuildVariant
impl Sync for BuildVariant
impl Unpin for BuildVariant
impl UnsafeUnpin for BuildVariant
impl UnwindSafe for BuildVariant
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.