What is the difference between iter and into_iter?
<p>I am doing the <a href="https://doc.rust-lang.org/rust-by-example/fn/closures/closure_examples/iter_find.html" rel="noreferrer">Rust by Example</a> tutorial which has this code snippet:</p>
<pre><code>// Vec example
let vec1 = vec![1, 2, 3];
let vec2 = vec![4, 5, 6];

// `iter()` for vecs yields `&amp;i32`. Destructure to `i32`.
println!(&quot;2 in vec1: {}&quot;, vec1.iter()     .any(|&amp;x| x == 2));
// `into_iter()` for vecs yields `i32`. No destructuring required.
println!(&quot;2 in vec2: {}&quot;, vec2.into_iter().any(| x| x == 2));

// Array example
let array1 = [1, 2, 3];
let array2 = [4, 5, 6];

// `iter()` for arrays yields `&amp;i32`.
println!(&quot;2 in array1: {}&quot;, array1.iter()     .any(|&amp;x| x == 2));
// `into_iter()` for arrays unusually yields `&amp;i32`.
println!(&quot;2 in array2: {}&quot;, array2.into_iter().any(|&amp;x| x == 2));
</code></pre>
<p>I am thoroughly confused — for a <code>Vec</code> the iterator returned from <code>iter</code> yields references and the iterator returned from <code>into_iter</code> yields values, but for an array these iterators are identical?</p>
<p>What is the use case/API for these two methods?</p>