mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Stabilize result_cloned
and result_copied
This commit is contained in:
parent
2b681ac06b
commit
1c547f422a
@ -1500,14 +1500,14 @@ impl<T, E> Result<&T, E> {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(result_copied)]
|
|
||||||
/// let val = 12;
|
/// let val = 12;
|
||||||
/// let x: Result<&i32, i32> = Ok(&val);
|
/// let x: Result<&i32, i32> = Ok(&val);
|
||||||
/// assert_eq!(x, Ok(&12));
|
/// assert_eq!(x, Ok(&12));
|
||||||
/// let copied = x.copied();
|
/// let copied = x.copied();
|
||||||
/// assert_eq!(copied, Ok(12));
|
/// assert_eq!(copied, Ok(12));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "result_copied", reason = "newly added", issue = "63168")]
|
#[inline]
|
||||||
|
#[stable(feature = "result_copied", since = "1.59.0")]
|
||||||
pub fn copied(self) -> Result<T, E>
|
pub fn copied(self) -> Result<T, E>
|
||||||
where
|
where
|
||||||
T: Copy,
|
T: Copy,
|
||||||
@ -1521,14 +1521,14 @@ impl<T, E> Result<&T, E> {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(result_cloned)]
|
|
||||||
/// let val = 12;
|
/// let val = 12;
|
||||||
/// let x: Result<&i32, i32> = Ok(&val);
|
/// let x: Result<&i32, i32> = Ok(&val);
|
||||||
/// assert_eq!(x, Ok(&12));
|
/// assert_eq!(x, Ok(&12));
|
||||||
/// let cloned = x.cloned();
|
/// let cloned = x.cloned();
|
||||||
/// assert_eq!(cloned, Ok(12));
|
/// assert_eq!(cloned, Ok(12));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "result_cloned", reason = "newly added", issue = "63168")]
|
#[inline]
|
||||||
|
#[stable(feature = "result_cloned", since = "1.59.0")]
|
||||||
pub fn cloned(self) -> Result<T, E>
|
pub fn cloned(self) -> Result<T, E>
|
||||||
where
|
where
|
||||||
T: Clone,
|
T: Clone,
|
||||||
@ -1544,14 +1544,14 @@ impl<T, E> Result<&mut T, E> {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(result_copied)]
|
|
||||||
/// let mut val = 12;
|
/// let mut val = 12;
|
||||||
/// let x: Result<&mut i32, i32> = Ok(&mut val);
|
/// let x: Result<&mut i32, i32> = Ok(&mut val);
|
||||||
/// assert_eq!(x, Ok(&mut 12));
|
/// assert_eq!(x, Ok(&mut 12));
|
||||||
/// let copied = x.copied();
|
/// let copied = x.copied();
|
||||||
/// assert_eq!(copied, Ok(12));
|
/// assert_eq!(copied, Ok(12));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "result_copied", reason = "newly added", issue = "63168")]
|
#[inline]
|
||||||
|
#[stable(feature = "result_copied", since = "1.59.0")]
|
||||||
pub fn copied(self) -> Result<T, E>
|
pub fn copied(self) -> Result<T, E>
|
||||||
where
|
where
|
||||||
T: Copy,
|
T: Copy,
|
||||||
@ -1565,14 +1565,14 @@ impl<T, E> Result<&mut T, E> {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(result_cloned)]
|
|
||||||
/// let mut val = 12;
|
/// let mut val = 12;
|
||||||
/// let x: Result<&mut i32, i32> = Ok(&mut val);
|
/// let x: Result<&mut i32, i32> = Ok(&mut val);
|
||||||
/// assert_eq!(x, Ok(&mut 12));
|
/// assert_eq!(x, Ok(&mut 12));
|
||||||
/// let cloned = x.cloned();
|
/// let cloned = x.cloned();
|
||||||
/// assert_eq!(cloned, Ok(12));
|
/// assert_eq!(cloned, Ok(12));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "result_cloned", reason = "newly added", issue = "63168")]
|
#[inline]
|
||||||
|
#[stable(feature = "result_cloned", since = "1.59.0")]
|
||||||
pub fn cloned(self) -> Result<T, E>
|
pub fn cloned(self) -> Result<T, E>
|
||||||
where
|
where
|
||||||
T: Clone,
|
T: Clone,
|
||||||
|
Loading…
Reference in New Issue
Block a user