Thinking of Identities without Copy trait as non-owning?
⚓ Rust 📅 2025-05-15 👤 surdeus 👁️ 10Take this example:
fn main() {
let v: Vec<i32> = vec![0, 1, 2];
let n_ref: &i32 = &v[0];
let n: i32 = *n_ref;
}
Here the code passes compiler checks, but it won't for Strings.
For strings do not implement Copy.
Wouldn't it be a useful shorthand to simply not think of ownership for variables that have a Copy trait? (Since they are never moved.)
12 posts - 5 participants
🏷️ rust_feed