I have a vector of prices (f64). I would like to compute the highest price.
What is the current easiest and most idiomatic way to compute the max of a collection of f64 in rust ?
There has been some discussion about Ord and f64 but I am not sure what is the most up-to-date and less hacky way to do so.
I rely on the following but I imagined there was some built in operation
let max = prices.iter().fold(None, |r, &n| match r {
Some(p) => Some(f64::max(p, n)),
None => Some(e),
});
(which is just a fold for some free monoid)