Trait std::clone::CloneStable [-] [+] [src]

pub trait Clone {
    fn clone(&self) -> Self;

    fn clone_from(&mut self, source: &Self) { ... }
}

A common trait for cloning an object.

Required Methods

fn clone(&self) -> Self

Returns a copy of the value.

Provided Methods

fn clone_from(&mut self, source: &Self)

Perform copy-assignment from source.

a.clone_from(&b) is equivalent to a = b.clone() in functionality, but can be overridden to reuse the resources of a to avoid unnecessary allocations.

Implementors