There is currently no safe way in rust to open a filedescriptor on a directory and using it for reading entries. Currently you always have to open a new filedescriptor using std::fs::read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir>. At least for my understanding, if you need to access the directory multiple times (for example for a directory watcher), this is inefficient.
A solution would be to introduce a new struct called "Dir" or "Directory" with a "read_dir" function, which can be used to access a directory multiple times without opening another filedescriptor. Another solution would be to extend the std::fs::File struct with a "read_dir" function.
There is currently no safe way in rust to open a filedescriptor on a directory and using it for reading entries. Currently you always have to open a new filedescriptor using
std::fs::read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir>
. At least for my understanding, if you need to access the directory multiple times (for example for a directory watcher), this is inefficient.A solution would be to introduce a new struct called "Dir" or "Directory" with a "read_dir" function, which can be used to access a directory multiple times without opening another filedescriptor. Another solution would be to extend the std::fs::File struct with a "read_dir" function.