As a C programmer familiar with pointers and dereferencing, I'm working through a Rust tutorial, and have come across something I don't understand.
fn main() {
let vector = vec![10, 20, 30, 40];
for entry in &vector {
if *entry == 30 { // I have to use a star (dereference) here...
println!("thirty");
} else {
println!("{}", entry);
}
match entry { // ...but why do I not need a star here?
30 => println!("thirty"),
_ => println!("{}", entry), // or here?
}
}
}