diff options
| author | Stepan Koltsov <stepan.koltsov@gmail.com> | 2013-07-31 18:19:26 +0400 |
|---|---|---|
| committer | Stepan Koltsov <stepan.koltsov@gmail.com> | 2013-07-31 18:19:26 +0400 |
| commit | a5912736be38ff10e41b475634119f83b937a072 (patch) | |
| tree | c8d2d49e470bfd3baae220bf5c5869c6e6a9c076 /src/libstd | |
| parent | 6296dc0d73527301f18ef55b5f2d07c3241b8a00 (diff) | |
| download | rust-a5912736be38ff10e41b475634119f83b937a072.tar.gz rust-a5912736be38ff10e41b475634119f83b937a072.zip | |
Implement Zero for unit
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/nil.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libstd/nil.rs b/src/libstd/nil.rs index 40f6d53ed22..81b7662e581 100644 --- a/src/libstd/nil.rs +++ b/src/libstd/nil.rs @@ -16,6 +16,10 @@ Functions for the unit type. #[cfg(not(test))] use prelude::*; +#[cfg(not(test))] +use num::Zero; + + #[cfg(not(test))] impl Eq for () { @@ -48,3 +52,10 @@ impl TotalEq for () { #[inline] fn equals(&self, _other: &()) -> bool { true } } + +#[cfg(not(test))] +impl Zero for () { + fn zero() -> () { () } + fn is_zero(&self) -> bool { true } +} + |
