pub enum StringMatcher {
All,
Exact(String),
Fn(Box<dyn Fn(&[u8]) -> bool>),
}Expand description
Matcher for strings and bytes.
Variants§
All
Matches any strings.
Exact(String)
Matches strings exactly.
Fn(Box<dyn Fn(&[u8]) -> bool>)
Tests matches by arbitrary function.
Implementations§
Source§impl StringMatcher
impl StringMatcher
Sourcepub fn is_match(&self, haystack: &str) -> bool
pub fn is_match(&self, haystack: &str) -> bool
Returns true if this matches the haystack string.
Sourcepub fn is_match_bytes(&self, haystack: &[u8]) -> bool
pub fn is_match_bytes(&self, haystack: &[u8]) -> bool
Returns true if this matches the haystack bytes.
Sourcepub fn filter_btree_map<'a, K: Borrow<str> + Ord, V>(
&self,
map: &'a BTreeMap<K, V>,
) -> impl Iterator<Item = (&'a K, &'a V)>
pub fn filter_btree_map<'a, K: Borrow<str> + Ord, V>( &self, map: &'a BTreeMap<K, V>, ) -> impl Iterator<Item = (&'a K, &'a V)>
Iterates entries of the given map whose string keys match this.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StringMatcher
impl !RefUnwindSafe for StringMatcher
impl !Send for StringMatcher
impl !Sync for StringMatcher
impl Unpin for StringMatcher
impl !UnwindSafe for StringMatcher
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