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