Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add OpenOptions wrapper #27

Merged
merged 2 commits into from
Sep 19, 2020
Merged

Conversation

Emerentius
Copy link
Contributor

Doesn't contain os-specific extensions, yet.

This also deprecates File::from_options as that seems to have only been defined to avoid wrapping OpenOptions.
That function could also be kept, but then it should work with both fs_err::OpenOptions and std::fs::OpenOptions. You'd have to introduce a new type parameter (breaking change) and some way to convert fs_err::OpenOptions to std::fs::OpenOptions (can't be AsRef btw, but Borrow would work).
I don't think it's worth it. It only exists in fs_err so the only people affected by deprecation are old users of fs_err. People migrating to the crate after this PR would never need the function.

doesn't contain os-specific extensions, yet
Copy link
Owner

@andrewhickman andrewhickman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

As a future extension we could customize the error message based on what flags are passed to OpenOptions e.g. "error creating file" instead of "error opening file".

@andrewhickman andrewhickman merged commit 6165f1e into andrewhickman:master Sep 19, 2020
@Emerentius Emerentius deleted the open_options branch September 19, 2020 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants