Skip to content

Commit

Permalink
Equality traits for OTA slots (#79)
Browse files Browse the repository at this point in the history
* Equality traits for OTA slots

* Add Eq and Hash

* use hash when feature is std

* Impl hash regardless of std

---------

Co-authored-by: Dane Slattery <[email protected]>
  • Loading branch information
DaneSlattery and Dane Slattery authored Oct 14, 2024
1 parent d8e2dea commit 8986eac
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/ota.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
use crate::io::{ErrorType, Read, Write};
use crate::utils::io::*;

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "use_serde", derive(Serialize, Deserialize))]
pub struct Slot {
Expand All @@ -13,7 +13,7 @@ pub struct Slot {
pub firmware: Option<FirmwareInfo>,
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "use_serde", derive(Serialize, Deserialize))]
pub struct FirmwareInfo {
Expand All @@ -32,8 +32,7 @@ pub struct UpdateProgress {
pub operation: &'static str,
}

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Hash))]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "use_serde", derive(Serialize, Deserialize))]
pub enum LoadResult {
Expand All @@ -42,8 +41,7 @@ pub enum LoadResult {
Loaded,
}

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Hash))]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "use_serde", derive(Serialize, Deserialize))]
pub enum SlotState {
Expand Down

0 comments on commit 8986eac

Please sign in to comment.