pub enum Confidence {
High,
Medium,
Low,
}Expand description
Qualitative confidence band derived from the probabilistic
MatchResult::score.
The bands are fixed across all MatchConfig presets — they do not
follow match_threshold. They are intended for triage UIs and audit
logs where a coarse High/Medium/Low summary is more useful than the
raw float. The is_match boolean remains the authoritative go/no-go
signal because it incorporates the configured threshold.
Boundaries (per spec §12.5):
| Score range | Band |
|---|---|
score >= 0.90 | High |
0.75 <= score < 0.90 | Medium |
score < 0.75 | Low |
§Examples
use worker_matcher::Confidence;
assert_eq!(Confidence::from_score(0.99), Confidence::High);
assert_eq!(Confidence::from_score(0.90), Confidence::High); // inclusive
assert_eq!(Confidence::from_score(0.85), Confidence::Medium);
assert_eq!(Confidence::from_score(0.75), Confidence::Medium); // inclusive
assert_eq!(Confidence::from_score(0.50), Confidence::Low);
assert_eq!(Confidence::from_score(0.00), Confidence::Low);Variants§
High
Score is at or above 0.90. Strong match; safe to act on with
minimal review.
Medium
Score is in 0.75..0.90. Medium-confidence match; the per-field
MatchBreakdown should be inspected before clinical use.
Low
Score is below 0.75. Treat as a candidate at best; require
additional evidence before treating as the same worker.
Implementations§
Source§impl Confidence
impl Confidence
Sourcepub fn from_score(score: f64) -> Self
pub fn from_score(score: f64) -> Self
Bucket a probabilistic score into one of the three bands.
The function is total over f64: NaN inputs degrade to Low,
negative scores degrade to Low, scores above 1.0 are treated
as High. In practice the matcher only ever produces values in
[0.0, 1.0], so callers shouldn’t encounter the degenerate
inputs.
use worker_matcher::Confidence;
assert_eq!(Confidence::from_score(f64::NAN), Confidence::Low);
assert_eq!(Confidence::from_score(-0.5), Confidence::Low);
assert_eq!(Confidence::from_score(2.0), Confidence::High);Trait Implementations§
Source§impl Clone for Confidence
impl Clone for Confidence
Source§fn clone(&self) -> Confidence
fn clone(&self) -> Confidence
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 Confidence
impl Debug for Confidence
Source§impl<'de> Deserialize<'de> for Confidence
impl<'de> Deserialize<'de> for Confidence
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 Confidence
impl PartialEq for Confidence
Source§fn eq(&self, other: &Confidence) -> bool
fn eq(&self, other: &Confidence) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for Confidence
impl Serialize for Confidence
impl Copy for Confidence
impl Eq for Confidence
impl StructuralPartialEq for Confidence
Auto Trait Implementations§
impl Freeze for Confidence
impl RefUnwindSafe for Confidence
impl Send for Confidence
impl Sync for Confidence
impl Unpin for Confidence
impl UnsafeUnpin for Confidence
impl UnwindSafe for Confidence
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more