BurntSushi / walkdir

Rust library for walking directories recursively.
The Unlicense
1.21k stars 106 forks source link

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

Closed zummenix closed 11 months ago

zummenix commented 11 months 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 11 months 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 11 months 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 11 months ago

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