@@ -260,17 +260,28 @@ where
260
260
}
261
261
}
262
262
263
- impl ToString for HWIDeviceType {
264
- fn to_string ( & self ) -> String {
263
+ struct Point {
264
+ x : usize ,
265
+ y : usize ,
266
+ }
267
+
268
+ impl std:: fmt:: Display for Point {
269
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
270
+ write ! ( f, "({}, {})" , self . x, self . y)
271
+ }
272
+ }
273
+
274
+ impl std:: fmt:: Display for HWIDeviceType {
275
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
265
276
match self {
266
- Self :: Ledger => String :: from ( "ledger" ) ,
267
- Self :: Trezor => String :: from ( "trezor" ) ,
268
- Self :: BitBox01 => String :: from ( "digitalbitbox" ) ,
269
- Self :: BitBox02 => String :: from ( "bitbox02" ) ,
270
- Self :: KeepKey => String :: from ( "keepkey" ) ,
271
- Self :: Coldcard => String :: from ( "coldcard" ) ,
272
- Self :: Jade => String :: from ( "jade" ) ,
273
- Self :: Other ( name) => name. to_string ( ) ,
277
+ HWIDeviceType :: Ledger => write ! ( f , "ledger" ) ,
278
+ HWIDeviceType :: Trezor => write ! ( f , "trezor" ) ,
279
+ HWIDeviceType :: BitBox01 => write ! ( f , "digitalbitbox" ) ,
280
+ HWIDeviceType :: BitBox02 => write ! ( f , "bitbox02" ) ,
281
+ HWIDeviceType :: KeepKey => write ! ( f , "keepkey" ) ,
282
+ HWIDeviceType :: Coldcard => write ! ( f , "coldcard" ) ,
283
+ HWIDeviceType :: Jade => write ! ( f , "jade" ) ,
284
+ HWIDeviceType :: Other ( name) => write ! ( f , "{}" , name. to_string( ) ) ,
274
285
}
275
286
}
276
287
}
0 commit comments