Closed CryZe closed 7 years ago
Yeah, I recently ran into something like that in my toy program to exercise things. In my case, I changed my function to something like fn foo<E>(x: Result<Blah, E>) where E: std::error::Error
, which allows you to do certain things but not everything.
My main concern is that I don't really want the enum variants to be part of the public API, as I'd like the flexibility to change them...
You can also just change the trait definition to use the public Error type.
the public Error type.
But that type also refers to expression::Error
; wouldn't that cause the same problem for you?
I meant sxd_path::Error. That one is public, so I can write a From<sxd_path::Error>
impl for that. I just want to encapsulate it into my type, so that would just work.
I meant sxd_path::Error.
The downside of reusing that is that just evaluating the XPath can't cause a "missing XPath error", so there would be error types that could never happen. I've a PR up that adds opaque wrappers for the specific error types without exposing the internals.
As a heads-up, I've done some reworking of the library, so 0.4 is going to entail some changes! 😇
This is unfortunate because now there's a private type in the public Expression trait that I can't implement
From<expression::Error>
for.Update: It kind of works if you chain multiple into calls together. Still kind of bad if you wanted to use try! or the question mark operator, as that's completely impossible with the current situation.