[Updated] D12608: node: manually implement Debug
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Mon May 9 15:53:18 UTC 2022
Closed by commit rHG312e01ef6d77: node: manually implement Debug (authored by durin42).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D12608?vs=33360&id=33383
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D12608/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D12608
AFFECTED FILES
rust/hg-core/src/revlog/node.rs
CHANGE DETAILS
diff --git a/rust/hg-core/src/revlog/node.rs b/rust/hg-core/src/revlog/node.rs
--- a/rust/hg-core/src/revlog/node.rs
+++ b/rust/hg-core/src/revlog/node.rs
@@ -53,12 +53,21 @@
/// the size or return an error at runtime.
///
/// [`nybbles_len`]: #method.nybbles_len
-#[derive(Copy, Clone, Debug, PartialEq, BytesCast, derive_more::From)]
+#[derive(Copy, Clone, PartialEq, BytesCast, derive_more::From)]
#[repr(transparent)]
pub struct Node {
data: NodeData,
}
+impl fmt::Debug for Node {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let n = format!("{:x?}", self.data);
+ // We're using debug_tuple because it makes the output a little
+ // more compact without losing data.
+ f.debug_tuple("Node").field(&n).finish()
+ }
+}
+
/// The node value for NULL_REVISION
pub const NULL_NODE: Node = Node {
data: [0; NODE_BYTES_LENGTH],
To: durin42, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220509/ed49aed0/attachment-0002.html>
More information about the Mercurial-patches
mailing list