[json-rpc] display BytesView as hex
Reduce debug noise by displaying BytesView as a hex string.
`println!("{:#?}", BytesView::new(&[48, 49, 50, 51, 52, 53]))`
previously:
```
BytesView([
48,
49,
50,
51,
52,
53
])
```
now: `BytesView("30313233343536")`
@@ -444,7 +444,7 @@ pub struct MetadataView {
pub dual_attestation_limit: Option<u64>,
}
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, PartialEq)]
pub struct BytesView(Box<[u8]>);
impl BytesView {
@@ -480,11 +480,16 @@ impl std::fmt::Display for BytesView {
for byte in self.inner() {
write!(f, "{:02x}", byte)?;
}
-
Ok(())
}
}
+impl std::fmt::Debug for BytesView {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ write!(f, "BytesView(\"{}\")", self)
+ }
+}
+
impl From<&[u8]> for BytesView {
fn from(bytes: &[u8]) -> Self {
Self(bytes.into())
