Skip to content

Commit 2b859d2

Browse files
committed
Debug for CandidateKey
1 parent 5aee9fc commit 2b859d2

File tree

1 file changed

+9
-11
lines changed
  • toolkit/sidechain/domain/src

1 file changed

+9
-11
lines changed

toolkit/sidechain/domain/src/lib.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,17 +1178,7 @@ impl DParameter {
11781178

11791179
/// Opaque key bytes with a 4 bytes identifier
11801180
#[derive(
1181-
Debug,
1182-
Clone,
1183-
PartialEq,
1184-
Eq,
1185-
Decode,
1186-
DecodeWithMemTracking,
1187-
Encode,
1188-
TypeInfo,
1189-
PartialOrd,
1190-
Ord,
1191-
Hash,
1181+
Clone, PartialEq, Eq, Decode, DecodeWithMemTracking, Encode, TypeInfo, PartialOrd, Ord, Hash,
11921182
)]
11931183
#[cfg_attr(feature = "serde", derive(Serialize))]
11941184
pub struct CandidateKey {
@@ -1198,6 +1188,14 @@ pub struct CandidateKey {
11981188
pub bytes: Vec<u8>,
11991189
}
12001190

1191+
impl alloc::fmt::Debug for CandidateKey {
1192+
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
1193+
let id = hex::encode(self.id);
1194+
let bytes = hex::encode(&self.bytes);
1195+
f.write_str(&alloc::format!("CandidateKey {{ id: {id}, bytes: {bytes} }}"))
1196+
}
1197+
}
1198+
12011199
impl FromStr for CandidateKey {
12021200
type Err = &'static str;
12031201

0 commit comments

Comments
 (0)