1414
1515/// Indicates that the conforming type is a contiguous collection of raw bytes
1616/// whose underlying storage is directly accessible by withUnsafeBytes.
17- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
17+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
1818public protocol ContiguousBytes {
1919 /// Calls the given closure with the contents of underlying storage.
2020 ///
@@ -28,28 +28,28 @@ public protocol ContiguousBytes {
2828//===--- Collection Conformances ------------------------------------------===//
2929
3030// FIXME: When possible, expand conformance to `where Element : Trivial`.
31- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
31+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
3232extension Array : ContiguousBytes where Element == UInt8 { }
3333
3434// FIXME: When possible, expand conformance to `where Element : Trivial`.
35- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
35+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
3636extension ArraySlice : ContiguousBytes where Element == UInt8 { }
3737
3838// FIXME: When possible, expand conformance to `where Element : Trivial`.
39- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
39+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
4040extension ContiguousArray : ContiguousBytes where Element == UInt8 { }
4141
4242//===--- Pointer Conformances ---------------------------------------------===//
4343
44- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
44+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
4545extension UnsafeRawBufferPointer : ContiguousBytes {
4646 @inlinable
4747 public func withUnsafeBytes< R> ( _ body: ( UnsafeRawBufferPointer ) throws -> R ) rethrows -> R {
4848 return try body ( self )
4949 }
5050}
5151
52- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
52+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
5353extension UnsafeMutableRawBufferPointer : ContiguousBytes {
5454 @inlinable
5555 public func withUnsafeBytes< R> ( _ body: ( UnsafeRawBufferPointer ) throws -> R ) rethrows -> R {
@@ -58,7 +58,7 @@ extension UnsafeMutableRawBufferPointer : ContiguousBytes {
5858}
5959
6060// FIXME: When possible, expand conformance to `where Element : Trivial`.
61- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
61+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
6262extension UnsafeBufferPointer : ContiguousBytes where Element == UInt8 {
6363 @inlinable
6464 public func withUnsafeBytes< R> ( _ body: ( UnsafeRawBufferPointer ) throws -> R ) rethrows -> R {
@@ -67,7 +67,7 @@ extension UnsafeBufferPointer : ContiguousBytes where Element == UInt8 {
6767}
6868
6969// FIXME: When possible, expand conformance to `where Element : Trivial`.
70- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
70+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
7171extension UnsafeMutableBufferPointer : ContiguousBytes where Element == UInt8 {
7272 @inlinable
7373 public func withUnsafeBytes< R> ( _ body: ( UnsafeRawBufferPointer ) throws -> R ) rethrows -> R {
@@ -76,7 +76,7 @@ extension UnsafeMutableBufferPointer : ContiguousBytes where Element == UInt8 {
7676}
7777
7878// FIXME: When possible, expand conformance to `where Element : Trivial`.
79- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
79+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
8080extension EmptyCollection : ContiguousBytes where Element == UInt8 {
8181 @inlinable
8282 public func withUnsafeBytes< R> ( _ body: ( UnsafeRawBufferPointer ) throws -> R ) rethrows -> R {
@@ -85,7 +85,7 @@ extension EmptyCollection : ContiguousBytes where Element == UInt8 {
8585}
8686
8787// FIXME: When possible, expand conformance to `where Element : Trivial`.
88- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
88+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
8989extension CollectionOfOne : ContiguousBytes where Element == UInt8 {
9090 @inlinable
9191 public func withUnsafeBytes< R> ( _ body: ( UnsafeRawBufferPointer ) throws -> R ) rethrows -> R {
@@ -98,7 +98,7 @@ extension CollectionOfOne : ContiguousBytes where Element == UInt8 {
9898
9999//===--- Conditional Conformances -----------------------------------------===//
100100
101- @available ( macOS 10 . 10 , iOS 8 . 0 , * )
101+ @available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * )
102102extension Slice : ContiguousBytes where Base : ContiguousBytes {
103103 public func withUnsafeBytes< ResultType> ( _ body: ( UnsafeRawBufferPointer ) throws -> ResultType ) rethrows -> ResultType {
104104 let offset = base. distance ( from: base. startIndex, to: self . startIndex)
0 commit comments