Skip to content

Commit

Permalink
Merge pull request parallaxsecond#124 from Bobo1239/impl-partialeq-fo…
Browse files Browse the repository at this point in the history
…r-attribute

Implement PartialEq/Eq for Attribute
  • Loading branch information
wiktor-k authored Feb 13, 2023
2 parents ce9c357 + 9062172 commit cd497d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cryptoki/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl TryFrom<CK_ATTRIBUTE_TYPE> for AttributeType {
}
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
/// Attribute value
pub enum Attribute {
Expand Down
10 changes: 10 additions & 0 deletions cryptoki/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ impl std::fmt::Display for Date {
}
}

impl PartialEq for Date {
fn eq(&self, other: &Self) -> bool {
self.date.year == other.date.year
&& self.date.month == other.date.month
&& self.date.day == other.date.day
}
}

impl Eq for Date {}

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[repr(transparent)]
/// Unsigned value, at least 32 bits long
Expand Down

0 comments on commit cd497d6

Please sign in to comment.