mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +00:00
Compare digests item-by-item (#869)
* compare digest item-by-item * update comment
This commit is contained in:
committed by
Gav Wood
parent
4d18c50e67
commit
187c232629
@@ -333,6 +333,24 @@ impl CheckEqual for substrate_primitives::H256 {
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> CheckEqual for I where I: DigestItem {
|
||||
#[cfg(feature = "std")]
|
||||
fn check_equal(&self, other: &Self) {
|
||||
if self != other {
|
||||
println!("DigestItem: given={:?}, expected={:?}", self, other);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn check_equal(&self, other: &Self) {
|
||||
if self != other {
|
||||
runtime_io::print("DigestItem not equal");
|
||||
runtime_io::print(&Encode::encode(self)[..]);
|
||||
runtime_io::print(&Encode::encode(other)[..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub trait MaybeSerializeDebugButNotDeserialize: Serialize + Debug {}
|
||||
#[cfg(feature = "std")]
|
||||
@@ -491,7 +509,7 @@ pub trait Digest: Member + Default {
|
||||
/// for casting member to 'system' log items, known to substrate.
|
||||
///
|
||||
/// If the runtime does not supports some 'system' items, use `()` as a stub.
|
||||
pub trait DigestItem: Member {
|
||||
pub trait DigestItem: Codec + Member {
|
||||
type Hash: Member;
|
||||
type AuthorityId: Member;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user