#[non_exhaustive]pub struct Stats { /* private fields */ }Expand description
The Cognitive Complexity metric.
Implementations§
Source§impl Stats
impl Stats
Sourcepub fn merge(&mut self, other: &Stats)
pub fn merge(&mut self, other: &Stats)
Merges a second Cognitive Complexity metric into the first one
Sourcepub fn cognitive_sum(&self) -> u64
pub fn cognitive_sum(&self) -> u64
Returns the Cognitive Complexity sum metric value
Sourcepub fn cognitive_min(&self) -> u64
pub fn cognitive_min(&self) -> u64
Returns the Cognitive Complexity minimum metric value.
Collapses the usize::MAX sentinel that Stats::default() plants
into structural_min to 0, so a never-observed space
serializes to a meaningful number rather than 1.8446744e19.
Sourcepub fn cognitive_max(&self) -> u64
pub fn cognitive_max(&self) -> u64
Returns the Cognitive Complexity maximum metric value
Sourcepub fn cognitive_average(&self) -> f64
pub fn cognitive_average(&self) -> f64
Returns the Cognitive Complexity metric average value
This value is computed dividing the Cognitive Complexity value
for the total number of functions/closures in a space.
The per-function divisor (shared with cyclomatic/exit/nargs,
#512) is guarded with .max(1) via the shared average helper, so
a space with no counted functions (or one where Nom was not
selected) degrades to sum / 1 instead of producing inf/NaN
(#428).