-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make HPACKHeaders hashable. #344
Conversation
Motivation: HPACKHeaders is equatable, and it rarely makes sense to have a type that is equatable but not hashable. The definition of equatability is pretty limited here (see apple#342) but we can define a definition of hashability consistent with it. Modifications: - Make HPACKHeaders hashable. Result: People can store HPACKHeaders in Sets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor question, otherwise looks good
Sources/NIOHPACK/HPACKHeader.swift
Outdated
@@ -394,6 +394,9 @@ extension HPACKHeaders: CustomStringConvertible { | |||
} | |||
} | |||
|
|||
// NOTE: This is a bad definition of equatable and hashable. In particular, both order and | |||
// indexability are ignored. We're sort of stuck with this behaviour now and cannot change it, | |||
// but in the next major version we should strongly consider revising it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we link a GH issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I think this comment is just unnecessarily aggressive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One perf and one question, otherwise LGTM
Co-authored-by: David Nadoba <dnadoba@gmail.com>
Motivation:
HPACKHeaders is equatable, and it rarely makes sense to have a type that
is equatable but not hashable. The definition of equatability is pretty
limited here (see #342) but we can define a definition of hashability
consistent with it.
Modifications:
Result:
People can store HPACKHeaders in Sets