Finding things in a collection has been discussed throughout this book, and the Rust standard library provides a few ways by default. These functions are attached to the Iterator<T> trait or slice types and work regardless of the actual type, provided that a function to compare two elements is furnished.
This can either be the Ord trait or a custom comparator function, such as the position() function on the Iterator<T>.