(index<- ) ./libcore/unit.rs
git branch: * master 5200215 auto merge of #14035 : alexcrichton/rust/experimental, r=huonw
modified: Fri May 9 13:02:28 2014
1 // Copyright 2012-2013 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 //! Functions for the unit type.
12
13 #[cfg(not(test))]
14 use default::Default;
15 #[cfg(not(test))]
16 use cmp::{Eq, Equal, Ord, Ordering, TotalEq, TotalOrd};
17
18 #[cfg(not(test))]
19 impl Eq for () {
20 #[inline]
21 fn eq(&self, _other: &()) -> bool { true }
22 #[inline]
23 fn ne(&self, _other: &()) -> bool { false }
24 }
25
26 #[cfg(not(test))]
27 impl Ord for () {
28 #[inline]
29 fn lt(&self, _other: &()) -> bool { false }
30 }
31
32 #[cfg(not(test))]
33 impl TotalOrd for () {
34 #[inline]
35 fn cmp(&self, _other: &()) -> Ordering { Equal }
36 }
37
38 #[cfg(not(test))]
39 impl TotalEq for () {}
40
41 #[cfg(not(test))]
42 impl Default for () {
43 #[inline]
44 fn default() -> () { () }
45 }