pub struct ExactMatcher<T> { /* private fields */ }Expand description
Exact equality matcher for cache keys.
This matcher performs exact equality comparison, similar to using get() directly,
but is useful in generic code where you need a Matcher implementation.
§Examples
use simple_cacher::*;
use std::time::Duration;
let mut cache = SimpleCacher::new(Duration::from_secs(300));
cache.insert("exact_key".to_string(), "value".to_string());
let matcher = ExactMatcher::new("exact_key".to_string());
if let Ok(entry) = cache.get_by_matcher(&matcher) {
println!("Found: {}", entry.value());
}Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ExactMatcher<T>where
T: Freeze,
impl<T> RefUnwindSafe for ExactMatcher<T>where
T: RefUnwindSafe,
impl<T> Send for ExactMatcher<T>where
T: Send,
impl<T> Sync for ExactMatcher<T>where
T: Sync,
impl<T> Unpin for ExactMatcher<T>where
T: Unpin,
impl<T> UnwindSafe for ExactMatcher<T>where
T: 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