@@ -5,6 +5,7 @@ use alloc::vec::Vec;
55use bitflags:: bitflags;
66use core:: borrow:: { Borrow , BorrowMut } ;
77use core:: default:: Default ;
8+ use core:: fmt;
89use core:: ops:: { Add , Deref , Index , IndexMut } ;
910use derive_try_from_primitive:: TryFromPrimitive ;
1011use ux;
@@ -142,8 +143,9 @@ impl Add<usize> for Guest4LevelPagingAddr {
142143 }
143144}
144145
145- #[ derive( PartialEq , Eq , PartialOrd , Ord , Copy , Clone , Debug ) ]
146+ #[ derive( PartialEq , Eq , PartialOrd , Ord , Copy , Clone ) ]
146147pub struct GuestPhysAddr ( u64 ) ;
148+
147149impl GuestPhysAddr {
148150 pub fn new ( addr : u64 ) -> Self {
149151 Self ( addr)
@@ -182,8 +184,17 @@ impl Add<usize> for GuestPhysAddr {
182184 }
183185}
184186
185- #[ derive( PartialEq , Eq , PartialOrd , Ord , Copy , Clone , Debug ) ]
187+ impl fmt:: Debug for GuestPhysAddr {
188+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
189+ f. debug_tuple ( "GuestPhysAddr" )
190+ . field ( & format_args ! ( "0x{:x}" , self . 0 ) )
191+ . finish ( )
192+ }
193+ }
194+
195+ #[ derive( PartialEq , Eq , PartialOrd , Ord , Copy , Clone ) ]
186196pub struct HostPhysAddr ( u64 ) ;
197+
187198impl HostPhysAddr {
188199 pub fn new ( addr : u64 ) -> Self {
189200 Self ( addr)
@@ -198,6 +209,14 @@ impl HostPhysAddr {
198209 }
199210}
200211
212+ impl fmt:: Debug for HostPhysAddr {
213+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
214+ f. debug_tuple ( "HostPhysAddr" )
215+ . field ( & format_args ! ( "0x{:x}" , self . 0 ) )
216+ . finish ( )
217+ }
218+ }
219+
201220#[ derive( PartialEq , Eq , PartialOrd , Ord , Copy , Clone , Debug ) ]
202221pub struct HostPhysFrame ( HostPhysAddr ) ;
203222impl HostPhysFrame {
0 commit comments