From e75fef6186f8b43229b7df6b692d99055f4d7b44 Mon Sep 17 00:00:00 2001 From: Robert Zieba Date: Tue, 12 May 2026 14:34:08 -0700 Subject: [PATCH] Derive `PartialEq` and `Eq` Add anything that got missed. --- src/type_c.rs | 2 +- src/ucsi/lpm/get_connector_capability.rs | 2 +- src/ucsi/lpm/get_connector_status.rs | 4 ++-- src/ucsi/lpm/get_error_status.rs | 2 +- src/ucsi/lpm/mod.rs | 6 +++--- src/ucsi/mod.rs | 8 ++++---- src/ucsi/ppm/cancel.rs | 2 +- src/ucsi/ppm/get_capability.rs | 6 +++--- src/ucsi/ppm/mod.rs | 4 ++-- src/ucsi/ppm/ppm_reset.rs | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/type_c.rs b/src/type_c.rs index 354f789..59382d4 100644 --- a/src/type_c.rs +++ b/src/type_c.rs @@ -29,7 +29,7 @@ impl Current { } /// The current state of a Type-C port. -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum ConnectionState { /// The port is connected to an USB Type-C Digital Audio (TCDA) accessory. diff --git a/src/ucsi/lpm/get_connector_capability.rs b/src/ucsi/lpm/get_connector_capability.rs index f19d0c2..a1af240 100644 --- a/src/ucsi/lpm/get_connector_capability.rs +++ b/src/ucsi/lpm/get_connector_capability.rs @@ -292,7 +292,7 @@ impl Decode for ResponseData { } /// GET_CONNECTOR_CAPABILITY command arguments -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Args; diff --git a/src/ucsi/lpm/get_connector_status.rs b/src/ucsi/lpm/get_connector_status.rs index babfa4c..e5dc93b 100644 --- a/src/ucsi/lpm/get_connector_status.rs +++ b/src/ucsi/lpm/get_connector_status.rs @@ -507,7 +507,7 @@ impl From for ProviderCapsLimitedReason { bitfield! { /// Raw response data bitfield - #[derive(Copy, Clone, Default)] + #[derive(Copy, Clone, Default, PartialEq, Eq)] pub struct ResponseDataRaw([u8]); impl Debug; @@ -741,7 +741,7 @@ impl Decode for ResponseData { } } /// GET_CONNECTOR_STATUS command arguments -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Args; diff --git a/src/ucsi/lpm/get_error_status.rs b/src/ucsi/lpm/get_error_status.rs index 40ea68f..484614b 100644 --- a/src/ucsi/lpm/get_error_status.rs +++ b/src/ucsi/lpm/get_error_status.rs @@ -13,7 +13,7 @@ pub const COMMAND_PADDING: usize = COMMAND_LEN - size_of::() - /// Maximum support vendor-data length pub const MAX_VENDOR_DATA_LEN: usize = 14; -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Args; diff --git a/src/ucsi/lpm/mod.rs b/src/ucsi/lpm/mod.rs index a0285ce..a1cda73 100644 --- a/src/ucsi/lpm/mod.rs +++ b/src/ucsi/lpm/mod.rs @@ -338,7 +338,7 @@ pub type GlobalCommand = Command; pub type LocalCommand = Command; /// LPM response data -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum ResponseData { ConnectorReset, @@ -404,7 +404,7 @@ impl Decode for ResponseData { } /// LPM command response -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Response { /// CCI is produced by every command @@ -418,7 +418,7 @@ pub type LocalResponse = Response; bitfield! { /// Raw connector number - #[derive(Copy, Clone, Default)] + #[derive(Copy, Clone, Default, PartialEq, Eq)] pub(self) struct ConnectorNumberRaw(u8); impl Debug; diff --git a/src/ucsi/mod.rs b/src/ucsi/mod.rs index 040aeae..5d5964d 100644 --- a/src/ucsi/mod.rs +++ b/src/ucsi/mod.rs @@ -186,7 +186,7 @@ impl Decode for Command { } /// UCSI command response data -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum ResponseData { Ppm(ppm::ResponseData), @@ -210,7 +210,7 @@ impl Encode for ResponseData { } /// UCSI command response -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Response { /// CCI is produced by every command @@ -248,7 +248,7 @@ pub type LocalResponse = Response; bitfield! { /// Common header shared by all UCSI commands - #[derive(Copy, Clone)] + #[derive(Copy, Clone, PartialEq, Eq)] pub(self) struct CommandHeaderRaw(u16); impl Debug; @@ -271,7 +271,7 @@ impl defmt::Format for CommandHeaderRaw { } /// Higher-level wrapper around [`CommandHeaderRaw`] -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct CommandHeader(CommandHeaderRaw); diff --git a/src/ucsi/ppm/cancel.rs b/src/ucsi/ppm/cancel.rs index 0d46275..9353268 100644 --- a/src/ucsi/ppm/cancel.rs +++ b/src/ucsi/ppm/cancel.rs @@ -7,7 +7,7 @@ use bincode::error::{DecodeError, EncodeError}; use crate::ucsi::{CommandHeaderRaw, COMMAND_LEN}; /// PPM CANCEL command args -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Args; diff --git a/src/ucsi/ppm/get_capability.rs b/src/ucsi/ppm/get_capability.rs index 2a6d163..3aac053 100644 --- a/src/ucsi/ppm/get_capability.rs +++ b/src/ucsi/ppm/get_capability.rs @@ -13,7 +13,7 @@ pub const RESPONSE_DATA_LEN: usize = 16; pub const COMMAND_PADDING: usize = COMMAND_LEN - size_of::(); /// GetCapability command -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Args; @@ -218,7 +218,7 @@ impl Decode for OptionalFeatures { bitfield! { /// Raw power source data for GetCapability command - #[derive(Copy, Clone)] + #[derive(Copy, Clone, PartialEq, Eq)] struct PowerSourceRaw(u8); impl Debug; @@ -245,7 +245,7 @@ impl defmt::Format for PowerSourceRaw { } /// Higher-level wrapper around [`PowerSourceRaw`] -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct PowerSource(PowerSourceRaw); diff --git a/src/ucsi/ppm/mod.rs b/src/ucsi/ppm/mod.rs index efa53e2..c735fa9 100644 --- a/src/ucsi/ppm/mod.rs +++ b/src/ucsi/ppm/mod.rs @@ -93,7 +93,7 @@ impl Decode<()> for Command { } /// PPM command response data -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum ResponseData { GetCapability(get_capability::ResponseData), @@ -123,7 +123,7 @@ impl Decode for ResponseData { } /// PPM command response -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Response { /// CCI is produced by every command diff --git a/src/ucsi/ppm/ppm_reset.rs b/src/ucsi/ppm/ppm_reset.rs index b260ac1..2388e17 100644 --- a/src/ucsi/ppm/ppm_reset.rs +++ b/src/ucsi/ppm/ppm_reset.rs @@ -7,7 +7,7 @@ use bincode::error::{DecodeError, EncodeError}; use crate::ucsi::{CommandHeaderRaw, COMMAND_LEN}; /// PPM Reset command structure -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Args;