-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Would it be possible to implement a Hashable extension to StructuredData ?
I see we already provide an implementation for equals, so this would be a nice addition, as it would save me from unwrapping the structured data type.
Here is my idea.
extension StructuredDataWrapper {
var hashValue: Int {
switch self.wrapped {
case let .bool(bool):
return bool.hashValue
case let .number(number):
switch number {
case let .int(int):
return int.hashValue
case let .double(double):
return double.hashValue
case let .uint(uint):
return uint.hashValue
}
case let .string(string):
return string.hashValue
case let .date(date):
return date.hashValue
case let .bytes(bytes):
return bytes.makeString().hashValue
case let .array(array):
// Not too sure here
return 0
case let .object(object):
// Not too sure here
return 0
case .null:
return 0
}
}
}Reactions are currently unavailable