clone
An explicit deep copy of a value.
clone() makes an independent duplicate, including heap data; types opt in with Clone.
Loading interactive…
Examples
let mut t = s.clone(); t.push('!');leavessashiand makesthi!: the clone got its own heap buffer.
See also