pub struct CodeMetrics {}Expand description
All metrics data.
The set of metrics actually computed is governed by
MetricsOptions::with_only. By default every metric is
populated; when with_only restricts the set, unselected fields
remain at their Default value and are elided from
Serialize output. The selected mask is the source of truth
for which fields are populated — read it via
CodeMetrics::selected.
Fields§
§nargs: StatsNArgs data
nexits: StatsNExits data
cognitive: StatsCognitive data
cyclomatic: StatsCyclomatic data
halstead: StatsHalstead data
loc: StatsLoc data
nom: StatsNom data
tokens: StatsTokens data
mi: StatsMi data
abc: StatsAbc data
wmc: StatsWmc data
npm: StatsNpm data
npa: StatsNpa data
selected: MetricSetWhich metrics were actually computed for this space.
Default is MetricSet::all — every metric was run, matching
the pre-#257 behaviour. After
MetricsOptions::with_only the bitfield is restricted to the
caller’s selection plus auto-added dependencies.
The Serialize impl consults this set to elide fields the
caller did not select. The field itself is not serialized.
Implementations§
Source§impl CodeMetrics
impl CodeMetrics
Sourcepub fn with_selected(selected: MetricSet) -> Self
pub fn with_selected(selected: MetricSet) -> Self
Construct a CodeMetrics whose selected mask is the given
MetricSet. All metric fields are at their Default value;
the walker fills them in for whichever metrics the mask
admits.
Source§impl CodeMetrics
impl CodeMetrics
Sourcepub fn merge(&mut self, other: &CodeMetrics)
pub fn merge(&mut self, other: &CodeMetrics)
Sum each metric component from other into self in place. Used to
roll nested function-space metrics into their parent space.
Trait Implementations§
Source§impl Clone for CodeMetrics
impl Clone for CodeMetrics
Source§fn clone(&self) -> CodeMetrics
fn clone(&self) -> CodeMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more