##// END OF EJS Templates
node: manually implement Debug...
Augie Fackler -
r50070:34decbaf default
parent child Browse files
Show More
@@ -53,12 +53,21 b' type NodeData = [u8; NODE_BYTES_LENGTH];'
53 /// the size or return an error at runtime.
53 /// the size or return an error at runtime.
54 ///
54 ///
55 /// [`nybbles_len`]: #method.nybbles_len
55 /// [`nybbles_len`]: #method.nybbles_len
56 #[derive(Copy, Clone, Debug, PartialEq, BytesCast, derive_more::From)]
56 #[derive(Copy, Clone, PartialEq, BytesCast, derive_more::From)]
57 #[repr(transparent)]
57 #[repr(transparent)]
58 pub struct Node {
58 pub struct Node {
59 data: NodeData,
59 data: NodeData,
60 }
60 }
61
61
62 impl fmt::Debug for Node {
63 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
64 let n = format!("{:x?}", self.data);
65 // We're using debug_tuple because it makes the output a little
66 // more compact without losing data.
67 f.debug_tuple("Node").field(&n).finish()
68 }
69 }
70
62 /// The node value for NULL_REVISION
71 /// The node value for NULL_REVISION
63 pub const NULL_NODE: Node = Node {
72 pub const NULL_NODE: Node = Node {
64 data: [0; NODE_BYTES_LENGTH],
73 data: [0; NODE_BYTES_LENGTH],
General Comments 0
You need to be logged in to leave comments. Login now