What types implement the Copy trait

Primitive types and structs with only Copy fields implement the Copy trait, allowing values to be duplicated instead of moved.

All primitive scalar types (like i32, u8, bool, f64) and tuples or arrays containing only Copy types implement the Copy trait by default. You can also derive it for your own structs if all their fields are Copy.

#[derive(Copy, Clone)]
struct Point {
    x: i32,
    y: i32,
}

fn main() {
    let p1 = Point { x: 1, y: 2 };
    let p2 = p1; // p1 is copied, not moved
    println!("{p1}, {p2}"); // Both are valid
}