Implement iter extension for all iterators over StoreId
This commit is contained in:
parent
898617ff62
commit
67410b3ad2
1 changed files with 6 additions and 4 deletions
|
@ -27,14 +27,13 @@ macro_rules! mk_iterator_mod {
|
||||||
fun = $fun:expr
|
fun = $fun:expr
|
||||||
} => {
|
} => {
|
||||||
pub mod $modname {
|
pub mod $modname {
|
||||||
use storeid::StoreIdIterator;
|
|
||||||
use storeid::StoreId;
|
use storeid::StoreId;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use store::FileLockEntry;
|
use store::FileLockEntry;
|
||||||
use store::Store;
|
use store::Store;
|
||||||
use error::Result;
|
use error::Result;
|
||||||
|
|
||||||
pub struct $itername<'a>(StoreIdIterator, &'a Store);
|
pub struct $itername<'a>(Box<Iterator<Item = StoreId>>, &'a Store);
|
||||||
|
|
||||||
impl<'a> Iterator for $itername<'a> {
|
impl<'a> Iterator for $itername<'a> {
|
||||||
type Item = Result<$yield>;
|
type Item = Result<$yield>;
|
||||||
|
@ -48,11 +47,14 @@ macro_rules! mk_iterator_mod {
|
||||||
fn $extfnname(self, store: &'a Store) -> $itername<'a>;
|
fn $extfnname(self, store: &'a Store) -> $itername<'a>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> $extname<'a> for StoreIdIterator {
|
impl<'a, I> $extname<'a> for I
|
||||||
|
where I: Iterator<Item = StoreId> + 'static
|
||||||
|
{
|
||||||
fn $extfnname(self, store: &'a Store) -> $itername<'a> {
|
fn $extfnname(self, store: &'a Store) -> $itername<'a> {
|
||||||
$itername(self, store)
|
$itername(Box::new(self), store)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue