mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Provide hash(into:) functions where the default implementation might be doing too much work.
This commit is contained in:
@@ -17,7 +17,7 @@ public struct KeyboardConstant {
|
||||
public static let spaceKey = " ".keyboardIntegerValue
|
||||
}
|
||||
|
||||
public extension String {
|
||||
extension String {
|
||||
|
||||
var keyboardIntegerValue: Int? {
|
||||
if isEmpty {
|
||||
@@ -65,6 +65,12 @@ public extension String {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MARK: - Hashable
|
||||
|
||||
nonisolated public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(key)
|
||||
}
|
||||
}
|
||||
|
||||
public struct KeyboardKey: Hashable, Sendable {
|
||||
@@ -143,5 +149,12 @@ public struct KeyboardKey: Hashable, Sendable {
|
||||
|
||||
self.init(integerValue: integerValue, shiftKeyDown: shiftKeyDown, optionKeyDown: optionKeyDown, commandKeyDown: commandKeyDown, controlKeyDown: controlKeyDown)
|
||||
}
|
||||
|
||||
// MARK: - Hashable
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(integerValue)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user