pub trait LazyClone {
// Required methods
fn lazy(&self) -> Self;
fn eager(&self) -> Self;
fn is_mutable(&self) -> bool;
}
Expand description
Trait for creating data that can be lazily cloned.
This provides both an interface for lazy cloning when the data is known to not be mutated. And an eager clone for data that is likely to be mutated.
Required Methods§
Sourcefn lazy(&self) -> Self
fn lazy(&self) -> Self
The O(1) lazy-clone method. Useful for cloning data that doesn’t necessarily need to be mutated.
Sourcefn eager(&self) -> Self
fn eager(&self) -> Self
A non-lazy cloning method. Useful for cloning data that is known to modified
Sourcefn is_mutable(&self) -> bool
fn is_mutable(&self) -> bool
Checks if the structure can be mutated with no side effects
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.