pub struct SuffixMatcher { /* private fields */ }Expand description
String suffix matcher for finding keys that end with a specific string.
This matcher is useful for finding cache entries based on file extensions, domain names, or other suffix-based patterns.
§Examples
use simple_cacher::*;
use std::time::Duration;
let mut cache = SimpleCacher::new(Duration::from_secs(300));
cache.insert("document.pdf".to_string(), "PDF content".to_string());
cache.insert("image.jpg".to_string(), "JPEG data".to_string());
cache.insert("script.js".to_string(), "JavaScript code".to_string());
let pdf_matcher = SuffixMatcher::new(".pdf");
let pdfs = cache.get_all_by_matcher(&pdf_matcher);
assert_eq!(pdfs.len(), 1);Implementations§
Trait Implementations§
Source§impl Matcher<&str> for SuffixMatcher
impl Matcher<&str> for SuffixMatcher
Auto Trait Implementations§
impl Freeze for SuffixMatcher
impl RefUnwindSafe for SuffixMatcher
impl Send for SuffixMatcher
impl Sync for SuffixMatcher
impl Unpin for SuffixMatcher
impl UnwindSafe for SuffixMatcher
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