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

Provided methods

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.

Implementations on Foreign Types

Implementors