pub struct IntegrityRiskScore {
pub value: f64,
pub classification: IntegrityRiskClassification,
pub contributing_findings: usize,
pub skipped_findings: usize,
}Expand description
Aggregate integrity risk score in [0.0, 1.0].
Stored as an f64 so JSON / TOML serialization round-trips
without precision loss. The companion Self::classification
field records the threshold-derived classification so consumers
can branch on the enum without recomputing it.
Fields§
§value: f64Numeric risk score in [0.0, 1.0].
classification: IntegrityRiskClassificationThreshold-derived classification.
contributing_findings: usizeNumber of findings that contributed to the numerator (i.e. non-skipped findings).
skipped_findings: usizeNumber of skipped findings excluded from the denominator.
Implementations§
Source§impl IntegrityRiskScore
impl IntegrityRiskScore
Sourcepub const fn classification(&self) -> IntegrityRiskClassification
pub const fn classification(&self) -> IntegrityRiskClassification
Threshold-derived classification.
Sourcepub const fn is_trap_signal(&self) -> bool
pub const fn is_trap_signal(&self) -> bool
true when the classification is
IntegrityRiskClassification::Suspected or
IntegrityRiskClassification::Confirmed.
Sourcepub const fn is_confirmed(&self) -> bool
pub const fn is_confirmed(&self) -> bool
true when the classification is
IntegrityRiskClassification::Confirmed.
Sourcepub fn compute(
findings: &[ProbeFinding],
policy: &IntegrityCanaryPolicy,
) -> Self
pub fn compute( findings: &[ProbeFinding], policy: &IntegrityCanaryPolicy, ) -> Self
Compute the score + classification for a slice of
ProbeFindings under the supplied IntegrityCanaryPolicy.
findings is iterated twice — once for the numerator /
denominator, once for the skipped count — so the function is
O(n) and trivially deterministic.
Sourcepub fn classify_for(
value: f64,
policy: &IntegrityCanaryPolicy,
) -> IntegrityRiskClassification
pub fn classify_for( value: f64, policy: &IntegrityCanaryPolicy, ) -> IntegrityRiskClassification
Map a raw score to its classification under the supplied policy. Exposed so callers can re-classify a score without recomputing it (e.g. after overriding policy thresholds at runtime).
Trait Implementations§
Source§impl Clone for IntegrityRiskScore
impl Clone for IntegrityRiskScore
Source§fn clone(&self) -> IntegrityRiskScore
fn clone(&self) -> IntegrityRiskScore
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more