Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Operator

==(_:_:)

Equality is by protocol version only: two values are equal when they represent the same HTTP version, ignoring any associated configuration.
static func == (lhs: `Self`, rhs: `Self`) -> Bool

Discussion

This is intentional, and the reason ==/hash are written by hand instead of synthesised. It makes a Set<HTTPVersion> behave as the set of supported protocols: it holds at most one entry per version, so the same protocol can’t be added twice with conflicting configuration. Synthesised conformances would fold the associated config into identity and allow such duplicates. This mirrors NIOHTTPServerConfiguration.HTTPVersion, which does the same.