summaryrefslogtreecommitdiffstats
path: root/src/dir.rs
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-08-26 09:35:11 +0100
committerBen S <ogham@bsago.me>2015-08-26 09:35:11 +0100
commitb5edee53bd829188d0b60fe73308a7a28561210f (patch)
tree1b48af2899027427fd723b3e8ef86ceed383813c /src/dir.rs
parent69b22a0d669f6cb741290b96fe717e30efb70216 (diff)
Scan for nested files on-demand, not all the time
This does a similar thing that we did with the xattrs, except with the nested files: it removes the 'this' field on File, and replaces it with a method (to_dir) that has the same effect. This means we get to remove a bunch of 'recurse' fields and parameters that really had no business being there! Now the table doesn't need to know whether it's going to need to list files recursively or not.
Diffstat (limited to 'src/dir.rs')
-rw-r--r--src/dir.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/dir.rs b/src/dir.rs
index c1d5afc..cd4f0d0 100644
--- a/src/dir.rs
+++ b/src/dir.rs
@@ -37,10 +37,9 @@ impl Dir {
///
/// Passing in `recurse` means that any directories will be scanned for
/// their contents, as well.
- pub fn files<'dir>(&'dir self, recurse: bool) -> Files<'dir> {
+ pub fn files<'dir>(&'dir self) -> Files<'dir> {
Files {
inner: self.contents.iter(),
- recurse: recurse,
dir: &self,
}
}
@@ -73,7 +72,6 @@ impl Dir {
pub struct Files<'dir> {
inner: SliceIter<'dir, PathBuf>,
- recurse: bool,
dir: &'dir Dir,
}
@@ -81,6 +79,6 @@ impl<'dir> Iterator for Files<'dir> {
type Item = Result<File<'dir>, (PathBuf, io::Error)>;
fn next(&mut self) -> Option<Self::Item> {
- self.inner.next().map(|path| File::from_path(path, Some(self.dir), self.recurse).map_err(|t| (path.clone(), t)))
+ self.inner.next().map(|path| File::from_path(path, Some(self.dir)).map_err(|t| (path.clone(), t)))
}
} \ No newline at end of file