1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::fs::DirEntry;
use crate::wasi::types;

/// Iterator over the entries in a directory.
///
/// This corresponds to [`std::fs::ReadDir`].
///
/// TODO: Not yet implemented.
///
/// [`std::fs::ReadDir`]: https://doc.rust-lang.org/std/fs/struct.ReadDir.html
pub struct ReadDir {
    fd: types::Fd,
}

impl ReadDir {
    /// Constructs a new instance of `Self` from the given raw WASI file descriptor.
    pub unsafe fn from_raw_wasi_fd(fd: types::Fd) -> Self {
        Self { fd }
    }
}

/// TODO: Not yet implemented.
impl Iterator for ReadDir {
    type Item = DirEntry;

    /// TODO: Not yet implemented.
    fn next(&mut self) -> Option<Self::Item> {
        unimplemented!("ReadDir::next");
    }
}

// TODO: impl Debug for ReadDir