emath

Trait Float

Source
pub trait Float:
    PartialOrd
    + PartialEq
    + FloatImpl {
    // Required method
    fn ord(self) -> OrderedFloat<Self>
       where Self: Sized;
}
Expand description

Extension trait to provide ord() method.

Example with f64:

use emath::Float as _;

let array = [1.0, 2.5, 2.0];
let max = array.iter().max_by_key(|val| val.ord());

assert_eq!(max, Some(&2.5));

Required Methods§

Source

fn ord(self) -> OrderedFloat<Self>
where Self: Sized,

Type to provide total order, useful as key in sorted contexts.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Float for f32

Source§

fn ord(self) -> OrderedFloat<Self>

Source§

impl Float for f64

Source§

fn ord(self) -> OrderedFloat<Self>

Implementors§