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 /embassy-rp | |
| 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).
Diffstat (limited to 'embassy-rp')
| -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 |
4 files changed, 5 insertions, 5 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, |
