diff options
Diffstat (limited to 'src/failable/filter.rs')
-rw-r--r-- | src/failable/filter.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/failable/filter.rs b/src/failable/filter.rs index c611c86..d2fc51c 100644 --- a/src/failable/filter.rs +++ b/src/failable/filter.rs @@ -248,3 +248,10 @@ pub trait FailableFilter<N, E: Error> { } +/// All closures that take a ref to something and return Result<bool, E> are failable filters +impl<I, E: Error, T: Fn(&I) -> Result<bool, E>> FailableFilter<I, E> for T { + fn filter(&self, other: &I) -> Result<bool, E>{ + self(other) + } +} + |