diff options
Diffstat (limited to 'src/regex_set.rs')
-rw-r--r-- | src/regex_set.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/regex_set.rs b/src/regex_set.rs index a93e7a13..a6f51336 100644 --- a/src/regex_set.rs +++ b/src/regex_set.rs @@ -20,8 +20,9 @@ impl RegexSet { /// Extend this set with every regex in the iterator. pub fn extend<I, S>(&mut self, iter: I) - where I: IntoIterator<Item = S>, - S: AsRef<str>, + where + I: IntoIterator<Item = S>, + S: AsRef<str>, { for s in iter.into_iter() { self.insert(s) @@ -30,12 +31,13 @@ impl RegexSet { /// Insert a new regex into this set. pub fn insert<S>(&mut self, string: S) - where S: AsRef<str>, + where + S: AsRef<str>, { self.items.push(format!("^{}$", string.as_ref())); self.set = None; } - + /// Returns slice of String from its field 'items' pub fn get_items(&self) -> &[String] { &self.items[..] @@ -61,10 +63,13 @@ impl RegexSet { /// Does the given `string` match any of the regexes in this set? pub fn matches<S>(&self, string: S) -> bool - where S: AsRef<str>, + where + S: AsRef<str>, { let s = string.as_ref(); - self.set.as_ref().map(|set| set.is_match(s)).unwrap_or(false) + self.set.as_ref().map(|set| set.is_match(s)).unwrap_or( + false, + ) } } |