Trait fallacy_box::TryClone
source · [−]pub trait TryClone {
fn try_clone(&self) -> Result<Self, AllocError>;
fn try_clone_from(&mut self, source: &Self) -> Result<(), AllocError> { ... }
}Expand description
Tries to clone, return an error instead of panic if allocation failed.
Required methods
fn try_clone(&self) -> Result<Self, AllocError>
Provided methods
fn try_clone_from(&mut self, source: &Self) -> Result<(), AllocError>
fn try_clone_from(&mut self, source: &Self) -> Result<(), AllocError>
Performs copy-assignment from source.
a.try_clone_from(&b) is equivalent to a = b.try_clone() in functionality,
but can be overridden to reuse the resources of a to avoid unnecessary
allocations.