about summary refs log tree commit diff
path: root/src/libcore/uniq.rs
blob: f1842686ae15e3a177c9264e872d3fc53cde3da3 (plain)
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
//! Operations on unique pointer types

use cmp::{Eq, Ord};

#[cfg(stage0)]
impl<T:Eq> ~const T : Eq {
    pure fn eq(&&other: ~const T) -> bool { *self == *other }
    pure fn ne(&&other: ~const T) -> bool { *self != *other }
}
#[cfg(stage1)]
#[cfg(stage2)]
impl<T:Eq> ~const T : Eq {
    pure fn eq(other: &~const T) -> bool { *self == *(*other) }
    pure fn ne(other: &~const T) -> bool { *self != *(*other) }
}

#[cfg(stage0)]
impl<T:Ord> ~const T : Ord {
    pure fn lt(&&other: ~const T) -> bool { *self < *other }
    pure fn le(&&other: ~const T) -> bool { *self <= *other }
    pure fn ge(&&other: ~const T) -> bool { *self >= *other }
    pure fn gt(&&other: ~const T) -> bool { *self > *other }
}
#[cfg(stage1)]
#[cfg(stage2)]
impl<T:Ord> ~const T : Ord {
    pure fn lt(other: &~const T) -> bool { *self < *(*other) }
    pure fn le(other: &~const T) -> bool { *self <= *(*other) }
    pure fn ge(other: &~const T) -> bool { *self >= *(*other) }
    pure fn gt(other: &~const T) -> bool { *self > *(*other) }
}