pub struct PanelSearcher { /* private fields */ }Expand description
Resolves an observed barcode to a panel marker, tolerating up to
mismatch_threshold mismatches.
A lookup first tries an exact hash-map hit (the common case). On a miss, the
fuzzy fallback is picked to fit the safety regimes documented on
SAFE_MISMATCH_THRESHOLD:
- 0: no fuzzy fallback; exact matches only (
Misson miss). - 1: return the first marker within range (
search_first_hit). Withd_min ≥ 3, at most one marker can be within 1 mismatch, so the first hit is necessarily the only hit and there is nothing to disambiguate. - ≥ 2: two markers can now be within range at once, so scan them all,
keep the single closest, and return
MarkerMatch::Ambiguousif the two nearest tie (search_best_match).
PanelSearcher::new warns when mismatch_threshold exceeds
SAFE_MISMATCH_THRESHOLD: past that point the tie check is no longer enough,
because a wrong marker can be strictly closest and slip through as a
confident but incorrect match.
Implementations§
Source§impl PanelSearcher
impl PanelSearcher
Sourcepub fn new(panel: Panel, mismatch_threshold: u8) -> Self
pub fn new(panel: Panel, mismatch_threshold: u8) -> Self
Builds a searcher over panel that tolerates up to mismatch_threshold
mismatches when resolving a barcode.
A mismatch_threshold above SAFE_MISMATCH_THRESHOLD exceeds the
collision-free guarantee the panel is designed around (see the type-level
docs), so a warning is logged: fuzzy matches may assign a read to a
different marker than intended.
pub fn search_seq1(&self, seq: u64) -> MarkerMatch
pub fn search_seq2(&self, seq: u64) -> MarkerMatch
Trait Implementations§
Source§impl Clone for PanelSearcher
impl Clone for PanelSearcher
Source§fn clone(&self) -> PanelSearcher
fn clone(&self) -> PanelSearcher
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PanelSearcher
impl RefUnwindSafe for PanelSearcher
impl Send for PanelSearcher
impl Sync for PanelSearcher
impl Unpin for PanelSearcher
impl UnsafeUnpin for PanelSearcher
impl UnwindSafe for PanelSearcher
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.