pub trait CheapClone: Clone {
// Provided method
fn cheap_clone(&self) -> Self { ... }
}
Expand description
Things that are fast to clone in the context of an application.
The purpose of this API is to reduce the number of calls to .clone() which need to be audited for performance.
As a rule of thumb, only constant-time Clone
impls should also implement CheapClone.
Eg:
Provided Methods§
Sourcefn cheap_clone(&self) -> Self
fn cheap_clone(&self) -> Self
Returns a copy of the value.
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.