We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9985b99 commit 1d556a0Copy full SHA for 1d556a0
src/fn/closures/closure_examples/iter_any.md
@@ -29,6 +29,14 @@ fn main() {
29
// `into_iter()` for vecs yields `i32`. No destructuring required.
30
println!("2 in vec2: {}", vec2.into_iter().any(| x| x == 2));
31
32
+ // `iter()` only borrows `vec1` and its elements, so they can be used again
33
+ println!("vec1 len: {}", vec1.len());
34
+ println!("First element of vec1 is: {}", vec1[0]);
35
+ // `into_iter()` does move `vec2` and its elements, so they cannot be used again
36
+ // println!("First element of vec2 is: {}", vec2[0]);
37
+ // println!("vec2 len: {}", vec2.len());
38
+ // TODO: uncomment two lines above and see compiler errors.
39
+
40
let array1 = [1, 2, 3];
41
let array2 = [4, 5, 6];
42
0 commit comments