pub struct IntegrityCanaryPolicy {
pub suspected_threshold: f64,
pub confirmed_threshold: f64,
}Expand description
Configurable thresholds for the canary risk bands.
The defaults match the documented
RISK_SUSPECTED_THRESHOLD_DEFAULT and
RISK_CONFIRMED_THRESHOLD_DEFAULT constants. Override via
IntegrityCanaryPolicy::with_thresholds when callers need
stricter or more permissive gating.
Fields§
§suspected_threshold: f64Lower bound of the Suspected band.
confirmed_threshold: f64Lower bound of the Confirmed band.
Implementations§
Source§impl IntegrityCanaryPolicy
impl IntegrityCanaryPolicy
Sourcepub fn with_thresholds(
suspected_threshold: f64,
confirmed_threshold: f64,
) -> Self
pub fn with_thresholds( suspected_threshold: f64, confirmed_threshold: f64, ) -> Self
Build a policy with custom thresholds.
§Panics
Panics if suspected_threshold is NaN, confirmed_threshold
is NaN, or suspected_threshold >= confirmed_threshold —
use Self::try_with_thresholds for a fallible variant.
Sourcepub fn try_with_thresholds(
suspected_threshold: f64,
confirmed_threshold: f64,
) -> Result<Self, IntegrityCanaryPolicyError>
pub fn try_with_thresholds( suspected_threshold: f64, confirmed_threshold: f64, ) -> Result<Self, IntegrityCanaryPolicyError>
Build a policy with custom thresholds, returning an error when the inputs are invalid.
§Errors
Returns an IntegrityCanaryPolicyError::InvalidThresholds
when either threshold is NaN or when the suspected
threshold is greater than or equal to the confirmed
threshold.
Sourcepub fn classify(&self, value: f64) -> IntegrityRiskClassification
pub fn classify(&self, value: f64) -> IntegrityRiskClassification
Map a value in [0.0, 1.0] to its classification under
this policy’s thresholds.
Trait Implementations§
Source§impl Clone for IntegrityCanaryPolicy
impl Clone for IntegrityCanaryPolicy
Source§fn clone(&self) -> IntegrityCanaryPolicy
fn clone(&self) -> IntegrityCanaryPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for IntegrityCanaryPolicy
Source§impl Debug for IntegrityCanaryPolicy
impl Debug for IntegrityCanaryPolicy
Source§impl Default for IntegrityCanaryPolicy
impl Default for IntegrityCanaryPolicy
Source§impl<'de> Deserialize<'de> for IntegrityCanaryPolicy
impl<'de> Deserialize<'de> for IntegrityCanaryPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for IntegrityCanaryPolicy
impl PartialEq for IntegrityCanaryPolicy
Source§fn eq(&self, other: &IntegrityCanaryPolicy) -> bool
fn eq(&self, other: &IntegrityCanaryPolicy) -> bool
self and other values to be equal, and is used by ==.