impl Into<StoreIdIterator> for GlobStoreIdIterator to be able to convert easily

This commit is contained in:
Matthias Beyer 2016-05-13 14:48:20 +02:00
parent 839ec051a4
commit dd7e146081
1 changed files with 11 additions and 1 deletions

View File

@ -438,7 +438,8 @@ impl Store {
debug!("glob()ing with '{}'", path); debug!("glob()ing with '{}'", path);
glob(&path[..]).map_err(|e| SE::new(SEK::GlobError, Some(Box::new(e)))) glob(&path[..]).map_err(|e| SE::new(SEK::GlobError, Some(Box::new(e))))
}) })
.map(|paths| StoreIdIterator::new(Box::new(GlobStoreIdIterator::new(paths)))) .map(|paths| GlobStoreIdIterator::new(paths).into())
.map_err(|e| SE::new(SEK::GlobError, Some(Box::new(e))))
} }
// Walk the store tree for the module // Walk the store tree for the module
@ -1299,6 +1300,7 @@ mod glob_store_iter {
use std::fmt::Error as FmtError; use std::fmt::Error as FmtError;
use glob::Paths; use glob::Paths;
use storeid::StoreId; use storeid::StoreId;
use storeid::StoreIdIterator;
pub struct GlobStoreIdIterator { pub struct GlobStoreIdIterator {
paths: Paths, paths: Paths,
@ -1312,6 +1314,14 @@ mod glob_store_iter {
} }
impl Into<StoreIdIterator> for GlobStoreIdIterator {
fn into(self) -> StoreIdIterator {
StoreIdIterator::new(Box::new(self))
}
}
impl GlobStoreIdIterator { impl GlobStoreIdIterator {
pub fn new(paths: Paths) -> GlobStoreIdIterator { pub fn new(paths: Paths) -> GlobStoreIdIterator {