2012-08-13 19:11:33 -05:00
|
|
|
// NB: transitionary, de-mode-ing.
|
|
|
|
#[forbid(deprecated_mode)];
|
|
|
|
#[forbid(deprecated_pattern)];
|
|
|
|
|
2012-07-04 16:53:12 -05:00
|
|
|
/// Interfaces used for comparison.
|
2012-06-06 16:19:52 -05:00
|
|
|
|
2012-08-13 18:20:27 -05:00
|
|
|
trait Ord {
|
2012-07-26 16:42:44 -05:00
|
|
|
pure fn lt(&&other: self) -> bool;
|
2012-06-06 16:19:52 -05:00
|
|
|
}
|
|
|
|
|
2012-08-13 18:20:27 -05:00
|
|
|
trait Eq {
|
2012-07-26 16:42:44 -05:00
|
|
|
pure fn eq(&&other: self) -> bool;
|
2012-06-06 16:19:52 -05:00
|
|
|
}
|
|
|
|
|
2012-08-13 18:20:27 -05:00
|
|
|
pure fn lt<T: Ord>(v1: &T, v2: &T) -> bool {
|
2012-08-02 17:42:56 -05:00
|
|
|
v1.lt(*v2)
|
|
|
|
}
|
|
|
|
|
2012-08-13 18:20:27 -05:00
|
|
|
pure fn le<T: Ord Eq>(v1: &T, v2: &T) -> bool {
|
2012-08-02 17:42:56 -05:00
|
|
|
v1.lt(*v2) || v1.eq(*v2)
|
|
|
|
}
|
|
|
|
|
2012-08-13 18:20:27 -05:00
|
|
|
pure fn eq<T: Eq>(v1: &T, v2: &T) -> bool {
|
2012-08-02 17:42:56 -05:00
|
|
|
v1.eq(*v2)
|
|
|
|
}
|