-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Tracking issue for Result::map_or_else #53268
Comments
Implemented in #53777 |
…xcrichton Implemented map_or_else for Result<T, E> Fulfills rust-lang#53268 The example is ripped from `Option::map_or_else`, with the types corrected.
I think its parameters should be changed |
It would also be good to have |
@liigo Yes, having the |
@Boscop That's not an issue because it's still unstable. In most cases the error is of a different type than the value and it would cause a compile time error, anyway. |
@Emerentius I agree that having the |
|
Look on the bright side. The original ergonomic argument that the typically longer closure should be at the end is still compelling and provides a reasonable basis for making consistent decisions about this sort of thing. To second what was mentioned above, it would make a lot of sense to add |
Is there any reason this shouldn't just be the tracking issue for |
Seconding |
#66292 is adding |
I'm sorry but this implementation of map_or_else is incredibly annoying as it differs from Option.
and the parameters are then switched, is mildly said absurd! - keep things consistent! |
Oof. Indeed. Not only are they switched from |
Stabilization PR in #66322 |
Looks like this is released with 1.41 but the order flip is really quite a pain. Any precedent for why error first? |
@cdbattags Seems described in the first comment #53268 (comment). |
Result
should also havemap_or_else()
, likeOption
(but the closure for theelse
case should also get theErr
as argument, like withunwrap_or_else
).Both
Option
andResult
haveunwrap_or_else
andunwrap_or
, so they should also both havemap_or_else
.The text was updated successfully, but these errors were encountered: