]> git.lizzy.rs Git - rust.git/blob - src/libstd/unit.rs
auto merge of #11304 : alexcrichton/rust/eintr, r=brson
[rust.git] / src / libstd / unit.rs
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 prelude::*;
15 #[cfg(not(test))]
16 use num::Zero;
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     #[inline]
41     fn equals(&self, _other: &()) -> bool { true }
42 }
43
44 #[cfg(not(test))]
45 impl Default for () {
46     #[inline]
47     fn default() -> () { () }
48 }
49
50 #[cfg(not(test))]
51 impl Zero for () {
52     #[inline]
53     fn zero() -> () { () }
54     #[inline]
55     fn is_zero(&self) -> bool { true }
56 }