#[non_exhaustive]pub enum FilterResult {
NoMatch,
Match,
MatchWithData(HashMap<String, Vec<String>>),
}Expand description
Result of a filter check, supporting data filters (like Python’s data_filter).
Simple filters return Match or NoMatch.
Data filters (e.g. regex) return MatchWithData carrying
named capture groups or other extracted data.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
NoMatch
The filter did not match.
Match
The filter matched but produced no additional data.
MatchWithData(HashMap<String, Vec<String>>)
The filter matched and produced named capture data (e.g. regex groups).
Implementations§
Source§impl FilterResult
impl FilterResult
Sourcepub fn is_match(&self) -> bool
pub fn is_match(&self) -> bool
Returns true when the filter matched (either Match or MatchWithData).
Sourcepub fn merge(self, other: FilterResult) -> FilterResult
pub fn merge(self, other: FilterResult) -> FilterResult
Merge data from two FilterResult values. Used by [AndFilter].
- If either side is
NoMatch, the result isNoMatch. - If both carry data, their maps are merged (values appended).
- If only one carries data, that data is preserved.
Trait Implementations§
Source§impl Clone for FilterResult
impl Clone for FilterResult
Source§fn clone(&self) -> FilterResult
fn clone(&self) -> FilterResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FilterResult
impl Debug for FilterResult
Source§impl PartialEq for FilterResult
impl PartialEq for FilterResult
impl Eq for FilterResult
impl StructuralPartialEq for FilterResult
Auto Trait Implementations§
impl Freeze for FilterResult
impl RefUnwindSafe for FilterResult
impl Send for FilterResult
impl Sync for FilterResult
impl Unpin for FilterResult
impl UnsafeUnpin for FilterResult
impl UnwindSafe for FilterResult
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