@@ -83,6 +83,7 @@ pub use device_path_gen::{
83
83
84
84
use crate :: proto:: { unsafe_protocol, ProtocolPointer } ;
85
85
use core:: ffi:: c_void;
86
+ use core:: fmt:: { self , Debug , Formatter } ;
86
87
use core:: marker:: { PhantomData , PhantomPinned } ;
87
88
use core:: mem;
88
89
use ptr_meta:: Pointee ;
@@ -119,7 +120,7 @@ pub struct DevicePathHeader {
119
120
/// See the [module-level documentation] for more details.
120
121
///
121
122
/// [module-level documentation]: crate::proto::device_path
122
- #[ derive( Debug , Eq , PartialEq , Pointee ) ]
123
+ #[ derive( Eq , Pointee ) ]
123
124
#[ repr( C , packed) ]
124
125
pub struct DevicePathNode {
125
126
header : DevicePathHeader ,
@@ -186,6 +187,21 @@ impl DevicePathNode {
186
187
}
187
188
}
188
189
190
+ impl Debug for DevicePathNode {
191
+ fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
192
+ f. debug_struct ( "DevicePathNode" )
193
+ . field ( "header" , & self . header )
194
+ . field ( "data" , & & self . data )
195
+ . finish ( )
196
+ }
197
+ }
198
+
199
+ impl PartialEq for DevicePathNode {
200
+ fn eq ( & self , other : & Self ) -> bool {
201
+ self . header == other. header && self . data == other. data
202
+ }
203
+ }
204
+
189
205
/// A single device path instance that ends with either an [`END_INSTANCE`]
190
206
/// or [`END_ENTIRE`] node. Use [`DevicePath::instance_iter`] to get the
191
207
/// path instances in a [`DevicePath`].
@@ -196,7 +212,7 @@ impl DevicePathNode {
196
212
/// [`END_INSTANCE`]: DeviceSubType::END_INSTANCE
197
213
/// [module-level documentation]: crate::proto::device_path
198
214
#[ repr( C , packed) ]
199
- #[ derive( Debug , Eq , PartialEq , Pointee ) ]
215
+ #[ derive( Eq , Pointee ) ]
200
216
pub struct DevicePathInstance {
201
217
data : [ u8 ] ,
202
218
}
@@ -216,6 +232,20 @@ impl DevicePathInstance {
216
232
}
217
233
}
218
234
235
+ impl Debug for DevicePathInstance {
236
+ fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
237
+ f. debug_struct ( "DevicePathInstance" )
238
+ . field ( "data" , & & self . data )
239
+ . finish ( )
240
+ }
241
+ }
242
+
243
+ impl PartialEq for DevicePathInstance {
244
+ fn eq ( & self , other : & Self ) -> bool {
245
+ self . data == other. data
246
+ }
247
+ }
248
+
219
249
/// Device path protocol.
220
250
///
221
251
/// A device path contains one or more device path instances made of up
@@ -227,7 +257,7 @@ impl DevicePathInstance {
227
257
/// [`END_ENTIRE`]: DeviceSubType::END_ENTIRE
228
258
#[ repr( C , packed) ]
229
259
#[ unsafe_protocol( "09576e91-6d3f-11d2-8e39-00a0c969723b" ) ]
230
- #[ derive( Debug , Eq , PartialEq , Pointee ) ]
260
+ #[ derive( Eq , Pointee ) ]
231
261
pub struct DevicePath {
232
262
data : [ u8 ] ,
233
263
}
@@ -302,6 +332,20 @@ impl DevicePath {
302
332
}
303
333
}
304
334
335
+ impl Debug for DevicePath {
336
+ fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
337
+ f. debug_struct ( "DevicePath" )
338
+ . field ( "data" , & & self . data )
339
+ . finish ( )
340
+ }
341
+ }
342
+
343
+ impl PartialEq for DevicePath {
344
+ fn eq ( & self , other : & Self ) -> bool {
345
+ self . data == other. data
346
+ }
347
+ }
348
+
305
349
/// Iterator over the [`DevicePathInstance`]s in a [`DevicePath`].
306
350
///
307
351
/// This struct is returned by [`DevicePath::instance_iter`].
0 commit comments