From 67410b3ad2c06abef416c217f4908ddf217dbb86 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 25 Nov 2017 16:10:07 +0100 Subject: [PATCH] Implement iter extension for all iterators over StoreId --- lib/core/libimagstore/src/iter.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/core/libimagstore/src/iter.rs b/lib/core/libimagstore/src/iter.rs index b351a785..2bff1738 100644 --- a/lib/core/libimagstore/src/iter.rs +++ b/lib/core/libimagstore/src/iter.rs @@ -27,14 +27,13 @@ macro_rules! mk_iterator_mod { fun = $fun:expr } => { pub mod $modname { - use storeid::StoreIdIterator; use storeid::StoreId; #[allow(unused_imports)] use store::FileLockEntry; use store::Store; use error::Result; - pub struct $itername<'a>(StoreIdIterator, &'a Store); + pub struct $itername<'a>(Box>, &'a Store); impl<'a> Iterator for $itername<'a> { type Item = Result<$yield>; @@ -48,11 +47,14 @@ macro_rules! mk_iterator_mod { fn $extfnname(self, store: &'a Store) -> $itername<'a>; } - impl<'a> $extname<'a> for StoreIdIterator { + impl<'a, I> $extname<'a> for I + where I: Iterator + 'static + { fn $extfnname(self, store: &'a Store) -> $itername<'a> { - $itername(self, store) + $itername(Box::new(self), store) } } + } } }