pub fn argmin<I: IntoIterator>(iter: I) -> Option<usize>
Expand description
Returns the index of the minimum value in an iterator, or None
if the
iterator is empty.
If the minimum appears several times, this methods returns the position of the first instance.
§Arguments
iter
: the iterator.
§Panics
If a comparison returns None
.
§Examples
let v = vec![4, 3, 1, 0, 5, 0];
let index = argmin(&v);
assert_eq!(index, Some(3));