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

View File

@ -79,5 +79,19 @@ public enum FeedIdentifier: CustomStringConvertible, Hashable {
return nil
}
}
// 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)
}
}
}