Similar to how interfaces standardize access to functionality in the libraries of other languages, Rust's standard library utilizes a type and a trait to provide fundamental implementations. The trait, Iterator<T>, has been looked at and used over the course of this book several times. The slice type, however, was not explicitly used a lot, especially since the Rust compiler automatically uses slices when Vec<T> is borrowed for a function call. How can you leverage this type, though? We have seen the Iterator<T> implementation in action, but does it provide more than that?
Slicing and iteration
Iterator
To recap: an iterator is a pattern to traverse a collection, providing a pointer to each element...