pub trait TryToOwned {
type Owned: Borrow<Self>;
// Required method
fn try_to_owned(&self) -> Result<Self::Owned, Error>;
}
Expand description
A generalization of TryClone
to borrowed data.
Some types make it possible to go from borrowed to owned, usually by
implementing the TryClone
trait. But TryClone
works only for going from
&T
to T
. The ToOwned
trait generalizes TryClone
to construct owned
data from any borrow of a given type.
Required Associated Types§
Required Methods§
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.