-
Notifications
You must be signed in to change notification settings - Fork 138
impl Fail for NoneError? #59
Comments
Oh, blast. I just realised this isn't actually possible, because |
Why is this closed? This is something that I really want, and something other users of this crate will want. |
Yep, I'm voting for re-opening |
As stated in the comment where I closed it, this isn't technically possible — implementing |
Then this issue should track that progress. |
FWIW Here are all the related links As far I can see, unlike @Celti mentioned, there haven't been any discussion about making std::option::NoneError: std::error::Error or Display , could you link that for us? |
Implementing Fail for NoneError would be an orphan rules violation because of the blanket impls for type that implement |
@withoutboats Thank you for weighing in. Do you think making the necessary changes in std for this to happen is a good idea or are there hidden downsides? |
What is the current state regarding this issue? |
This workaround requires using
|
Using the currently (but probably not for very much longer) unstable
Try
trait, one can use the question mark operator onOption<T>
types, coercing them into aResult<T, NoneError>
. Unfortunately,NoneError
does not implstd::error::Error
, meaning theFail
is not implemented forNoneError
(and it being an external type, we can't implement it in our own crates).I think this would be particularly useful in light of the pattern described in “Using the
Error
type” — throwing aNoneError
fits right into the kind of rapid prototyping, "just show the user the error and exit" limited error handling that that exemplifies.Would a PR with this change go amiss?
The text was updated successfully, but these errors were encountered: