Skip to content
Snippets Groups Projects
Commit 07a59621 authored by David's avatar David Committed by Gav Wood
Browse files

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

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

* binaries
parent b50196b3
No related merge requests found
......@@ -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()
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment