File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,44 @@ pub enum LoadMismatch {
232
232
} ,
233
233
}
234
234
235
+ impl fmt:: Display for LoadMismatch {
236
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
237
+ match self {
238
+ LoadMismatch :: Network { loaded, expected } => {
239
+ write ! (
240
+ f,
241
+ "Network mismatch: loaded {}, expected {}" ,
242
+ loaded, expected
243
+ )
244
+ }
245
+ LoadMismatch :: Genesis { loaded, expected } => {
246
+ write ! (
247
+ f,
248
+ "Genesis hash mismatch: loaded {}, expected {}" ,
249
+ loaded, expected
250
+ )
251
+ }
252
+ LoadMismatch :: Descriptor {
253
+ keychain,
254
+ loaded,
255
+ expected,
256
+ } => {
257
+ write ! (
258
+ f,
259
+ "Descriptor mismatch for {} keychain: loaded {}, expected {}" ,
260
+ keychain,
261
+ loaded
262
+ . as_ref( )
263
+ . map_or( "None" . to_string( ) , |d| d. to_string( ) ) ,
264
+ expected
265
+ . as_ref( )
266
+ . map_or( "None" . to_string( ) , |d| d. to_string( ) )
267
+ )
268
+ }
269
+ }
270
+ }
271
+ }
272
+
235
273
impl From < LoadMismatch > for LoadError {
236
274
fn from ( mismatch : LoadMismatch ) -> Self {
237
275
Self :: Mismatch ( mismatch)
You can’t perform that action at this time.
0 commit comments