is_zero for hash types
This commit is contained in:
parent
647ea286ba
commit
49d97d7cb3
@ -30,6 +30,7 @@ pub trait FixedHash: Sized + BytesConvertable {
|
|||||||
fn bloom_part<T>(&self, m: usize) -> T where T: FixedHash;
|
fn bloom_part<T>(&self, m: usize) -> T where T: FixedHash;
|
||||||
fn contains_bloom<T>(&self, b: &T) -> bool where T: FixedHash;
|
fn contains_bloom<T>(&self, b: &T) -> bool where T: FixedHash;
|
||||||
fn contains<'a>(&'a self, b: &'a Self) -> bool;
|
fn contains<'a>(&'a self, b: &'a Self) -> bool;
|
||||||
|
fn is_zero(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! impl_hash {
|
macro_rules! impl_hash {
|
||||||
@ -165,6 +166,10 @@ macro_rules! impl_hash {
|
|||||||
fn contains<'a>(&'a self, b: &'a Self) -> bool {
|
fn contains<'a>(&'a self, b: &'a Self) -> bool {
|
||||||
&(b & self) == b
|
&(b & self) == b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_zero(&self) -> bool {
|
||||||
|
self.eq(&Self::new())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for $from {
|
impl FromStr for $from {
|
||||||
|
Loading…
Reference in New Issue
Block a user