pub struct CachedMatcher<M: ComponentMatcher> { /* private fields */ }Expand description
A wrapper that caches match results for performance.
The cache uses component IDs to generate cache keys and stores match scores for quick lookup. This is particularly effective when the same component pairs are compared multiple times.
§Example
ⓘ
use sbom_tools::matching::{CachedMatcher, FuzzyMatcher, FuzzyMatchConfig, CacheConfig};
let matcher = FuzzyMatcher::new(FuzzyMatchConfig::balanced());
let cached = CachedMatcher::new(matcher);
// Or with custom config:
let cached = CachedMatcher::with_config(matcher, CacheConfig::large());Implementations§
Source§impl<M: ComponentMatcher> CachedMatcher<M>
impl<M: ComponentMatcher> CachedMatcher<M>
Sourcepub fn with_config(inner: M, config: CacheConfig) -> Self
pub fn with_config(inner: M, config: CacheConfig) -> Self
Create a cached matcher with custom configuration.
Sourcepub fn cache_stats(&self) -> CacheStats
pub fn cache_stats(&self) -> CacheStats
Get cache statistics.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the cache.
Trait Implementations§
Source§impl<M: ComponentMatcher> ComponentMatcher for CachedMatcher<M>
impl<M: ComponentMatcher> ComponentMatcher for CachedMatcher<M>
Source§fn match_score(&self, a: &Component, b: &Component) -> f64
fn match_score(&self, a: &Component, b: &Component) -> f64
Compute a match score between two components. Read more
Source§fn match_detailed(&self, a: &Component, b: &Component) -> MatchResult
fn match_detailed(&self, a: &Component, b: &Component) -> MatchResult
Compute a detailed match result between two components. Read more
Source§fn explain_match(&self, a: &Component, b: &Component) -> MatchExplanation
fn explain_match(&self, a: &Component, b: &Component) -> MatchExplanation
Generate a human-readable explanation of why two components matched or didn’t. Read more
Auto Trait Implementations§
impl<M> !Freeze for CachedMatcher<M>
impl<M> RefUnwindSafe for CachedMatcher<M>where
M: RefUnwindSafe,
impl<M> Send for CachedMatcher<M>
impl<M> Sync for CachedMatcher<M>
impl<M> Unpin for CachedMatcher<M>where
M: Unpin,
impl<M> UnsafeUnpin for CachedMatcher<M>where
M: UnsafeUnpin,
impl<M> UnwindSafe for CachedMatcher<M>where
M: UnwindSafe,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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