Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
swift 5 warning fix (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Mar 26, 2019
1 parent 24282b0 commit 8da7d47
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Sources/HTTP/Message/HTTPHeaderName.swift
@@ -1,16 +1,28 @@
/// Type used for the name of a HTTP header in the `HTTPHeaders` storage.
public struct HTTPHeaderName: Codable, Hashable, CustomStringConvertible {
/// See `Hashable.hashValue`
public let hashValue: Int

// #if compiler(>=4.2)
#if swift(>=4.1.50)
/// See `Hashable`.
public func hash(into hasher: inout Hasher) {
hasher.combine(self._hashValue)
}
#else
/// See `Hashable`.
public var hashValue: Int {
return self._hashValue
}
#endif

private let _hashValue: Int

/// Lowercased-ASCII version of the header.
internal let lowercased: String

/// Create a HTTP header name with the provided String.
public init(_ name: String) {
let lowercased = name.lowercased()
self.lowercased = lowercased
self.hashValue = lowercased.hashValue
self._hashValue = lowercased.hashValue
}

/// See `ExpressibleByStringLiteral.init(stringLiteral:)`
Expand Down

0 comments on commit 8da7d47

Please sign in to comment.