diff --git a/espflash/src/command.rs b/espflash/src/command.rs index c6734d32..a3bc1427 100644 --- a/espflash/src/command.rs +++ b/espflash/src/command.rs @@ -13,8 +13,8 @@ const MEM_END_TIMEOUT: Duration = Duration::from_millis(50); const SYNC_TIMEOUT: Duration = Duration::from_millis(100); #[derive(Copy, Clone, Debug, Display)] -#[repr(u8)] #[non_exhaustive] +#[repr(u8)] pub enum CommandType { Unknown = 0, FlashBegin = 0x02, @@ -70,6 +70,7 @@ impl CommandType { } #[derive(Copy, Clone, Debug)] +#[non_exhaustive] pub enum Command<'a> { FlashBegin { size: u32, diff --git a/espflash/src/flasher/mod.rs b/espflash/src/flasher/mod.rs index fc2767f8..465a1af3 100644 --- a/espflash/src/flasher/mod.rs +++ b/espflash/src/flasher/mod.rs @@ -40,6 +40,7 @@ const FLASH_SECTORS_PER_BLOCK: usize = FLASH_SECTOR_SIZE / FLASH_BLOCK_SIZE; /// Note that not all frequencies are supported by each target device. #[cfg_attr(feature = "cli", derive(clap::ValueEnum))] #[derive(Debug, Default, Clone, Copy, Hash, PartialEq, Eq, Display, EnumVariantNames)] +#[non_exhaustive] #[repr(u8)] pub enum FlashFrequency { /// 12 MHz @@ -70,6 +71,7 @@ pub enum FlashFrequency { /// Supported flash modes #[cfg_attr(feature = "cli", derive(clap::ValueEnum))] #[derive(Copy, Clone, Debug, Default, EnumVariantNames)] +#[non_exhaustive] #[strum(serialize_all = "lowercase")] pub enum FlashMode { /// Quad I/O (4 pins used for address & data) @@ -88,6 +90,7 @@ pub enum FlashMode { /// Note that not all sizes are supported by each target device. #[cfg_attr(feature = "cli", derive(clap::ValueEnum))] #[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Display, EnumVariantNames, EnumIter)] +#[non_exhaustive] #[repr(u8)] #[strum(serialize_all = "SCREAMING_SNAKE_CASE")] pub enum FlashSize { diff --git a/espflash/src/image_format/mod.rs b/espflash/src/image_format/mod.rs index d7049bd3..256ba7ba 100644 --- a/espflash/src/image_format/mod.rs +++ b/espflash/src/image_format/mod.rs @@ -69,6 +69,7 @@ pub trait ImageFormat<'a>: Send { #[derive( Debug, Copy, Clone, Eq, PartialEq, Display, IntoStaticStr, EnumVariantNames, Deserialize, )] +#[non_exhaustive] #[strum(serialize_all = "kebab-case")] #[serde(rename_all = "kebab-case")] pub enum ImageFormatKind { diff --git a/espflash/src/interface.rs b/espflash/src/interface.rs index 2b808916..6930650e 100644 --- a/espflash/src/interface.rs +++ b/espflash/src/interface.rs @@ -15,6 +15,7 @@ use crate::error::Error; /// Errors relating to the configuration of a serial port #[derive(thiserror::Error, Debug)] +#[non_exhaustive] pub enum SerialConfigError { #[cfg(feature = "raspberry")] #[error("You need to specify both DTR and RTS pins when using an internal UART peripheral")] diff --git a/espflash/src/targets/mod.rs b/espflash/src/targets/mod.rs index 89e80123..de9a392a 100644 --- a/espflash/src/targets/mod.rs +++ b/espflash/src/targets/mod.rs @@ -42,6 +42,7 @@ mod flash_target; /// Enumeration of all supported devices #[cfg_attr(feature = "cli", derive(clap::ValueEnum))] #[derive(Debug, Clone, Copy, PartialEq, Eq, Display, EnumIter, EnumVariantNames)] +#[non_exhaustive] #[strum(serialize_all = "lowercase")] pub enum Chip { /// ESP32