diff options
Diffstat (limited to 'ignore/src/lib.rs')
-rw-r--r-- | ignore/src/lib.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ignore/src/lib.rs b/ignore/src/lib.rs index d489712d..626588d2 100644 --- a/ignore/src/lib.rs +++ b/ignore/src/lib.rs @@ -357,4 +357,13 @@ impl<T> Match<T> { Match::Whitelist(t) => Match::Whitelist(f(t)), } } + + /// Return the match if it is not none. Otherwise, return other. + pub fn or(self, other: Self) -> Self { + if self.is_none() { + other + } else { + self + } + } } |