mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-18 10:38:11 +00:00
Clarify that Cow::into_owned
returns owned data
This commit is contained in:
parent
6421a499a5
commit
9f4934ec19
@ -292,8 +292,7 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// Calling `into_owned` on a `Cow::Borrowed` clones the underlying data
|
/// Calling `into_owned` on a `Cow::Borrowed` returns a clone of the borrowed data:
|
||||||
/// and becomes a `Cow::Owned`:
|
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use std::borrow::Cow;
|
/// use std::borrow::Cow;
|
||||||
@ -307,7 +306,8 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
|
|||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Calling `into_owned` on a `Cow::Owned` is a no-op:
|
/// Calling `into_owned` on a `Cow::Owned` returns the owned data. The data is moved out of the
|
||||||
|
/// `Cow` without being cloned.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use std::borrow::Cow;
|
/// use std::borrow::Cow;
|
||||||
|
Loading…
Reference in New Issue
Block a user