Created
October 2, 2017 12:40
-
-
Save PlasmaPower/080b45b9b32355cd0ad1b6403a13ebc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pub struct FilterMapInput<F, M>(F, M); | |
| impl<I, T, F: Filter<T>, M: Fn(I) -> T> Filter<I> for FilterMapInput<F, M> { | |
| fn filter(&self, e: &I) -> bool { | |
| self.0.filter(self.1(e)) | |
| } | |
| } | |
| pub struct FailableFilterMapErr<F, M>(F, M); | |
| impl <T, EF, EO, F: FailableFilter<T, EF>, M: Fn(EF) -> EO> FailableFilter<T, EO> for FailableFilterMapErr<F, M> { | |
| fn filter(&self, e: &T) -> Result<bool, EO> { | |
| self.0.filter(e).map_err(self.1) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment