Skip to main content

BuildVariant

Struct BuildVariant 

Source
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: AnalysisMode

Analysis mode.

§languages: LanguageSelection

Languages 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: u32

Normalization 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

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn fingerprint(&self) -> String

A stable hex fingerprint of this variant.

Trait Implementations§

Source§

impl Clone for BuildVariant

Source§

fn clone(&self) -> BuildVariant

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BuildVariant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for BuildVariant

Source§

impl PartialEq for BuildVariant

Source§

fn eq(&self, other: &BuildVariant) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BuildVariant

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.