I understand why the floats don\'t have an implementation for Ord but that doesn\'t particularly help me when I want to be lazy and use iterators.
Is there a workaro
Perhaps like this?
fn main() { use std::cmp::Ordering; let mut x = [2.0, 1.0, -10.0, 5.0]; x.sort_by(|a, b| a.partial_cmp(b).unwrap_or(Ordering::Equal)); println!("min in x: {:?}", x); }
One thing I struggled with is that sort_by mutates the vector in place so you can't use it in a chain directly.
sort_by