Closed Legorooj closed 3 years ago
Could you say why you want this?
To save doing manual conversions for functions - a large number of functions in the Rust ecosystem (including stdlib) use Into
, From
, and AsRef
as trait bounds on function calls. Adding this allows for things like fs::File::open(DirEntry)
and others, which accept generics such as AsRef<Path>
or Into<PathBuf>
.
thingy.into()
is also a very common pattern for type conversions, so having it available is nice.
Thanks for explaining. Unfortunately, I don't think they are a good fit. A DirEntry
is more than just a path, so I think implementing these traits in a way that automatically drops all other information in a DirEntry
is not such a good idea. I think reasonable people can disagree on this point.
Adds support for
PathBuf::from(DirEntry)
andDirEntry::into()
forPathBuf
.