Trait TryClone
pub trait TryClone: Sized {
// Required method
fn try_clone(&self) -> Result<Self, OutOfMemory>;
// Provided method
fn clone_panic_on_oom(&self) -> Self { ... }
}Expand description
A trait for values that can be cloned, but contain owned, heap-allocated values whose allocations may fail during cloning.
Required Methods§
fn try_clone(&self) -> Result<Self, OutOfMemory>
fn try_clone(&self) -> Result<Self, OutOfMemory>
Attempt to clone self, returning an error if any allocation fails
during cloning.
Provided Methods§
fn clone_panic_on_oom(&self) -> Self
fn clone_panic_on_oom(&self) -> Self
Clone self, panicking on allocation failure.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".