Skip to content

Create a struct similar to std::fs::File for directories #3644

Closed
@MarkusTieger

Description

@MarkusTieger

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions