Skip to content

Commit 23fec31

Browse files
committed
Debug for CandidateKey
1 parent 7cc364d commit 23fec31

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
@@ -1189,17 +1189,7 @@ impl DParameter {
11891189

11901190
/// Opaque key bytes with a 4 bytes identifier
11911191
#[derive(
1192-
Debug,
1193-
Clone,
1194-
PartialEq,
1195-
Eq,
1196-
Decode,
1197-
DecodeWithMemTracking,
1198-
Encode,
1199-
TypeInfo,
1200-
PartialOrd,
1201-
Ord,
1202-
Hash,
1192+
Clone, PartialEq, Eq, Decode, DecodeWithMemTracking, Encode, TypeInfo, PartialOrd, Ord, Hash,
12031193
)]
12041194
#[cfg_attr(feature = "serde", derive(Serialize))]
12051195
pub struct CandidateKey {
@@ -1209,6 +1199,14 @@ pub struct CandidateKey {
12091199
pub bytes: Vec<u8>,
12101200
}
12111201

1202+
impl alloc::fmt::Debug for CandidateKey {
1203+
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
1204+
let id = hex::encode(self.id);
1205+
let bytes = hex::encode(&self.bytes);
1206+
f.write_str(&alloc::format!("CandidateKey {{ id: {id}, bytes: {bytes} }}"))
1207+
}
1208+
}
1209+
12121210
impl FromStr for CandidateKey {
12131211
type Err = &'static str;
12141212

0 commit comments

Comments
 (0)