diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-07-15 16:37:38 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-07-15 16:39:27 +0200 |
commit | cb51e2f5efcd78779e98f086c45702e5238f7dab (patch) | |
tree | 71fd1897b87594b1ef0020f35e01159284b3f07b | |
parent | 797ce777b7267f5ff3d78c1aa4e04aececd2791d (diff) |
Add traits for using iterator filtering
-rw-r--r-- | libimagentrytimetrack/src/iter/filter.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libimagentrytimetrack/src/iter/filter.rs b/libimagentrytimetrack/src/iter/filter.rs index 6fc24a3d..151d99aa 100644 --- a/libimagentrytimetrack/src/iter/filter.rs +++ b/libimagentrytimetrack/src/iter/filter.rs @@ -75,6 +75,19 @@ impl<'a, I> Iterator for WithOneOf<'a, I> } } +pub trait WithOneOfTags<'a> : Sized + Iterator<Item = Result<FileLockEntry<'a>>> { + fn with_timetracking_tags(self, tags: &'a Vec<TTT>) -> WithOneOf<'a, Self>; +} + +impl<'a, I> WithOneOfTags<'a> for I + where I: Iterator<Item = Result<FileLockEntry<'a>>>, + Self: Sized +{ + fn with_timetracking_tags(self, tags: &'a Vec<TTT>) -> WithOneOf<'a, Self> { + WithOneOf::new(self, tags) + } +} + pub struct WithNoneOf<'a, I> where I: Iterator<Item = Result<FileLockEntry<'a>>> @@ -120,3 +133,16 @@ impl<'a, I> Iterator for WithNoneOf<'a, I> } } +pub trait WithNoneOfTags<'a> : Sized + Iterator<Item = Result<FileLockEntry<'a>>> { + fn without_timetracking_tags(self, tags: &'a Vec<TTT>) -> WithNoneOf<'a, Self>; +} + +impl<'a, I> WithNoneOfTags<'a> for I + where I: Iterator<Item = Result<FileLockEntry<'a>>>, + Self: Sized +{ + fn without_timetracking_tags(self, tags: &'a Vec<TTT>) -> WithNoneOf<'a, Self> { + WithNoneOf::new(self, tags) + } +} + |