Trait std::clone::Clone

Overview

The Clone trait is used to explicitly clone values.

Examples

let a = 42;
let b = a.clone();

assert_eq!(a, b);

Methods

fn clone(value: any) -> any

Clone the specified value.

Examples

let a = 42;
let b = a;
let c = a.clone();

a += 1;

assert_eq!(a, 43);
assert_eq!(b, 42);
assert_eq!(c, 42);