"there can only be one owner at a time" requires linear (more precisely: affine) type discipline
// This signature indicates that x is immutable and consumed.
// (toy example, not idiomatic Rust)
fn consuming_reverse(x: String) -> String { ... }
{
let mut y = String::from("hello");
{
let s = String::from("bonjour");
// s "moves" into y; "hello" is dropped
y = s;
// print!("{}", s); // error "borrow of moved value s"
}
// y "moves" into consuming_reverse, result "moves" into y
y = consuming_reverse(y);
}
Escape-hatches:
Copy can be freely duplicated (bit-wise copy).Clone can be explicitly duplicated