diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index db9eac3f..a3f6955e 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -25,7 +25,7 @@ use walkdir::Iter as WalkDirIter; use error::{ParserErrorKind, ParserError}; use error::{StoreError, StoreErrorKind}; -use storeid::{IntoStoreId, StoreId, GlobStoreIdIterator, StoreIdIterator}; +use storeid::{IntoStoreId, StoreId, StoreIdIterator}; use lazyfile::LazyFile; use hook::aspect::Aspect; @@ -35,6 +35,8 @@ use hook::accessor::{ MutableHookDataAccessor, use hook::position::HookPosition; use hook::Hook; +use self::glob_store_iter::*; + /// The Result Type returned by any interaction with the store that could fail pub type Result = RResult; @@ -1253,6 +1255,53 @@ impl Entry { } +mod glob_store_iter { + use std::fmt::{Debug, Formatter}; + use std::fmt::Error as FmtError; + use glob::Paths; + use storeid::StoreId; + + pub struct GlobStoreIdIterator { + paths: Paths, + } + + impl Debug for GlobStoreIdIterator { + + fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> { + write!(fmt, "GlobStoreIdIterator") + } + + } + + impl GlobStoreIdIterator { + + pub fn new(paths: Paths) -> GlobStoreIdIterator { + GlobStoreIdIterator { + paths: paths, + } + } + + } + + impl Iterator for GlobStoreIdIterator { + type Item = StoreId; + + fn next(&mut self) -> Option { + self.paths.next().and_then(|o| { + match o { + Ok(o) => Some(o), + Err(e) => { + debug!("GlobStoreIdIterator error: {:?}", e); + None + }, + } + }).map(|p| StoreId::from(p)) + } + + } + +} + #[cfg(test)] mod test { diff --git a/libimagstore/src/storeid.rs b/libimagstore/src/storeid.rs index 770e620e..7481b6f8 100644 --- a/libimagstore/src/storeid.rs +++ b/libimagstore/src/storeid.rs @@ -3,7 +3,6 @@ use std::path::Path; use std::borrow::Borrow; use std::ops::Deref; -use glob::Paths; use semver::Version; use std::fmt::{Debug, Formatter}; use std::fmt::Error as FmtError; @@ -155,45 +154,6 @@ macro_rules! module_entry_path_mod { ) } -pub struct GlobStoreIdIterator { - paths: Paths, -} - -impl Debug for GlobStoreIdIterator { - - fn fmt(&self, fmt: &mut Formatter) -> RResult<(), FmtError> { - write!(fmt, "GlobStoreIdIterator") - } - -} - -impl GlobStoreIdIterator { - - pub fn new(paths: Paths) -> GlobStoreIdIterator { - GlobStoreIdIterator { - paths: paths, - } - } - -} - -impl Iterator for GlobStoreIdIterator { - type Item = StoreId; - - fn next(&mut self) -> Option { - self.paths.next().and_then(|o| { - match o { - Ok(o) => Some(o), - Err(e) => { - debug!("GlobStoreIdIterator error: {:?}", e); - None - }, - } - }).map(|p| StoreId::from(p)) - } - -} - pub struct StoreIdIterator { iter: Box>, }