@@ -444,6 +444,17 @@ impl<'a> Binding for DiffDelta<'a> {
444
444
}
445
445
}
446
446
447
+ impl < ' a > std:: fmt:: Debug for DiffDelta < ' a > {
448
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> Result < ( ) , std:: fmt:: Error > {
449
+ f. debug_struct ( "DiffDelta" )
450
+ . field ( "nfiles" , & self . nfiles ( ) )
451
+ . field ( "status" , & self . status ( ) )
452
+ . field ( "old_file" , & self . old_file ( ) )
453
+ . field ( "new_file" , & self . new_file ( ) )
454
+ . finish ( )
455
+ }
456
+ }
457
+
447
458
impl < ' a > DiffFile < ' a > {
448
459
/// Returns the Oid of this item.
449
460
///
@@ -487,6 +498,20 @@ impl<'a> Binding for DiffFile<'a> {
487
498
}
488
499
}
489
500
501
+ impl < ' a > std:: fmt:: Debug for DiffFile < ' a > {
502
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> Result < ( ) , std:: fmt:: Error > {
503
+ let mut ds = f. debug_struct ( "DiffFile" ) ;
504
+ ds. field ( "id" , & self . id ( ) ) ;
505
+ if let Some ( path_bytes) = & self . path_bytes ( ) {
506
+ ds. field ( "path_bytes" , path_bytes) ;
507
+ }
508
+ if let Some ( path) = & self . path ( ) {
509
+ ds. field ( "path" , path) ;
510
+ }
511
+ ds. field ( "size" , & self . size ( ) ) . finish ( )
512
+ }
513
+ }
514
+
490
515
impl Default for DiffOptions {
491
516
fn default ( ) -> Self {
492
517
Self :: new ( )
@@ -863,6 +888,23 @@ impl<'a> Binding for DiffLine<'a> {
863
888
}
864
889
}
865
890
891
+ impl < ' a > std:: fmt:: Debug for DiffLine < ' a > {
892
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> Result < ( ) , std:: fmt:: Error > {
893
+ let mut ds = f. debug_struct ( "DiffLine" ) ;
894
+ if let Some ( old_lineno) = & self . old_lineno ( ) {
895
+ ds. field ( "old_lineno" , old_lineno) ;
896
+ }
897
+ if let Some ( new_lineno) = & self . new_lineno ( ) {
898
+ ds. field ( "new_lineno" , new_lineno) ;
899
+ }
900
+ ds. field ( "num_lines" , & self . num_lines ( ) )
901
+ . field ( "content_offset" , & self . content_offset ( ) )
902
+ . field ( "content" , & self . content ( ) )
903
+ . field ( "origin" , & self . origin ( ) )
904
+ . finish ( )
905
+ }
906
+ }
907
+
866
908
impl < ' a > DiffHunk < ' a > {
867
909
/// Starting line number in old_file
868
910
pub fn old_start ( & self ) -> u32 {
@@ -908,6 +950,18 @@ impl<'a> Binding for DiffHunk<'a> {
908
950
}
909
951
}
910
952
953
+ impl < ' a > std:: fmt:: Debug for DiffHunk < ' a > {
954
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> Result < ( ) , std:: fmt:: Error > {
955
+ f. debug_struct ( "DiffHunk" )
956
+ . field ( "old_start" , & self . old_start ( ) )
957
+ . field ( "old_lines" , & self . old_lines ( ) )
958
+ . field ( "new_start" , & self . new_start ( ) )
959
+ . field ( "new_lines" , & self . new_lines ( ) )
960
+ . field ( "header" , & self . header ( ) )
961
+ . finish ( )
962
+ }
963
+ }
964
+
911
965
impl DiffStats {
912
966
/// Get the total number of files chaned in a diff.
913
967
pub fn files_changed ( & self ) -> usize {
@@ -956,6 +1010,16 @@ impl Drop for DiffStats {
956
1010
}
957
1011
}
958
1012
1013
+ impl std:: fmt:: Debug for DiffStats {
1014
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> Result < ( ) , std:: fmt:: Error > {
1015
+ f. debug_struct ( "DiffStats" )
1016
+ . field ( "files_changed" , & self . files_changed ( ) )
1017
+ . field ( "insertions" , & self . insertions ( ) )
1018
+ . field ( "deletions" , & self . deletions ( ) )
1019
+ . finish ( )
1020
+ }
1021
+ }
1022
+
959
1023
impl < ' a > DiffBinary < ' a > {
960
1024
/// Returns whether there is data in this binary structure or not.
961
1025
///
0 commit comments