diff --git a/src/hash.rs b/src/hash.rs index a59813612..f9c43024c 100644 --- a/src/hash.rs +++ b/src/hash.rs @@ -30,6 +30,7 @@ pub trait FixedHash: Sized + BytesConvertable { fn bloom_part(&self, m: usize) -> T where T: FixedHash; fn contains_bloom(&self, b: &T) -> bool where T: FixedHash; fn contains<'a>(&'a self, b: &'a Self) -> bool; + fn is_zero(&self) -> bool; } macro_rules! impl_hash { @@ -165,6 +166,10 @@ macro_rules! impl_hash { fn contains<'a>(&'a self, b: &'a Self) -> bool { &(b & self) == b } + + fn is_zero(&self) -> bool { + self.eq(&Self::new()) + } } impl FromStr for $from {