pub enum ConvergenceConfigError {
WindowTooSmall {
actual: usize,
},
ThresholdOutOfRange {
actual: f32,
},
}Expand description
Error returned when ConvergenceConfig validation fails.
ConvergenceDetector::new validates the configuration before
constructing a detector. If any constraint is violated, it returns
one of these variants with enough context to produce an actionable
diagnostic message.
§Example
use loopctl::detection::convergence::{ConvergenceConfig, ConvergenceDetector, ConvergenceConfigError};
let bad_config = ConvergenceConfig {
window_size: 1,
..Default::default()
};
let err = ConvergenceDetector::new(bad_config).unwrap_err();
assert!(matches!(err, ConvergenceConfigError::WindowTooSmall { actual: 1 }));Variants§
WindowTooSmall
window_size is below the minimum of 2.
Convergence requires at least one pair of consecutive responses, so a window of 1 (or 0) is meaningless.
Fields
actual: usizeThe invalid window size that was provided.
Captured verbatim from
ConvergenceConfig::window_size so the diagnostic can
report the offending value (e.g. 0 or 1) alongside the
required minimum of 2.
ThresholdOutOfRange
similarity_threshold is outside the valid range [0.0, 1.0].
Jaccard similarity always produces a value in this range; a threshold outside it would never (or always) trigger.
Fields
actual: f32The invalid threshold value that was provided.
Captured verbatim from
ConvergenceConfig::similarity_threshold so the diagnostic
can report the out-of-range value (e.g. 1.5 or -0.2)
alongside the required [0.0, 1.0] interval.
Trait Implementations§
Source§impl Clone for ConvergenceConfigError
impl Clone for ConvergenceConfigError
Source§fn clone(&self) -> ConvergenceConfigError
fn clone(&self) -> ConvergenceConfigError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConvergenceConfigError
impl Debug for ConvergenceConfigError
Source§impl Display for ConvergenceConfigError
impl Display for ConvergenceConfigError
Source§impl Error for ConvergenceConfigError
impl Error for ConvergenceConfigError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()