pub trait PartialOrd<Rhs: ?Sized = Self> {
    // Required method
    fn op_partial_cmp(&self, other: &Rhs) -> Option<Ordering>;

    // Provided methods
    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§

source

fn op_partial_cmp(&self, other: &Rhs) -> Option<Ordering>

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

Examples


use std::cmp::Ordering;
use rbatis_codegen::ops::PartialOrd;
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:

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

Provided Methods§

source

fn op_lt(&self, other: &Rhs) -> bool

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);
source

fn op_le(&self, other: &Rhs) -> bool

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);
source

fn op_gt(&self, other: &Rhs) -> bool

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);
source

fn op_ge(&self, other: &Rhs) -> bool

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§

source§

impl PartialOrd<&isize> for isize

source§

impl PartialOrd<i32> for i32

source§

impl PartialOrd<i64> for i64

source§

impl PartialOrd<f64> for Value

source§

impl<'a> PartialOrd<bool> for &'a Value

source§

impl PartialOrd<&u64> for u64

source§

impl PartialOrd<&u8> for u8

source§

impl PartialOrd<f32> for &f32

source§

impl PartialOrd<Value> for &Value

source§

impl PartialOrd<f64> for f64

source§

impl PartialOrd<Value> for i64

source§

impl PartialOrd<isize> for Value

source§

impl PartialOrd<f64> for &f64

source§

impl<'a> PartialOrd<f32> for &'a Value

source§

impl PartialOrd<&&Value> for i8

source§

impl PartialOrd<i8> for i8

source§

impl PartialOrd<u8> for Value

source§

impl PartialOrd<&Value> for i64

source§

impl PartialOrd<bool> for Value

source§

impl<'a> PartialOrd<i64> for &'a Value

source§

impl PartialOrd<&str> for &str

source§

impl PartialOrd<Value> for f32

source§

impl PartialOrd<Value> for u64

source§

impl PartialOrd<&Value> for Value

source§

impl PartialOrd<&&Value> for f32

source§

impl PartialOrd<&i16> for i16

source§

impl<'a> PartialOrd<i16> for &'a Value

source§

impl PartialOrd<Value> for u16

source§

impl PartialOrd<&&Value> for isize

source§

impl PartialOrd<&Value> for isize

source§

impl PartialOrd<u8> for u8

source§

impl PartialOrd<&i8> for &i8

source§

impl<'a> PartialOrd<u16> for &'a Value

source§

impl PartialOrd<&u32> for &u32

source§

impl PartialOrd<&Value> for &Value

source§

impl PartialOrd<&u64> for &u64

source§

impl PartialOrd<u16> for Value

source§

impl PartialOrd<u32> for u32

source§

impl PartialOrd<i16> for Value

source§

impl PartialOrd<&i64> for i64

source§

impl PartialOrd<i64> for &i64

source§

impl PartialOrd<&isize> for &isize

source§

impl<'a> PartialOrd<u8> for &'a Value

source§

impl PartialOrd<u32> for Value

source§

impl PartialOrd<i8> for &i8

source§

impl PartialOrd<u16> for u16

source§

impl PartialOrd<&u16> for u16

source§

impl PartialOrd<u64> for &u64

source§

impl PartialOrd<Value> for u32

source§

impl PartialOrd<&&Value> for &Value

source§

impl<'a> PartialOrd<u32> for &'a Value

source§

impl PartialOrd<Value> for &str

source§

impl PartialOrd<&&Value> for Value

source§

impl PartialOrd<&Value> for i16

source§

impl PartialOrd<&&Value> for bool

source§

impl PartialOrd<&Value> for u8

source§

impl PartialOrd<&Value> for u16

source§

impl PartialOrd<Value> for isize

source§

impl PartialOrd<String> for &String

source§

impl PartialOrd<&Value> for i32

source§

impl PartialOrd<&i32> for &i32

source§

impl PartialOrd<&f32> for f32

source§

impl<'a> PartialOrd<i8> for &'a Value

source§

impl PartialOrd<Value> for i32

source§

impl PartialOrd<&f64> for &f64

source§

impl PartialOrd<&Value> for f64

source§

impl PartialOrd<&Value> for &str

source§

impl<'a> PartialOrd<f64> for &'a Value

source§

impl PartialOrd<&&Value> for i32

source§

impl PartialOrd<Value> for f64

source§

impl PartialOrd<&Value> for bool

source§

impl PartialOrd<&f32> for &f32

source§

impl PartialOrd<&&Value> for i16

source§

impl PartialOrd<isize> for &isize

source§

impl<'a> PartialOrd<i32> for &'a Value

source§

impl PartialOrd<isize> for isize

source§

impl PartialOrd<i32> for Value

source§

impl PartialOrd<u8> for &u8

source§

impl PartialOrd<Value> for i8

source§

impl PartialOrd<f32> for f32

source§

impl PartialOrd<f32> for Value

source§

impl PartialOrd<&&Value> for u32

source§

impl PartialOrd<i16> for &i16

source§

impl PartialOrd<Value> for bool

source§

impl PartialOrd<&&Value> for u16

source§

impl<'a> PartialOrd<isize> for &'a Value

source§

impl PartialOrd<&Value> for f32

source§

impl PartialOrd<Value> for u8

source§

impl PartialOrd<&&Value> for f64

source§

impl PartialOrd<&i32> for i32

source§

impl PartialOrd<&u8> for &u8

source§

impl PartialOrd<&Value> for i8

source§

impl PartialOrd<&str> for &String

source§

impl<'a> PartialOrd<&str> for &'a Value

source§

impl PartialOrd<&str> for Value

source§

impl PartialOrd<u32> for &u32

source§

impl PartialOrd<&str> for String

source§

impl PartialOrd<&u16> for &u16

source§

impl PartialOrd<&i64> for &i64

source§

impl PartialOrd<u64> for Value

source§

impl PartialOrd<&u32> for u32

source§

impl PartialOrd<Value> for Value

source§

impl PartialOrd<&i8> for i8

source§

impl PartialOrd<String> for String

source§

impl PartialOrd<Value> for i16

source§

impl PartialOrd<&i16> for &i16

source§

impl PartialOrd<i32> for &i32

source§

impl PartialOrd<&&Value> for i64

source§

impl PartialOrd<&&Value> for u64

source§

impl PartialOrd<&f64> for f64

source§

impl PartialOrd<&&Value> for &str

source§

impl PartialOrd<u64> for u64

source§

impl<'a> PartialOrd<u64> for &'a Value

source§

impl PartialOrd<i8> for Value

source§

impl PartialOrd<&Value> for u32

source§

impl PartialOrd<&Value> for u64

source§

impl PartialOrd<u16> for &u16

source§

impl PartialOrd<i16> for i16

source§

impl PartialOrd<i64> for Value

source§

impl PartialOrd<&&Value> for u8

Implementors§