Warning
This post was published 46 days ago. The information described in this article may have changed.
Take 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