Trait std::borrow::ToOwned 1.0.0[−][src]
A generalization of Clone
to borrowed data.
Some types make it possible to go from borrowed to owned, usually by
implementing the Clone
trait. But Clone
works only for going from &T
to T
. The ToOwned
trait generalizes Clone
to construct owned data
from any borrow of a given type.
Associated Types
Loading content...Required methods
#[must_use =
"cloning is often expensive and is not expected to have side effects"]pub fn to_owned(&self) -> Self::Owned
[src]
Provided methods
pub fn clone_into(&self, target: &mut Self::Owned)
[src]
🔬 This is a nightly-only experimental API. (toowned_clone_into
#41263)
recently added
Implementors
impl ToOwned for str
[src]
type Owned = String
pub fn to_owned(&self) -> String
[src]
pub fn clone_into(&self, target: &mut String)
[src]
impl ToOwned for CStr
1.3.0[src]
type Owned = CString
fn to_owned(&self) -> CString
[src]
fn clone_into(&self, target: &mut CString)
[src]
impl ToOwned for OsStr
[src]
type Owned = OsString
fn to_owned(&self) -> OsString
[src]
fn clone_into(&self, target: &mut OsString)
[src]
impl ToOwned for Path
[src]
type Owned = PathBuf
fn to_owned(&self) -> PathBuf
[src]
fn clone_into(&self, target: &mut PathBuf)
[src]
impl<T> ToOwned for [T] where
T: Clone,
[src]
T: Clone,
type Owned = Vec<T, Global>
pub fn to_owned(&self) -> Vec<T, Global>ⓘ
[src]
pub fn clone_into(&self, target: &mut Vec<T, Global>)
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,