Skip to content

Commit

Permalink
Make Resilient conditionally conform to Equatable and Hashable (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
calda authored Sep 27, 2024
1 parent 2271d8f commit 1fe2eef
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Sources/ResilientDecoding/Resilient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ public struct Resilient<Value: Decodable>: Decodable {

}

// MARK: Equatable

extension Resilient: Equatable where Value: Equatable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
lhs.wrappedValue == rhs.wrappedValue
}
}

// MARK: Hashable

extension Resilient: Hashable where Value: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(wrappedValue)
}
}

// MARK: - Decoding Outcome

#if DEBUG
Expand Down

0 comments on commit 1fe2eef

Please sign in to comment.