BurntSushi / walkdir

Rust library for walking directories recursively.
The Unlicense
1.3k stars 109 forks source link

A way to convert walkdir::DirEntry into std::fs::DirEntry #183

Closed zummenix closed 1 year ago

zummenix commented 1 year ago

I'd prefer to expose std::fs::DirEntry in public interface of my crate instead of walkdir::DirEntry.

Is it possible to convert walkdir::DirEntry into std::fs::DirEntry or does it make sense at all?

BurntSushi commented 1 year ago

Nope, it isn't possible. std::fs::DirEntry is an opaque type. There is no way to directly construct it other than by using std::fs::read_dir.

BurntSushi commented 1 year ago

Also, it somewhat looks like you might be presenting a false choice here. There is always a third choice: wrap walkdir::DirEntry in a type you own and expose the routines you need to expose.

zummenix commented 1 year ago

Thank you for the recommendation! I'll think about it