From 6915232f680e395a1b0329a96dba967d9105590d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 7 Dec 2020 13:31:38 +0100 Subject: 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 --- src/filestore/path.rs | 8 ++++---- src/filestore/util.rs | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/filestore') 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 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 { - let store = WalkDir::new(root.as_path()) + let store = root.walk() .follow_links(false) .into_iter() .filter_entry(|e| e.file_type().is_file()) -- cgit v1.2.3