Change:
Feature gate: This is a tracking issue for and , which lets you optionally project data inside a or , wrapped in a or . If the projection returns then these methods return a so that you can still get the original or back out. [x] Implementation: [x] Final commenting period (FCP) [ ] Stabilization PRNaming and signature: We wanted to call this method and accept a closure like , but that's not sound with bound lifetimes. This method is only ok when the mapping closure uses HRTB. So we opted to call it instead, with the closure returning a .
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. I wonder, why is the goal to have instead of since I can see a great value in having both APIs available. So if is already good to go we could stabilize that one and later add as soon as all open questions for it are resolved.
The name seems unusual for something that returns a - for example, returns an iterator with filtering built in. The equivalent method already exists in the Mutex implementations of , under the name . In both cases the closure it accepts returns and not the more general . So maybe the name should be reconsidered in that light.
I'm also interested in the stabilization of this API for the same reason as However, I also agree that should be named since it returns a . As an API user it makes more sense to me.
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, ref is compared twice to get the result. Is there any way to make it simpler?
fcp merge
Team member has proposed to merge this. The next step is review by the rest of the tagged team members: [x] [ ] [x] [ ] [x] [x] 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 for info about what commands tagged team members can give me.
:bell: This is now entering its final comment period, as per the . :bell:
The final comment period, with a disposition to merge, as per the , 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.

Discussion:
/// # Examples /// /// ``` <del> /// #![feature(cell_filter_map)] /// </del> /// use std::cell::{RefCell, Ref}; /// /// let c = RefCell::new(vec![1, 2, 3]);

/// let b2: Result<Ref<u32>, _> = Ref::filter_map(b1, |v| v.get(1)); /// assert_eq!(*b2.unwrap(), 2); /// ``` <del> #[unstable(feature = "cell_filter_map", reason = "recently added", issue = "81061")] </del> <ins> #[stable(feature = "cell_filter_map", since = "1.63.0")] </ins> #[inline] pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Result<Ref<'b, U>, Self> where

/// # Examples /// /// ``` <del> /// #![feature(cell_filter_map)] /// </del> /// use std::cell::{RefCell, RefMut}; /// /// let c = RefCell::new(vec![1, 2, 3]);

/// /// assert_eq!(*c.borrow(), vec![1, 4, 3]); /// ``` <del> #[unstable(feature = "cell_filter_map", reason = "recently added", issue = "81061")] </del> <ins> #[stable(feature = "cell_filter_map", since = "1.63.0")] </ins> #[inline] pub fn filter_map<U: ?Sized, F>(mut orig: RefMut<'b, T>, f: F) -> Result<RefMut<'b, U>, Self> where