Skip to content
masterclass Buddy

Rust · Trait

Clone

The Clone trait creates an explicit duplicate of a value. Call .clone() when normal assignment would move the value, and use #[derive(Clone)] when the fields support it.

Last updated

Since
1.0.0

Syntax

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

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Copy
  • Clone Derive macro
  • std::clone
  • core::clone

Source: std::clone - Rust. Checked 2026-11-03.