Trait rbatis::PartialOrd[][src]

pub trait PartialOrd<Rhs = Self> where
    Rhs: ?Sized
{ fn op_partial_cmp(&self, other: &Rhs) -> Option<Ordering>; fn op_lt(&self, other: &Rhs) -> bool { ... }
fn op_le(&self, other: &Rhs) -> bool { ... }
fn op_gt(&self, other: &Rhs) -> bool { ... }
fn op_ge(&self, other: &Rhs) -> bool { ... } }

Required methods

This method returns an ordering between self and other values if one exists.

Examples
use std::cmp::Ordering;

let result = 1.0.op_partial_cmp(&2.0);
assert_eq!(result, Some(Ordering::Less));

let result = 1.0.op_partial_cmp(&1.0);
assert_eq!(result, Some(Ordering::Equal));

let result = 2.0.op_partial_cmp(&1.0);
assert_eq!(result, Some(Ordering::Greater));

When comparison is impossible:

let result = f64::NAN.op_partial_cmp(&1.0);
assert_eq!(result, None);

Provided methods

This method tests less than (for self and other) and is used by the < operator.

Examples
let result = 1.0 < 2.0;
assert_eq!(result, true);

let result = 2.0 < 1.0;
assert_eq!(result, false);

This method tests less than or equal to (for self and other) and is used by the <= operator.

Examples
let result = 1.0 <= 2.0;
assert_eq!(result, true);

let result = 2.0 <= 2.0;
assert_eq!(result, true);

This method tests greater than (for self and other) and is used by the > operator.

Examples
let result = 1.0 > 2.0;
assert_eq!(result, false);

let result = 2.0 > 2.0;
assert_eq!(result, false);

This method tests greater than or equal to (for self and other) and is used by the >= operator.

Examples
let result = 2.0 >= 1.0;
assert_eq!(result, true);

let result = 2.0 >= 2.0;
assert_eq!(result, true);

Implementations on Foreign Types

Implementors