diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ac011f..77ee22a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ file. This change log follows the conventions of ## [Unreleased] +### Added + +- `#[derive(PartialEq)]` has been added to `Condition`, `DataType`, `FacilityType`, `NotificationGroup`, `Period`, `ViewType`, `ClientEvent`, `SystemEventRequest` and `SystemEvent`. +- `#[derive(Eq)]` has been added to `Condition`, `DataType`, `FacilityType`, `NotificationGroup`, `Period`, `ViewType`, `ClientEvent` and `SystemEventRequest`. + ### Changed - The GitHub repository has been renamed from `mihai-dinculescu/simconnect-sdk` to `mihai-dinculescu/simconnect-sdk-rs`. diff --git a/simconnect-sdk/src/domain/condition.rs b/simconnect-sdk/src/domain/condition.rs index 7dff284..6ba8ff8 100644 --- a/simconnect-sdk/src/domain/condition.rs +++ b/simconnect-sdk/src/domain/condition.rs @@ -1,7 +1,7 @@ use crate::bindings; /// Specifies under which conditions the data is to be sent by the server and received by the client. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum Condition { /// The default, data will be sent strictly according to the defined period. None, diff --git a/simconnect-sdk/src/domain/data_type.rs b/simconnect-sdk/src/domain/data_type.rs index 9726f1f..0175216 100644 --- a/simconnect-sdk/src/domain/data_type.rs +++ b/simconnect-sdk/src/domain/data_type.rs @@ -1,5 +1,5 @@ /// [`crate::SimConnectObject`] object property data type. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum DataType { Float64, Bool, diff --git a/simconnect-sdk/src/domain/events.rs b/simconnect-sdk/src/domain/events.rs index 3007c1c..eed3427 100644 --- a/simconnect-sdk/src/domain/events.rs +++ b/simconnect-sdk/src/domain/events.rs @@ -3,7 +3,7 @@ use std::os::raw::c_char; use crate::{bindings, fixed_c_str_to_string, SimConnectError}; /// SimConnect System Event Request. -#[derive(Debug, Copy, Clone, num_enum::TryFromPrimitive)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, num_enum::TryFromPrimitive)] #[repr(u32)] #[non_exhaustive] pub enum SystemEventRequest { @@ -84,7 +84,7 @@ impl SystemEventRequest { } /// Cockpit view type. -#[derive(Debug, Copy, Clone, num_enum::TryFromPrimitive)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, num_enum::TryFromPrimitive)] #[repr(u32)] pub enum ViewType { /// No cockpit view. @@ -98,7 +98,7 @@ pub enum ViewType { } /// SimConnect System Event Notification. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] #[non_exhaustive] pub enum SystemEvent { /// A notification every second. @@ -274,7 +274,7 @@ pub(crate) const CLIENT_EVENT_START: u32 = 128; /// SimConnect Client Event. /// /// WIP. As defined by . -#[derive(Debug, Copy, Clone, num_enum::TryFromPrimitive)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, num_enum::TryFromPrimitive)] #[repr(u32)] #[non_exhaustive] pub enum ClientEvent { diff --git a/simconnect-sdk/src/domain/facilities.rs b/simconnect-sdk/src/domain/facilities.rs index b084f15..9cf9e24 100644 --- a/simconnect-sdk/src/domain/facilities.rs +++ b/simconnect-sdk/src/domain/facilities.rs @@ -2,7 +2,7 @@ use crate::bindings; /// Facility Type. The simulation keeps a facilities cache of all the airports, waypoints, NDB and VOR stations within a certain radius of the user aircraft. /// They can be requested using [`crate::SimConnect::subscribe_to_facilities`] or [`crate::SimConnect::request_facilities_list`]. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum FacilityType { Airport, Waypoint, diff --git a/simconnect-sdk/src/domain/notification_group.rs b/simconnect-sdk/src/domain/notification_group.rs index 8e56c95..3161495 100644 --- a/simconnect-sdk/src/domain/notification_group.rs +++ b/simconnect-sdk/src/domain/notification_group.rs @@ -1,5 +1,5 @@ /// SimConnect event notification group. -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] #[repr(u32)] pub enum NotificationGroup { Group0, diff --git a/simconnect-sdk/src/domain/period.rs b/simconnect-sdk/src/domain/period.rs index f667d08..f65e0ba 100644 --- a/simconnect-sdk/src/domain/period.rs +++ b/simconnect-sdk/src/domain/period.rs @@ -5,7 +5,7 @@ use crate::bindings; /// 1 - every other interval. /// 2 - every third interval. /// etc. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum Period { /// Specifies that the data should be sent once only. Note that this is not an efficient way of receiving data frequently, use one of the other periods if there is a regular frequency to the data request. Once,