Assumption -- The Vec does not have any NaN values or exhibit any NaN behavior.
Vec
NaN
T
Is there a reason why this wouldn't work?
use std::cmp::Ordering; fn example(nets: &Vec) { let index_of_max: Option = nets .iter() .enumerate() .max_by(|(_, a), (_, b)| a.partial_cmp(b).unwrap_or(Ordering::Equal)) .map(|(index, _)| index); }