Update `Data.withUnsafeBytes(_:)` taking `(UnsafeRawBufferPointer) throws -> Result`

- Implemented on swift-5.0-DEVELOPMENT-SNAPSHOT-2018-12-16-a for macOS
- implemented on swift-5.0-DEVELOPMENT-SNAPSHOT-2019-01-28-a with swift-corelibs-foundation
- Not implemented on Xcode 10.2 beta 1 (canImport(Darwin) && !canImport(SwiftLang))
This commit is contained in:
Norio Nomura 2019-01-29 21:45:40 +09:00
parent e8dd69f2ad
commit 83f2ae99a4
No known key found for this signature in database
GPG Key ID: D4A7318EB7F7138D
1 changed files with 1 additions and 1 deletions

View File

@ -405,7 +405,7 @@ private func string(from pointer: UnsafePointer<UInt8>!) -> String? {
}
#if swift(>=4.2)
#if !compiler(>=5) || !canImport(Darwin)
#if !compiler(>=5) || (canImport(Darwin) && !canImport(SwiftLang)) // missing on Xcode 10.2 beta 1
private extension Data {
func withUnsafeBytes<Result>(_ apply: (UnsafeRawBufferPointer) throws -> Result) rethrows -> Result {
return try withUnsafeBytes {