(index<- ) ./libstd/owned.rs
git branch: * master c7553ea auto merge of #13609 : richo/rust/str-type-vim, r=alexcrichton
modified: Wed Mar 26 11:50:03 2014
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 /// A value that represents the global exchange heap. This is the default
16 /// place that the `box` keyword allocates into when no place is supplied.
17 ///
18 /// The following two examples are equivalent:
19 ///
20 /// let foo = box(HEAP) Bar::new(...);
21 /// let foo = box Bar::new(...);
22 #[lang="exchange_heap"]
23 #[cfg(not(test))]
24 pub static HEAP: () = ();
25
26 #[cfg(test)]
27 pub static HEAP: () = ();
28
29 #[cfg(not(test))]
30 impl<T:Eq> Eq for ~T {
31 #[inline]
32 fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
33 #[inline]
34 fn ne(&self, other: &~T) -> bool { *(*self) != *(*other) }
35 }
36
37 #[cfg(not(test))]
38 impl<T:Ord> Ord for ~T {
39 #[inline]
40 fn lt(&self, other: &~T) -> bool { *(*self) < *(*other) }
41 #[inline]
42 fn le(&self, other: &~T) -> bool { *(*self) <= *(*other) }
43 #[inline]
44 fn ge(&self, other: &~T) -> bool { *(*self) >= *(*other) }
45 #[inline]
46 fn gt(&self, other: &~T) -> bool { *(*self) > *(*other) }
47 }
48
49 #[cfg(not(test))]
50 impl<T: TotalOrd> TotalOrd for ~T {
51 #[inline]
52 fn cmp(&self, other: &~T) -> Ordering { (**self).cmp(*other) }
53 }
54
55 #[cfg(not(test))]
56 impl<T: TotalEq> TotalEq for ~T {}