• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use std::fmt;
2 
3 #[derive(Debug)]
4 pub struct Filter {
5     inner: String,
6 }
7 
8 impl Filter {
new(spec: &str) -> Result<Filter, String>9     pub fn new(spec: &str) -> Result<Filter, String> {
10         Ok(Filter {
11             inner: spec.to_string(),
12         })
13     }
14 
is_match(&self, s: &str) -> bool15     pub fn is_match(&self, s: &str) -> bool {
16         s.contains(&self.inner)
17     }
18 }
19 
20 impl fmt::Display for Filter {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result21     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
22         self.inner.fmt(f)
23     }
24 }
25