-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implement {Option,Result}.unwrapOrElse #155
Conversation
Something I re-discovered as missing yesterday, we can definitely use this in some places. The quivalent of Rust's unwrap_or_else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left two comments but nothing that isn't an easy fix and auto-merge isn't enabled 👍
docs/reference/api/option.rst
Outdated
|
||
Returns the contained ``Some`` value or computes a value with a provided function. | ||
|
||
The function is at most one time, only if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like a word missing here: is at most one time
docs/reference/api/result.rst
Outdated
(error) => { console.log(`Called, got ${error}`); return 'UGH'; } | ||
) // => 'OK', nothing printed | ||
|
||
Err('A03B').unwrapOrElse((error) => `UGH, got ${error}') // => 'UGH, got A03B' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the backward quotes are not being correctly closed here, I don't see it and GH also shows that they don't get closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a keen eye, fixing
Hello - this does not appear to be included in the latest 4.2.0 release. Will there be a new release soon? |
Hey, yeah not released yet, do you need it? I can expedite that if so. |
Wow. So why it is mentioned in docs? |
Something I re-discovered as missing yesterday, we can definitely use this in some places.
The equivalent of Rust's unwrap_or_else.