Add, as a micro-optimization, a custom hash function for FeedIdentifier.

This commit is contained in:
Brent Simmons 2020-02-01 15:00:36 -08:00
parent b50fabe325
commit 30cf8c6a08
1 changed files with 15 additions and 1 deletions

View File

@ -80,4 +80,18 @@ public enum FeedIdentifier: CustomStringConvertible, Hashable {
}
}
// MARK: - Hashable
public func hash(into hasher: inout Hasher) {
switch self {
case .smartFeed(let id):
hasher.combine(id)
case .script(let id):
hasher.combine(id)
case .webFeed(_, let webFeedID):
hasher.combine(webFeedID)
case .folder(_, let folderName):
hasher.combine(folderName)
}
}
}