Example of How Rust Can be Confusing, Iteration and Refs

I recently tripped up over this when writing Rust: Consider this example, which features a few different ways of iterating over arrays/vectors in Rust: fn main() { let a : [ u8 ; 3 ] = [ 3 , 7 , 5 ] ; let v : Vec < u8 > = vec! [ 3 , 7 , 5 ] ; for & x in & a { println! ( "{}" , x) ; } for & x in a . iter() { println! ( "{}" , x) ; } for x in a { println! ( "{}" , x) ; } for & x in & v { println! (…