diff options
| author | dvdsk <[email protected]> | 2024-06-06 23:19:07 +0200 |
|---|---|---|
| committer | dvdsk <[email protected]> | 2024-06-06 23:19:07 +0200 |
| commit | 871fe3a5493961e81ec41ddc8f000f32b0549e71 (patch) | |
| tree | 292f86c49b26c9382d54c39e977a9448919c6f29 | |
| parent | 5f9bc6def7ea8698a6ce45d8e12e1d1bd8cce876 (diff) | |
Add Clone and Copy to Error types
None of them are `non-exaustative`, they are all small enough to be copy
(I estimate none are larger than 4 bytes).
| -rw-r--r-- | embassy-rp/src/i2c.rs | 4 | ||||
| -rw-r--r-- | embassy-rp/src/i2c_slave.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/rtc/datetime_chrono.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/rtc/datetime_no_deps.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/dsihost.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/i2c/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rng.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/sai/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/spi/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/tsc/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-sync/src/pubsub/mod.rs | 2 |
11 files changed, 12 insertions, 12 deletions
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs index 256875b4a..10ccca674 100644 --- a/embassy-rp/src/i2c.rs +++ b/embassy-rp/src/i2c.rs | |||
| @@ -12,7 +12,7 @@ use crate::interrupt::typelevel::{Binding, Interrupt}; | |||
| 12 | use crate::{interrupt, pac, peripherals, Peripheral}; | 12 | use crate::{interrupt, pac, peripherals, Peripheral}; |
| 13 | 13 | ||
| 14 | /// I2C error abort reason | 14 | /// I2C error abort reason |
| 15 | #[derive(Debug, PartialEq, Eq)] | 15 | #[derive(Debug, PartialEq, Eq, Clone, Copy)] |
| 16 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 16 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 17 | pub enum AbortReason { | 17 | pub enum AbortReason { |
| 18 | /// A bus operation was not acknowledged, e.g. due to the addressed device | 18 | /// A bus operation was not acknowledged, e.g. due to the addressed device |
| @@ -28,7 +28,7 @@ pub enum AbortReason { | |||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | /// I2C error | 30 | /// I2C error |
| 31 | #[derive(Debug, PartialEq, Eq)] | 31 | #[derive(Debug, PartialEq, Eq, Clone, Copy)] |
| 32 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 32 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 33 | pub enum Error { | 33 | pub enum Error { |
| 34 | /// I2C abort with error | 34 | /// I2C abort with error |
diff --git a/embassy-rp/src/i2c_slave.rs b/embassy-rp/src/i2c_slave.rs index e2d4fbac0..c46a55d2e 100644 --- a/embassy-rp/src/i2c_slave.rs +++ b/embassy-rp/src/i2c_slave.rs | |||
| @@ -13,7 +13,7 @@ use crate::interrupt::typelevel::{Binding, Interrupt}; | |||
| 13 | use crate::{pac, Peripheral}; | 13 | use crate::{pac, Peripheral}; |
| 14 | 14 | ||
| 15 | /// I2C error | 15 | /// I2C error |
| 16 | #[derive(Debug, PartialEq, Eq)] | 16 | #[derive(Debug, PartialEq, Eq, Clone, Copy)] |
| 17 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 17 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 18 | #[non_exhaustive] | 18 | #[non_exhaustive] |
| 19 | pub enum Error { | 19 | pub enum Error { |
diff --git a/embassy-rp/src/rtc/datetime_chrono.rs b/embassy-rp/src/rtc/datetime_chrono.rs index b3c78dd47..2818e46af 100644 --- a/embassy-rp/src/rtc/datetime_chrono.rs +++ b/embassy-rp/src/rtc/datetime_chrono.rs | |||
| @@ -10,7 +10,7 @@ pub type DayOfWeek = chrono::Weekday; | |||
| 10 | /// Errors regarding the [`DateTime`] and [`DateTimeFilter`] structs. | 10 | /// Errors regarding the [`DateTime`] and [`DateTimeFilter`] structs. |
| 11 | /// | 11 | /// |
| 12 | /// [`DateTimeFilter`]: struct.DateTimeFilter.html | 12 | /// [`DateTimeFilter`]: struct.DateTimeFilter.html |
| 13 | #[derive(Clone, Debug, PartialEq, Eq)] | 13 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| 14 | pub enum Error { | 14 | pub enum Error { |
| 15 | /// The [DateTime] has an invalid year. The year must be between 0 and 4095. | 15 | /// The [DateTime] has an invalid year. The year must be between 0 and 4095. |
| 16 | InvalidYear, | 16 | InvalidYear, |
diff --git a/embassy-rp/src/rtc/datetime_no_deps.rs b/embassy-rp/src/rtc/datetime_no_deps.rs index ea899c339..5de00e6b4 100644 --- a/embassy-rp/src/rtc/datetime_no_deps.rs +++ b/embassy-rp/src/rtc/datetime_no_deps.rs | |||
| @@ -3,7 +3,7 @@ use crate::pac::rtc::regs::{Rtc0, Rtc1, Setup0, Setup1}; | |||
| 3 | /// Errors regarding the [`DateTime`] and [`DateTimeFilter`] structs. | 3 | /// Errors regarding the [`DateTime`] and [`DateTimeFilter`] structs. |
| 4 | /// | 4 | /// |
| 5 | /// [`DateTimeFilter`]: struct.DateTimeFilter.html | 5 | /// [`DateTimeFilter`]: struct.DateTimeFilter.html |
| 6 | #[derive(Clone, Debug, PartialEq, Eq)] | 6 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| 7 | pub enum Error { | 7 | pub enum Error { |
| 8 | /// The [DateTime] contains an invalid year value. Must be between `0..=4095`. | 8 | /// The [DateTime] contains an invalid year value. Must be between `0..=4095`. |
| 9 | InvalidYear, | 9 | InvalidYear, |
diff --git a/embassy-stm32/src/dsihost.rs b/embassy-stm32/src/dsihost.rs index e1fb3b0b0..7be51ba6d 100644 --- a/embassy-stm32/src/dsihost.rs +++ b/embassy-stm32/src/dsihost.rs | |||
| @@ -388,7 +388,7 @@ impl<'d, T: Instance> DsiHost<'d, T> { | |||
| 388 | 388 | ||
| 389 | /// Possible Error Types for DSI HOST | 389 | /// Possible Error Types for DSI HOST |
| 390 | #[non_exhaustive] | 390 | #[non_exhaustive] |
| 391 | #[derive(Debug)] | 391 | #[derive(Debug, PartialEq, Eq, Clone, Copy)] |
| 392 | pub enum Error { | 392 | pub enum Error { |
| 393 | /// Waiting for FIFO empty flag timed out | 393 | /// Waiting for FIFO empty flag timed out |
| 394 | FifoTimeout, | 394 | FifoTimeout, |
diff --git a/embassy-stm32/src/i2c/mod.rs b/embassy-stm32/src/i2c/mod.rs index 6d12af2cc..f43cb4567 100644 --- a/embassy-stm32/src/i2c/mod.rs +++ b/embassy-stm32/src/i2c/mod.rs | |||
| @@ -23,7 +23,7 @@ use crate::time::Hertz; | |||
| 23 | use crate::{interrupt, peripherals}; | 23 | use crate::{interrupt, peripherals}; |
| 24 | 24 | ||
| 25 | /// I2C error. | 25 | /// I2C error. |
| 26 | #[derive(Debug, PartialEq, Eq)] | 26 | #[derive(Debug, PartialEq, Eq, Copy, Clone)] |
| 27 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 27 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 28 | pub enum Error { | 28 | pub enum Error { |
| 29 | /// Bus error | 29 | /// Bus error |
diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index 94491c32f..6f4c81c8a 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs | |||
| @@ -15,7 +15,7 @@ use crate::{interrupt, pac, peripherals, rcc, Peripheral}; | |||
| 15 | static RNG_WAKER: AtomicWaker = AtomicWaker::new(); | 15 | static RNG_WAKER: AtomicWaker = AtomicWaker::new(); |
| 16 | 16 | ||
| 17 | /// RNG error | 17 | /// RNG error |
| 18 | #[derive(Debug, PartialEq, Eq)] | 18 | #[derive(Debug, PartialEq, Eq, Clone, Copy)] |
| 19 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 19 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 20 | pub enum Error { | 20 | pub enum Error { |
| 21 | /// Seed error. | 21 | /// Seed error. |
diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs index 3faecdc33..87bde12eb 100644 --- a/embassy-stm32/src/sai/mod.rs +++ b/embassy-stm32/src/sai/mod.rs | |||
| @@ -15,7 +15,7 @@ use crate::rcc::{self, RccPeripheral}; | |||
| 15 | use crate::{peripherals, Peripheral}; | 15 | use crate::{peripherals, Peripheral}; |
| 16 | 16 | ||
| 17 | /// SAI error | 17 | /// SAI error |
| 18 | #[derive(Debug, PartialEq, Eq)] | 18 | #[derive(Debug, PartialEq, Eq, Clone, Copy)] |
| 19 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 19 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 20 | pub enum Error { | 20 | pub enum Error { |
| 21 | /// `write` called on a SAI in receive mode. | 21 | /// `write` called on a SAI in receive mode. |
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs index 4eaf7777f..03c908db8 100644 --- a/embassy-stm32/src/spi/mod.rs +++ b/embassy-stm32/src/spi/mod.rs | |||
| @@ -18,7 +18,7 @@ use crate::time::Hertz; | |||
| 18 | use crate::Peripheral; | 18 | use crate::Peripheral; |
| 19 | 19 | ||
| 20 | /// SPI error. | 20 | /// SPI error. |
| 21 | #[derive(Debug, PartialEq, Eq)] | 21 | #[derive(Debug, PartialEq, Eq, Clone, Copy)] |
| 22 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 22 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 23 | pub enum Error { | 23 | pub enum Error { |
| 24 | /// Invalid framing. | 24 | /// Invalid framing. |
diff --git a/embassy-stm32/src/tsc/mod.rs b/embassy-stm32/src/tsc/mod.rs index 045d6317c..8cab3a24c 100644 --- a/embassy-stm32/src/tsc/mod.rs +++ b/embassy-stm32/src/tsc/mod.rs | |||
| @@ -83,7 +83,7 @@ const TSC_NUM_GROUPS: u32 = 7; | |||
| 83 | const TSC_NUM_GROUPS: u32 = 8; | 83 | const TSC_NUM_GROUPS: u32 = 8; |
| 84 | 84 | ||
| 85 | /// Error type defined for TSC | 85 | /// Error type defined for TSC |
| 86 | #[derive(Debug)] | 86 | #[derive(Debug, Clone, Copy)] |
| 87 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 87 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 88 | pub enum Error { | 88 | pub enum Error { |
| 89 | /// Test error for TSC | 89 | /// Test error for TSC |
diff --git a/embassy-sync/src/pubsub/mod.rs b/embassy-sync/src/pubsub/mod.rs index 66c9b0017..a97eb7d5b 100644 --- a/embassy-sync/src/pubsub/mod.rs +++ b/embassy-sync/src/pubsub/mod.rs | |||
| @@ -434,7 +434,7 @@ impl<T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usize> PubSubSta | |||
| 434 | } | 434 | } |
| 435 | 435 | ||
| 436 | /// Error type for the [PubSubChannel] | 436 | /// Error type for the [PubSubChannel] |
| 437 | #[derive(Debug, PartialEq, Eq, Clone)] | 437 | #[derive(Debug, PartialEq, Eq, Clone, Copy)] |
| 438 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 438 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 439 | pub enum Error { | 439 | pub enum Error { |
| 440 | /// All subscriber slots are used. To add another subscriber, first another subscriber must be dropped or | 440 | /// All subscriber slots are used. To add another subscriber, first another subscriber must be dropped or |
