@@ -5,6 +5,7 @@ use alloc::vec::Vec;
5
5
use bitflags:: bitflags;
6
6
use core:: borrow:: { Borrow , BorrowMut } ;
7
7
use core:: default:: Default ;
8
+ use core:: fmt;
8
9
use core:: ops:: { Add , Deref , Index , IndexMut } ;
9
10
use derive_try_from_primitive:: TryFromPrimitive ;
10
11
use ux;
@@ -142,8 +143,9 @@ impl Add<usize> for Guest4LevelPagingAddr {
142
143
}
143
144
}
144
145
145
- #[ derive( PartialEq , Eq , PartialOrd , Ord , Copy , Clone , Debug ) ]
146
+ #[ derive( PartialEq , Eq , PartialOrd , Ord , Copy , Clone ) ]
146
147
pub struct GuestPhysAddr ( u64 ) ;
148
+
147
149
impl GuestPhysAddr {
148
150
pub fn new ( addr : u64 ) -> Self {
149
151
Self ( addr)
@@ -182,8 +184,17 @@ impl Add<usize> for GuestPhysAddr {
182
184
}
183
185
}
184
186
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 ) ]
186
196
pub struct HostPhysAddr ( u64 ) ;
197
+
187
198
impl HostPhysAddr {
188
199
pub fn new ( addr : u64 ) -> Self {
189
200
Self ( addr)
@@ -198,6 +209,14 @@ impl HostPhysAddr {
198
209
}
199
210
}
200
211
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
+
201
220
#[ derive( PartialEq , Eq , PartialOrd , Ord , Copy , Clone , Debug ) ]
202
221
pub struct HostPhysFrame ( HostPhysAddr ) ;
203
222
impl HostPhysFrame {
0 commit comments