Thank you.
I think there’s more to it though, in that simple values aren’t moved, they’re always copied (with any &
in front indicating whether it’s the value to copy or the address)
To illustrate:
fn how_many(a: u32, fruit: String) {
println!("there are {} {}", a, fruit);
}
fn main() {
let a=4;
let fruit = String::from("Apples");
how_many(a, fruit);
println!("the amount was {}", a); // this works
println!("the fruit was {}", fruit); // this fails
}
The ‘a’ was copied, and the ‘fruit’ was moved.
It’s me deciding. Recommendations for interesting people on Mastodon to follow are welcome (either in this post, or the sticky ‘About this community’ post).