pub trait TryClone: Sized {
// Required method
fn try_clone(&self) -> Result<Self, Error>;
// Provided method
fn try_clone_from(&mut self, source: &Self) -> Result<(), Error> { ... }
}Expand description
Fallible TryClone trait.
Required Methods§
Provided Methods§
Sourcefn try_clone_from(&mut self, source: &Self) -> Result<(), Error>
fn try_clone_from(&mut self, source: &Self) -> Result<(), Error>
Performs copy-assignment from source.
a.try_clone_from(&b) is equivalent to a = b.clone() in
functionality, but can be overridden to reuse the resources of a to
avoid unnecessary allocations.
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.