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
Generic type arguments on errors. #20
Comments
The error I'm wrapping has a lifetime parameter, so I would need this as well. quick_error! {
pub enum MyError<'a> {
Foo(e: SomeError<'a>) { }
}
} |
Well, unfortunately generic arguments almost impossible to implement in current macro system. At least not for arbitrary generic parameters. Waiting for stable libmacro to make this possible. But with the lifetimes there is a second issue: according to docs most of functionality of Error is for |
I actually found a better way to represent my error that doesn't involve lifetimes, so this is not a blocker for me anymore. |
Even basic support for generics would be of enormous benefit to me... is there any chance we could get this working? I tried fiddling with the code, but it's truly arcane to me. :) |
@tailhook Are you aware of https://danielkeep.github.io/rust-parse-generics/doc/parse_macros/ ? This may make the job of adding support for generics a lot easier. And right now, I'd pay for generics support! :) |
No, I'm not. Looks interesting. Does it work for stable rust? |
Not sure, but I believe so. I got pointed to this by someone on IRC. Here’s the GitHub: https://github.com/DanielKeep/rust-parse-generics Let me know what you think.
|
The reason is tailhook/quick-error#20 and DrawingAreaErrorKind<E> from plotters. Why not error-chain: rust-lang-deprecated/error-chain#240
I just discovered that this isn't possible:
Which is a shame, because this would be very useful.
The text was updated successfully, but these errors were encountered: