I\'m trying to write a program that involves filtering and folding over arrays. I\'ve been using The Rust Programming Language, first edition as a reference, but I don\'t un
Arrays are the type [T; N] in Rust, for any element type T and a constant number N. It's a fixed size array.
Rust doesn't implement by-value iterators for arrays at the moment. All arrays coerce to slices (type [T]) and the slice methods are available on the array because of this. The arrays also get the slice's iterator, which is called std::slice::Iter<'a, T> and has elements of type &'a T: it iterates by reference!
This is why into_iter() on a Range produces an iterator of i32 and into_iter() on a [i32; 5] produces an iterator of &i32.
If you need by value iterators for arrays, they have been implemented in the broader ecosystem, see (1) and (2).