diff rust/hg-core/src/dirstate_tree/on_disk.rs @ 49125:28a6178a07a2

rust: add `Debug` trait to a bunch of structs This is useful when... debugging. Right now the output is not in the most readable state it could be, but this is very low effort and is good enough for now. We may want to write a nicer custom debug formatter for some of those structs in the future. Differential Revision: https://phab.mercurial-scm.org/D12523
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 29 Mar 2022 17:27:36 +0200
parents 38e5bb1425dd
children 3f5e207f78be
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs	Wed Mar 30 11:39:53 2022 +0200
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs	Tue Mar 29 17:27:36 2022 +0200
@@ -84,7 +84,7 @@
 
 /// Fields are documented in the *The data file format*
 /// section of `mercurial/helptext/internals/dirstate-v2.txt`
-#[derive(BytesCast)]
+#[derive(BytesCast, Debug)]
 #[repr(C)]
 pub(super) struct Node {
     full_path: PathSlice,
@@ -124,7 +124,7 @@
 }
 
 /// Duration since the Unix epoch
-#[derive(BytesCast, Copy, Clone)]
+#[derive(BytesCast, Copy, Clone, Debug)]
 #[repr(C)]
 struct PackedTruncatedTimestamp {
     truncated_seconds: U32Be,
@@ -152,7 +152,7 @@
 /// Always sorted by ascending `full_path`, to allow binary search.
 /// Since nodes with the same parent nodes also have the same parent path,
 /// only the `base_name`s need to be compared during binary search.
-#[derive(BytesCast, Copy, Clone)]
+#[derive(BytesCast, Copy, Clone, Debug)]
 #[repr(C)]
 struct ChildNodes {
     start: Offset,
@@ -160,7 +160,7 @@
 }
 
 /// A `HgPath` of `len` bytes
-#[derive(BytesCast, Copy, Clone)]
+#[derive(BytesCast, Copy, Clone, Debug)]
 #[repr(C)]
 struct PathSlice {
     start: Offset,