Skip to content

Commit

Permalink
Merge pull request #37 from strict-types/fix/34
Browse files Browse the repository at this point in the history
Fix Variant Eq implementation
  • Loading branch information
dr-orlovsky authored May 6, 2024
2 parents 9f40e3c + 03d4b8f commit 18d7e10
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rust/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Display for Sizing {
}
}

#[derive(Clone, PartialEq, Eq, Hash, Debug)]
#[derive(Clone, Eq, Hash, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "serde_crate"))]
pub struct Variant {
pub name: VariantName,
Expand All @@ -107,6 +107,12 @@ impl Variant {
}
}

impl PartialEq for Variant {
fn eq(&self, other: &Self) -> bool {
self.tag == other.tag || self.name == other.name
}
}

impl PartialOrd for Variant {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
}
Expand Down

0 comments on commit 18d7e10

Please sign in to comment.