summaryrefslogtreecommitdiffstats
path: root/src/dir.rs
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-08-25 15:04:15 +0100
committerBen S <ogham@bsago.me>2015-08-25 15:04:15 +0100
commit2a9b6fe93080ba00cf99c05db41076e843c8aae7 (patch)
tree7acbbeaeb8a335332fe4c85fa1a349b04c5dee0c /src/dir.rs
parent7deb08644ac85656c61f1917f2011fa72ca9eb86 (diff)
Display errors inline in the tree
When tree mode is active, this will print out errors as another form of child node in the tree, instead of in one big block before any output. The 'this' field now holds the io::Result of the readdir call, rather than only a *successful* result.
Diffstat (limited to 'src/dir.rs')
-rw-r--r--src/dir.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dir.rs b/src/dir.rs
index e6cd649..c1d5afc 100644
--- a/src/dir.rs
+++ b/src/dir.rs
@@ -78,9 +78,9 @@ pub struct Files<'dir> {
}
impl<'dir> Iterator for Files<'dir> {
- type Item = io::Result<File<'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))
+ self.inner.next().map(|path| File::from_path(path, Some(self.dir), self.recurse).map_err(|t| (path.clone(), t)))
}
} \ No newline at end of file