Indexing with a non-`usize` type gives an error that looks like this:
```text
-error: the trait `core::ops::Index<i32>` is not implemented for the type
-`collections::vec::Vec<_>` [E0277]
+error: the trait bound `collections::vec::Vec<_> : core::ops::Index<i32>`
+is not satisfied [E0277]
v[j];
^~~~
note: the type `collections::vec::Vec<_>` cannot be indexed by `i32`
}
```
+Note: You cannot use the vector again once you have iterated by taking ownership of the vector.
+You can iterate the vector multiple times by taking a reference to the vector whilst iterating.
+For example, the following code does not compile.
+
+```rust,ignore
+let v = vec![1, 2, 3, 4, 5];
+
+for i in v {
+ println!("Take ownership of the vector and its element {}", i);
+}
+
+for i in v {
+ println!("Take ownership of the vector and its element {}", i);
+}
+```
+
+Whereas the following works perfectly,
+
+```rust
+let v = vec![1, 2, 3, 4, 5];
+
+for i in &v {
+ println!("This is a reference to {}", i);
+}
+
+for i in &v {
+ println!("This is a reference to {}", i);
+}
+```
+
Vectors have many more useful methods, which you can read about in [their
API documentation][vec].