mirror of
https://github.com/apple/swift-http-types
synced 2026-11-27 05:04:21 +00:00
Reduce Swift version requirement to 5.7
This commit is contained in:
1 parent
ae848811f9
commit
885b94bd13
5 files changed
+23
-5
No files matched your search
@@ -32,7 +32,11 @@ struct ISOLatin1String: Sendable, Hashable {
|
||||
try withUnsafeTemporaryAllocation(of: UInt8.self, capacity: self._storage.unicodeScalars.count) { buffer in
|
||||
for (index, scalar) in self._storage.unicodeScalars.enumerated() {
|
||||
assert(scalar.value <= UInt8.max)
|
||||
#if swift(>=5.8)
|
||||
buffer.initializeElement(at: index, to: UInt8(truncatingIfNeeded: scalar.value))
|
||||
#else
|
||||
buffer[index] = UInt8(truncatingIfNeeded: scalar.value)
|
||||
#endif
|
||||
}
|
||||
return try body(UnsafeBufferPointer(buffer))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user