How to write a Rust function that takes an iterator?
You want to use generics here: fn find_min<‘a, I>(vals: I) -> Option<&’a u32> where I: Iterator<Item = &’a u32>, { vals.min() } Traits can be used in two ways: as bounds on type parameters and as trait objects. The book The Rust Programming Language has a chapter on traits and a chapter on trait objects … Read more