mirror of https://github.com/rust-lang/rust.git
Stabilize `cell_filter_map`
This commit is contained in:
parent
03c8b0b6ed
commit
65242592c9
|
@ -1390,8 +1390,6 @@ impl<'b, T: ?Sized> Ref<'b, T> {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(cell_filter_map)]
|
|
||||||
///
|
|
||||||
/// use std::cell::{RefCell, Ref};
|
/// use std::cell::{RefCell, Ref};
|
||||||
///
|
///
|
||||||
/// let c = RefCell::new(vec![1, 2, 3]);
|
/// let c = RefCell::new(vec![1, 2, 3]);
|
||||||
|
@ -1399,7 +1397,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
|
||||||
/// let b2: Result<Ref<u32>, _> = Ref::filter_map(b1, |v| v.get(1));
|
/// let b2: Result<Ref<u32>, _> = Ref::filter_map(b1, |v| v.get(1));
|
||||||
/// assert_eq!(*b2.unwrap(), 2);
|
/// assert_eq!(*b2.unwrap(), 2);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "cell_filter_map", reason = "recently added", issue = "81061")]
|
#[stable(feature = "cell_filter_map", since = "1.63.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Result<Ref<'b, U>, Self>
|
pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Result<Ref<'b, U>, Self>
|
||||||
where
|
where
|
||||||
|
@ -1538,8 +1536,6 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(cell_filter_map)]
|
|
||||||
///
|
|
||||||
/// use std::cell::{RefCell, RefMut};
|
/// use std::cell::{RefCell, RefMut};
|
||||||
///
|
///
|
||||||
/// let c = RefCell::new(vec![1, 2, 3]);
|
/// let c = RefCell::new(vec![1, 2, 3]);
|
||||||
|
@ -1555,7 +1551,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
|
||||||
///
|
///
|
||||||
/// assert_eq!(*c.borrow(), vec![1, 4, 3]);
|
/// assert_eq!(*c.borrow(), vec![1, 4, 3]);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "cell_filter_map", reason = "recently added", issue = "81061")]
|
#[stable(feature = "cell_filter_map", since = "1.63.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn filter_map<U: ?Sized, F>(mut orig: RefMut<'b, T>, f: F) -> Result<RefMut<'b, U>, Self>
|
pub fn filter_map<U: ?Sized, F>(mut orig: RefMut<'b, T>, f: F) -> Result<RefMut<'b, U>, Self>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in New Issue