pub trait ToOwned: Sized {
type Owned;
// Required method
fn to_owned(&self) -> Self::Owned;
// Provided method
fn into_owned(self) -> Self::Owned { ... }
}
Expand description
Convert from a borrowed type into an owned type.
This is similar to std::borrow::ToOwned but is meant for types with
internal references, with support for into_owned
and an additional Sized
constraint.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn into_owned(self) -> Self::Owned
fn into_owned(self) -> Self::Owned
Create an owned version of this type, consuming self
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.