Skip to content

Commit 59d62c1

Browse files
committed
Mark public enums as #[non_exhaustive] for semver compatibility
1 parent 50946ce commit 59d62c1

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

espflash/src/command.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const MEM_END_TIMEOUT: Duration = Duration::from_millis(50);
1313
const SYNC_TIMEOUT: Duration = Duration::from_millis(100);
1414

1515
#[derive(Copy, Clone, Debug, Display)]
16-
#[repr(u8)]
1716
#[non_exhaustive]
17+
#[repr(u8)]
1818
pub enum CommandType {
1919
Unknown = 0,
2020
FlashBegin = 0x02,
@@ -70,6 +70,7 @@ impl CommandType {
7070
}
7171

7272
#[derive(Copy, Clone, Debug)]
73+
#[non_exhaustive]
7374
pub enum Command<'a> {
7475
FlashBegin {
7576
size: u32,

espflash/src/flasher/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const FLASH_SECTORS_PER_BLOCK: usize = FLASH_SECTOR_SIZE / FLASH_BLOCK_SIZE;
4040
/// Note that not all frequencies are supported by each target device.
4141
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
4242
#[derive(Debug, Default, Clone, Copy, Hash, PartialEq, Eq, Display, EnumVariantNames)]
43+
#[non_exhaustive]
4344
#[repr(u8)]
4445
pub enum FlashFrequency {
4546
/// 12 MHz
@@ -70,6 +71,7 @@ pub enum FlashFrequency {
7071
/// Supported flash modes
7172
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
7273
#[derive(Copy, Clone, Debug, Default, EnumVariantNames)]
74+
#[non_exhaustive]
7375
#[strum(serialize_all = "lowercase")]
7476
pub enum FlashMode {
7577
/// Quad I/O (4 pins used for address & data)
@@ -88,6 +90,7 @@ pub enum FlashMode {
8890
/// Note that not all sizes are supported by each target device.
8991
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
9092
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Display, EnumVariantNames, EnumIter)]
93+
#[non_exhaustive]
9194
#[repr(u8)]
9295
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
9396
pub enum FlashSize {

espflash/src/image_format/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ pub trait ImageFormat<'a>: Send {
6969
#[derive(
7070
Debug, Copy, Clone, Eq, PartialEq, Display, IntoStaticStr, EnumVariantNames, Deserialize,
7171
)]
72+
#[non_exhaustive]
7273
#[strum(serialize_all = "kebab-case")]
7374
#[serde(rename_all = "kebab-case")]
7475
pub enum ImageFormatKind {

espflash/src/interface.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::error::Error;
1515

1616
/// Errors relating to the configuration of a serial port
1717
#[derive(thiserror::Error, Debug)]
18+
#[non_exhaustive]
1819
pub enum SerialConfigError {
1920
#[cfg(feature = "raspberry")]
2021
#[error("You need to specify both DTR and RTS pins when using an internal UART peripheral")]

espflash/src/targets/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ mod flash_target;
4242
/// Enumeration of all supported devices
4343
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
4444
#[derive(Debug, Clone, Copy, PartialEq, Eq, Display, EnumIter, EnumVariantNames)]
45+
#[non_exhaustive]
4546
#[strum(serialize_all = "lowercase")]
4647
pub enum Chip {
4748
/// ESP32

0 commit comments

Comments
 (0)