pub struct MatchResult {
pub score: f64,
pub is_match: bool,
pub confidence: Confidence,
pub breakdown: MatchBreakdown,
}Expand description
Outcome of a probabilistic worker match.
Contains the overall renormalised score, the threshold-derived
is_match boolean, a coarse Confidence band, and a per-field
MatchBreakdown for audit.
MatchResult implements Serialize + Deserialize so it can be persisted
or returned over an API.
use worker_matcher::{Confidence, MatchingEngine, Worker};
let p = Worker::builder().given_name("Ada").family_name("Lovelace").build();
let q = p.clone();
let result = MatchingEngine::default_config().match_workers(&p, &q);
assert_eq!(result.confidence, Confidence::High);
// Round-trip through JSON.
let json = serde_json::to_string(&result).unwrap();
let back: worker_matcher::MatchResult = serde_json::from_str(&json).unwrap();
assert!((result.score - back.score).abs() < 1e-12);
assert_eq!(result.is_match, back.is_match);
assert_eq!(result.confidence, back.confidence);Fields§
§score: f64Overall match score in [0.0, 1.0].
is_match: booltrue if score >= MatchConfig::match_threshold.
confidence: ConfidenceCoarse confidence band derived from score per spec §12.5.
Defaults to Confidence::Low on legacy JSON payloads that
pre-date the field.
breakdown: MatchBreakdownPer-field score contributions for explainability.
Trait Implementations§
Source§impl Clone for MatchResult
impl Clone for MatchResult
Source§fn clone(&self) -> MatchResult
fn clone(&self) -> MatchResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MatchResult
impl Debug for MatchResult
Source§impl<'de> Deserialize<'de> for MatchResult
impl<'de> Deserialize<'de> for MatchResult
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MatchResult
impl RefUnwindSafe for MatchResult
impl Send for MatchResult
impl Sync for MatchResult
impl Unpin for MatchResult
impl UnsafeUnpin for MatchResult
impl UnwindSafe for MatchResult
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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