Skip to content

Commit

Permalink
Implement Eq for NSValue
Browse files Browse the repository at this point in the history
Note that `NSNumber` already implements `Eq` since 3661935, which was
the biggest blocker for adding this implementation.
  • Loading branch information
madsmtm committed Jul 17, 2024
1 parent 0f549e2 commit b0b7fd6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions framework-crates/objc2-foundation/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ impl PartialEq for NSValue {
}
}

impl Eq for NSValue {}

impl fmt::Debug for NSValue {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let enc = self.encoding().unwrap_or("(NULL)");
Expand Down
3 changes: 1 addition & 2 deletions framework-crates/objc2-foundation/translation-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ class.NSProcessInfo.derives = "PartialEq, Eq, Hash"
class.NSString.derives = "PartialEq, Eq, Hash"
class.NSUUID.derives = "PartialEq, Eq, Hash"

# Overridden because whether or not it is Eq depends on the inner value
# Overridden to use more performant implementation for `PartialEq`
class.NSValue.derives = ""
class.NSNumber.derives = ""
class.NSDecimalNumber.derives = "Debug, PartialEq, Hash"

# Returns `nil` on Apple and GNUStep throws an exception on all other messages
# to this invalid instance.
Expand Down
2 changes: 1 addition & 1 deletion generated

0 comments on commit b0b7fd6

Please sign in to comment.