summaryrefslogtreecommitdiffstats
path: root/src/filestore
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-12-07 13:31:38 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-12-07 13:31:38 +0100
commit6915232f680e395a1b0329a96dba967d9105590d (patch)
tree26bba202cd9a797488dd684d40cf1e33225b343a /src/filestore
parent83cd6aedb2e5e76ff9ee8ce009dda122f4379fbd (diff)
Remove StoreRoot::as_path()
This patch reduces the mis-useable parts of the StoreRoot interface further by removing the StoreRoot::as_path() function. A function to get a walkdir::WalkDir was added instead. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/filestore')
-rw-r--r--src/filestore/path.rs8
-rw-r--r--src/filestore/util.rs3
2 files changed, 5 insertions, 6 deletions
diff --git a/src/filestore/path.rs b/src/filestore/path.rs
index 134c132..80cd043 100644
--- a/src/filestore/path.rs
+++ b/src/filestore/path.rs
@@ -41,13 +41,13 @@ impl StoreRoot {
self.0.join(subpath).is_dir()
}
- pub (in crate::filestore) fn as_path(&self) -> &Path {
- self.0.as_ref()
- }
-
pub fn display(&self) -> std::path::Display {
self.0.display()
}
+
+ pub (in crate::filestore) fn walk(&self) -> walkdir::WalkDir {
+ walkdir::WalkDir::new(&self.0)
+ }
}
impl AsRef<Path> for StoreRoot {
diff --git a/src/filestore/util.rs b/src/filestore/util.rs
index 75e3972..90dacab 100644
--- a/src/filestore/util.rs
+++ b/src/filestore/util.rs
@@ -10,7 +10,6 @@ use anyhow::anyhow;
use indicatif::ProgressBar;
use resiter::AndThen;
use resiter::Map;
-use walkdir::WalkDir;
use crate::filestore::Artifact;
use crate::filestore::path::*;
@@ -29,7 +28,7 @@ pub struct FileStoreImpl {
impl FileStoreImpl {
/// Loads the passed path recursively into a Path => Artifact mapping
pub fn load(root: StoreRoot, progress: ProgressBar) -> Result<Self> {
- let store = WalkDir::new(root.as_path())
+ let store = root.walk()
.follow_links(false)
.into_iter()
.filter_entry(|e| e.file_type().is_file())