Skip to main content

AbsOrd

Trait AbsOrd 

Source
pub trait AbsOrd<Rhs = Self> {
    // Required method
    fn abs_cmp(&self, rhs: &Rhs) -> Ordering;
}
Expand description

Compare the magnitude of this number to the magnitude of the other number

Note that this function will panic if either of the numbers is NaN.

§Examples

assert!(5.abs_cmp(&-6).is_le());
assert!(12.3.abs_cmp(&-12.3).is_eq());

Required Methods§

Source

fn abs_cmp(&self, rhs: &Rhs) -> Ordering

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AbsOrd for f32

Source§

fn abs_cmp(&self, rhs: &f32) -> Ordering

Source§

impl AbsOrd for f64

Source§

fn abs_cmp(&self, rhs: &f64) -> Ordering

Source§

impl AbsOrd for i8

Source§

fn abs_cmp(&self, rhs: &i8) -> Ordering

Source§

impl AbsOrd for i16

Source§

fn abs_cmp(&self, rhs: &i16) -> Ordering

Source§

impl AbsOrd for i32

Source§

fn abs_cmp(&self, rhs: &i32) -> Ordering

Source§

impl AbsOrd for i64

Source§

fn abs_cmp(&self, rhs: &i64) -> Ordering

Source§

impl AbsOrd for i128

Source§

fn abs_cmp(&self, rhs: &i128) -> Ordering

Source§

impl AbsOrd for isize

Source§

fn abs_cmp(&self, rhs: &isize) -> Ordering

Implementors§