@@ -8,8 +8,7 @@ use std::{
8
8
use miette:: Diagnostic ;
9
9
#[ cfg( feature = "serialport" ) ]
10
10
use slip_codec:: SlipError ;
11
- #[ cfg( feature = "serialpot" ) ]
12
- use strum:: FromRepr ;
11
+ use strum:: VariantNames ;
13
12
use thiserror:: Error ;
14
13
15
14
#[ cfg( feature = "cli" ) ]
@@ -185,7 +184,7 @@ pub enum Error {
185
184
InvalidElf ( #[ from] ElfError ) ,
186
185
187
186
#[ error( "The bootloader returned an error" ) ]
188
- #[ cfg( feature = "serialpot " ) ]
187
+ #[ cfg( feature = "serialport " ) ]
189
188
#[ diagnostic( transparent) ]
190
189
RomError ( #[ from] RomError ) ,
191
190
@@ -350,10 +349,10 @@ impl From<CommandType> for TimedOutCommand {
350
349
}
351
350
352
351
/// Errors originating from a device's ROM functionality
353
- #[ derive( Clone , Copy , Debug , Default , Diagnostic , Error , FromRepr ) ]
352
+ #[ derive( Clone , Copy , Debug , Default , Diagnostic , Error , strum :: FromRepr ) ]
354
353
#[ non_exhaustive]
355
354
#[ repr( u8 ) ]
356
- #[ cfg( feature = "serialpot " ) ]
355
+ #[ cfg( feature = "serialport " ) ]
357
356
pub enum RomErrorKind {
358
357
#[ error( "Invalid message received" ) ]
359
358
#[ diagnostic( code( espflash:: rom:: invalid_message) ) ]
@@ -429,7 +428,7 @@ pub enum RomErrorKind {
429
428
Other = 0xff ,
430
429
}
431
430
432
- #[ cfg( feature = "serialpot " ) ]
431
+ #[ cfg( feature = "serialport " ) ]
433
432
impl From < u8 > for RomErrorKind {
434
433
fn from ( raw : u8 ) -> Self {
435
434
Self :: from_repr ( raw) . unwrap_or_default ( )
@@ -439,15 +438,15 @@ impl From<u8> for RomErrorKind {
439
438
/// An error originating from a device's ROM functionality
440
439
#[ derive( Clone , Copy , Debug , Diagnostic , Error ) ]
441
440
#[ error( "Error while running {command} command" ) ]
442
- #[ cfg( feature = "serialpot " ) ]
441
+ #[ cfg( feature = "serialport " ) ]
443
442
#[ non_exhaustive]
444
443
pub struct RomError {
445
444
command : CommandType ,
446
445
#[ source]
447
446
kind : RomErrorKind ,
448
447
}
449
448
450
- #[ cfg( feature = "serialpot " ) ]
449
+ #[ cfg( feature = "serialport " ) ]
451
450
impl RomError {
452
451
pub fn new ( command : CommandType , kind : RomErrorKind ) -> RomError {
453
452
RomError { command, kind }
0 commit comments