Add aliases to std::path::Path via extension trait #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is based on #25.
Path
has some nice methods which are just shortcuts for free functions instd::fs
.path.some_fn()
=>std::fs::some_fn(path)
. Having to translate such calls to free function calls to benefit from this crate is bothersome.This PR adds aliases that work the same way except they call
fs_err::some_fn
. Because inherent methods take precedence over trait methods, they must have different names. I have simply appended_err
to all method names.I invite bike shedding on the method names and the entire approach.
Defining an extension trait is easier than creating a wrapper struct (unless you're abusing
Deref
), but also more error prone for the user as they have to make sure to call the right method manually.