mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
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).
This commit is contained in:
parent
5f9bc6def7
commit
871fe3a549
@ -12,7 +12,7 @@ use crate::interrupt::typelevel::{Binding, Interrupt};
|
|||||||
use crate::{interrupt, pac, peripherals, Peripheral};
|
use crate::{interrupt, pac, peripherals, Peripheral};
|
||||||
|
|
||||||
/// I2C error abort reason
|
/// I2C error abort reason
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum AbortReason {
|
pub enum AbortReason {
|
||||||
/// A bus operation was not acknowledged, e.g. due to the addressed device
|
/// A bus operation was not acknowledged, e.g. due to the addressed device
|
||||||
@ -28,7 +28,7 @@ pub enum AbortReason {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// I2C error
|
/// I2C error
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// I2C abort with error
|
/// I2C abort with error
|
||||||
|
@ -13,7 +13,7 @@ use crate::interrupt::typelevel::{Binding, Interrupt};
|
|||||||
use crate::{pac, Peripheral};
|
use crate::{pac, Peripheral};
|
||||||
|
|
||||||
/// I2C error
|
/// I2C error
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
|
@ -10,7 +10,7 @@ pub type DayOfWeek = chrono::Weekday;
|
|||||||
/// Errors regarding the [`DateTime`] and [`DateTimeFilter`] structs.
|
/// Errors regarding the [`DateTime`] and [`DateTimeFilter`] structs.
|
||||||
///
|
///
|
||||||
/// [`DateTimeFilter`]: struct.DateTimeFilter.html
|
/// [`DateTimeFilter`]: struct.DateTimeFilter.html
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// The [DateTime] has an invalid year. The year must be between 0 and 4095.
|
/// The [DateTime] has an invalid year. The year must be between 0 and 4095.
|
||||||
InvalidYear,
|
InvalidYear,
|
||||||
|
@ -3,7 +3,7 @@ use crate::pac::rtc::regs::{Rtc0, Rtc1, Setup0, Setup1};
|
|||||||
/// Errors regarding the [`DateTime`] and [`DateTimeFilter`] structs.
|
/// Errors regarding the [`DateTime`] and [`DateTimeFilter`] structs.
|
||||||
///
|
///
|
||||||
/// [`DateTimeFilter`]: struct.DateTimeFilter.html
|
/// [`DateTimeFilter`]: struct.DateTimeFilter.html
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// The [DateTime] contains an invalid year value. Must be between `0..=4095`.
|
/// The [DateTime] contains an invalid year value. Must be between `0..=4095`.
|
||||||
InvalidYear,
|
InvalidYear,
|
||||||
|
@ -388,7 +388,7 @@ impl<'d, T: Instance> DsiHost<'d, T> {
|
|||||||
|
|
||||||
/// Possible Error Types for DSI HOST
|
/// Possible Error Types for DSI HOST
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Debug)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Waiting for FIFO empty flag timed out
|
/// Waiting for FIFO empty flag timed out
|
||||||
FifoTimeout,
|
FifoTimeout,
|
||||||
|
@ -23,7 +23,7 @@ use crate::time::Hertz;
|
|||||||
use crate::{interrupt, peripherals};
|
use crate::{interrupt, peripherals};
|
||||||
|
|
||||||
/// I2C error.
|
/// I2C error.
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Bus error
|
/// Bus error
|
||||||
|
@ -15,7 +15,7 @@ use crate::{interrupt, pac, peripherals, rcc, Peripheral};
|
|||||||
static RNG_WAKER: AtomicWaker = AtomicWaker::new();
|
static RNG_WAKER: AtomicWaker = AtomicWaker::new();
|
||||||
|
|
||||||
/// RNG error
|
/// RNG error
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Seed error.
|
/// Seed error.
|
||||||
|
@ -15,7 +15,7 @@ use crate::rcc::{self, RccPeripheral};
|
|||||||
use crate::{peripherals, Peripheral};
|
use crate::{peripherals, Peripheral};
|
||||||
|
|
||||||
/// SAI error
|
/// SAI error
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// `write` called on a SAI in receive mode.
|
/// `write` called on a SAI in receive mode.
|
||||||
|
@ -18,7 +18,7 @@ use crate::time::Hertz;
|
|||||||
use crate::Peripheral;
|
use crate::Peripheral;
|
||||||
|
|
||||||
/// SPI error.
|
/// SPI error.
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Invalid framing.
|
/// Invalid framing.
|
||||||
|
@ -83,7 +83,7 @@ const TSC_NUM_GROUPS: u32 = 7;
|
|||||||
const TSC_NUM_GROUPS: u32 = 8;
|
const TSC_NUM_GROUPS: u32 = 8;
|
||||||
|
|
||||||
/// Error type defined for TSC
|
/// Error type defined for TSC
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Test error for TSC
|
/// Test error for TSC
|
||||||
|
@ -434,7 +434,7 @@ impl<T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usize> PubSubSta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Error type for the [PubSubChannel]
|
/// Error type for the [PubSubChannel]
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// All subscriber slots are used. To add another subscriber, first another subscriber must be dropped or
|
/// All subscriber slots are used. To add another subscriber, first another subscriber must be dropped or
|
||||||
|
Loading…
Reference in New Issue
Block a user