Swift 5.1 support
Use stdlib Result instead of TAsyncResult
Fix: deprecations for `withUnsafeBytes`
Bump CI job Xcode version
Hash (into)
Co-authored-by: Sophie Lambrakis <SLambrakis@users.noreply.github.com>
Co-authored-by: Alexander Edge <alex@alexedge.co.uk>
diff --git a/lib/swift/Sources/TList.swift b/lib/swift/Sources/TList.swift
index c239d10..1508d90 100644
--- a/lib/swift/Sources/TList.swift
+++ b/lib/swift/Sources/TList.swift
@@ -17,7 +17,7 @@
* under the License.
*/
-public struct TList<Element : TSerializable> : RandomAccessCollection, MutableCollection, ExpressibleByArrayLiteral, TSerializable, Hashable {
+public struct TList<Element : TSerializable & Hashable> : RandomAccessCollection, MutableCollection, ExpressibleByArrayLiteral, TSerializable, Hashable {
public typealias Storage = Array<Element>
public typealias Indices = Storage.Indices
@@ -31,13 +31,8 @@
}
/// Mark: Hashable
- public var hashValue : Int {
- let prime = 31
- var result = 1
- for element in storage {
- result = prime &* result &+ element.hashValue
- }
- return result
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(storage)
}
/// Mark: TSerializable