1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use Cherry;
use Ordering;
use Debug;
///
/// impl PartialOrd for Cherry<T>
///
/// Implementation of `lhs.partial_cmp(&rhs)` (`lhs: &Cherry<T>, rhs: &Cherry<T>`), where `T: PartialOrd`.
/// Provides comparison operators for `Cherry<T>`.
///
/// # Examples
///
/// ```
/// extern crate cherries;
/// extern crate uom;
/// use cherries::node::{Leaf, Node};
/// use uom::si::f32::*;
/// use uom::si::length::meter;
/// use std::cmp::Ordering;
///
/// let x = Leaf::new().value(Length::new::<meter>(2.0)).name("x").build();
/// let y = Leaf::new().value(Length::new::<meter>(2.1)).name("y").build();
/// assert_eq!(x.partial_cmp(&y), Some(Ordering::Less));
/// assert_eq!(y.partial_cmp(&x), Some(Ordering::Greater));
/// assert_eq!(x.partial_cmp(&x), Some(Ordering::Equal));
/// assert_eq!(x < y, true);
/// assert_eq!(y < x, false);
/// assert_eq!(x > y, false);
/// assert_eq!(y > x, true);
/// assert_eq!(x == x, true);
/// ```