impl MaybeEmpty for H256 and u64 (aka AccountId in prod/tests) (#665)

* impl MaybeEmpty for H256 and u64 (aka AccountId in prod/tests)

* binaries
This commit is contained in:
David
2018-09-05 22:51:11 +02:00
committed by Gav Wood
parent b50196b389
commit 07a59621cc
@@ -112,9 +112,17 @@ pub trait MaybeEmpty {
fn is_empty(&self) -> bool;
}
impl<T: Default + PartialEq> MaybeEmpty for T {
// AccountId is `u64` in tests
impl MaybeEmpty for u64 {
fn is_empty(&self) -> bool {
*self == T::default()
self.is_zero()
}
}
// AccountId is H256 in production
impl MaybeEmpty for substrate_primitives::H256 {
fn is_empty(&self) -> bool {
self.is_zero()
}
}