-
Notifications
You must be signed in to change notification settings - Fork 13k
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 cell_filter_map #81061
Comments
I am in need of this API for my library in order to be able to have an efficient implementation that avoids unsafe Rust code. |
The name |
I'm also interested in the stabilization of this API for the same reason as @Robbepop. However, I also agree that |
I wonder if we can have a generic filter & map for any inner enum instead of just Option. For example in this code
As the code show, |
@rfcbot fcp merge |
Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
…Simulacrum Stabilize `cell_filter_map` FCP has been completed: rust-lang/rust#81061 (comment) Closes #81061
Feature gate:
#![feature(cell_filter_map)]
This is a tracking issue for
Ref::filter_map
andRefMut::filter_map
, which lets you optionally project data inside aRef
orRefMut
, wrapped in aRef
orRefMut
. If the projection returnsNone
then these methods return aErr(Self)
so that you can still get the originalRef
orRefMut
back out.Public API
Steps / History
Unresolved Questions
try_map
and accept a closure likeFnOnce(&T) -> R where R: Try<Ok = &U>
, but that's not sound with bound lifetimes. This method is only ok when the mapping closure uses HRTB. So we opted to call itfilter_map
instead, with the closure returning aOption<&U>
.The text was updated successfully, but these errors were encountered: