diff options
author | Alexander Batischev <eual.jp@gmail.com> | 2021-07-21 22:06:49 +0300 |
---|---|---|
committer | Alexander Batischev <eual.jp@gmail.com> | 2021-07-21 22:25:50 +0300 |
commit | 4dfba7091c1499917839f311c50b5032c0b561e0 (patch) | |
tree | 10da24d1c53a15431912d537e95ce065b09faa28 /src/fsiter.rs | |
parent | 969ec42e788bf0eb8be8319b3779da00a8bf1c9a (diff) | |
download | obnam2-4dfba7091c1499917839f311c50b5032c0b561e0.tar.gz |
Replace FsIterResult with plain Result
Diffstat (limited to 'src/fsiter.rs')
-rw-r--r-- | src/fsiter.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/fsiter.rs b/src/fsiter.rs index 56630fa..aea9078 100644 --- a/src/fsiter.rs +++ b/src/fsiter.rs @@ -20,8 +20,6 @@ pub enum FsIterError { FsEntryError(#[from] FsEntryError), } -pub type FsIterResult<T> = Result<T, FsIterError>; - impl FsIterator { pub fn new(root: &Path, exclude_cache_tag_directories: bool) -> Self { Self { @@ -34,7 +32,7 @@ impl FsIterator { } impl Iterator for FsIterator { - type Item = FsIterResult<FilesystemEntry>; + type Item = Result<FilesystemEntry, FsIterError>; fn next(&mut self) -> Option<Self::Item> { self.iter.next() } @@ -47,7 +45,7 @@ struct SkipCachedirs { exclude_cache_tag_directories: bool, // This is the last tag we've found. `next()` will yield it before asking `iter` for more // entries. - cachedir_tag: Option<FsIterResult<FilesystemEntry>>, + cachedir_tag: Option<Result<FilesystemEntry, FsIterError>>, } impl SkipCachedirs { @@ -102,7 +100,7 @@ impl SkipCachedirs { } impl Iterator for SkipCachedirs { - type Item = FsIterResult<FilesystemEntry>; + type Item = Result<FilesystemEntry, FsIterError>; fn next(&mut self) -> Option<Self::Item> { self.cachedir_tag.take().or_else(|| { @@ -120,7 +118,7 @@ impl Iterator for SkipCachedirs { } } -fn new_entry(path: &Path) -> FsIterResult<FilesystemEntry> { +fn new_entry(path: &Path) -> Result<FilesystemEntry, FsIterError> { let meta = std::fs::symlink_metadata(path); debug!("metadata for {:?}: {:?}", path, meta); let meta = match meta { |