From a5912736be38ff10e41b475634119f83b937a072 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 31 Jul 2013 18:19:26 +0400 Subject: Implement Zero for unit --- src/libstd/nil.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/libstd') 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 } +} + -- cgit 1.4.1-3-g733a5