Trait core::clone::Clone[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. The contents of owned pointers are copied to maintain uniqueness, while the contents of managed pointers are not copied.

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