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

PersistError is private #25

Closed
sourcefrog opened this issue Apr 21, 2016 · 1 comment · Fixed by #90
Closed

PersistError is private #25

sourcefrog opened this issue Apr 21, 2016 · 1 comment · Fixed by #90

Comments

@sourcefrog
Copy link
Contributor

This seems to make it hard to match on errors from persist, or perhaps my Rust is just not strong enough?

I want to write

    if let tempfile::PersistError(e) = f.persist_noclobber(path) {
        return Err(e.error);
    };
@sourcefrog
Copy link
Contributor Author

Actually, my example code is a bit wrong, and apparently you can access fields in a pub but non-exported type. This works:

    if let Err(e) = f.persist_noclobber(path) {
        return Err(e.error);
    };  

So, close if you want.

However exposing it would let it get into the docs, and let callers declare a variable to hold it.

sourcefrog added a commit to sourcefrog/conserve that referenced this issue Apr 21, 2016
Stebalien added a commit that referenced this issue May 19, 2019
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 a pull request may close this issue.

1 participant