Skip to content

use https://crates.io/crates/quick-error/ #18

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

Merged
merged 1 commit into from
Oct 6, 2016
Merged

use https://crates.io/crates/quick-error/ #18

merged 1 commit into from
Oct 6, 2016

Conversation

colin-kiegel
Copy link
Member

I just found this ingenious library: https://github.com/tailhook/quick-error
This should remove a lot of boilerplate from error definitions. Just what I was dreaming of. ^^

PS - Found it here: https://this-week-in-rust.org/blog/2015/12/14/this-week-in-rust-109/

@colin-kiegel
Copy link
Member Author

BTW - I used cargo-edit from cargo-extras to add this dependency to Cargo.toml. It seems like it rearranged some lines in Cargo.toml. That wasn't intentional, I just noticed it right now.

@colin-kiegel colin-kiegel deleted the quick_error branch December 19, 2015 16:35
@colin-kiegel colin-kiegel restored the quick_error branch December 19, 2015 16:35
@colin-kiegel colin-kiegel reopened this Dec 19, 2015
@colin-kiegel
Copy link
Member Author

One limitation of quick_error is its lack of struct-like variants: tailhook/quick-error#5

I prefer named fields (i.e. structs instead tuples) in almost all cases of enum-variants with 2+ fields. I hope this will be implemented in the future in quick_error.

@colin-kiegel
Copy link
Member Author

PS: quick-error now supports struct like variants, so this limitation is gone.

Independent of using this library, I suggest we use tuple-like variants whenever there is only one field (new-type pattern), and struct-like variants whenever there are multiple fields.

(and btw, happy new year ^^ 🎆)

@Nercury Nercury merged commit 7c6fd26 into rust-web:master Oct 6, 2016
@colin-kiegel colin-kiegel deleted the quick_error branch October 6, 2016 20:48
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