2012-07-04 16:53:12 -05:00
|
|
|
/// Interfaces used for comparison.
|
2012-06-06 16:19:52 -05:00
|
|
|
|
2012-07-26 16:42:44 -05:00
|
|
|
trait ord {
|
|
|
|
pure fn lt(&&other: self) -> bool;
|
2012-06-06 16:19:52 -05:00
|
|
|
}
|
|
|
|
|
2012-07-26 16:42:44 -05:00
|
|
|
trait eq {
|
|
|
|
pure fn eq(&&other: self) -> bool;
|
2012-06-06 16:19:52 -05:00
|
|
|
}
|
|
|
|
|
2012-08-02 17:42:56 -05:00
|
|
|
pure fn lt<T: ord>(v1: &T, v2: &T) -> bool {
|
|
|
|
v1.lt(*v2)
|
|
|
|
}
|
|
|
|
|
|
|
|
pure fn le<T: ord eq>(v1: &T, v2: &T) -> bool {
|
|
|
|
v1.lt(*v2) || v1.eq(*v2)
|
|
|
|
}
|
|
|
|
|
|
|
|
pure fn eq<T: eq>(v1: &T, v2: &T) -> bool {
|
|
|
|
v1.eq(*v2)
|
|
|
|
}
|