]> git.lizzy.rs Git - rust.git/blob - src/libstd/owned.rs
auto merge of #10977 : brson/rust/androidtest, r=brson
[rust.git] / src / libstd / owned.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Operations on unique pointer types
12
13 #[cfg(not(test))] use cmp::*;
14
15 #[cfg(not(test))]
16 impl<T:Eq> Eq for ~T {
17     #[inline]
18     fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
19     #[inline]
20     fn ne(&self, other: &~T) -> bool { *(*self) != *(*other) }
21 }
22
23 #[cfg(not(test))]
24 impl<T:Ord> Ord for ~T {
25     #[inline]
26     fn lt(&self, other: &~T) -> bool { *(*self) < *(*other) }
27     #[inline]
28     fn le(&self, other: &~T) -> bool { *(*self) <= *(*other) }
29     #[inline]
30     fn ge(&self, other: &~T) -> bool { *(*self) >= *(*other) }
31     #[inline]
32     fn gt(&self, other: &~T) -> bool { *(*self) > *(*other) }
33 }
34
35 #[cfg(not(test))]
36 impl<T: TotalOrd> TotalOrd for ~T {
37     #[inline]
38     fn cmp(&self, other: &~T) -> Ordering { (**self).cmp(*other) }
39 }
40
41 #[cfg(not(test))]
42 impl<T: TotalEq> TotalEq for ~T {
43     #[inline]
44     fn equals(&self, other: &~T) -> bool { (**self).equals(*other) }
45 }