1use crate::{DirEntryView, ViewKind};
2use std::{fmt, io};
3
4pub struct ReadDirView {
11 pub(crate) read_dir: cap_std::fs::ReadDir,
12 pub(crate) view_kind: ViewKind,
13}
14
15impl Iterator for ReadDirView {
16 type Item = io::Result<DirEntryView>;
17
18 #[inline]
19 fn next(&mut self) -> Option<Self::Item> {
20 self.read_dir.next().map(|entry| {
21 entry.map(|entry| DirEntryView {
22 entry,
23 view_kind: self.view_kind,
24 })
25 })
26 }
27}
28
29impl fmt::Debug for ReadDirView {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 self.read_dir.fmt(f)
32 }
33}