17
17
/// provide the withUnsafeBufferPointer function.
18
18
@available ( iOS 9999 , macOS 9999 , tvOS 9999 , watchOS 9999 , * )
19
19
public protocol AccelerateBuffer {
20
- /// The buffer's element type.
21
- associatedtype Element
22
-
23
- /// The number of elements in the buffer.
24
- var count : Int { get }
25
-
26
- /// Calls a closure with a pointer to the object's contiguous storage.
27
- func withUnsafeBufferPointer< R> (
28
- _ body: ( UnsafeBufferPointer < Element > ) throws -> R
29
- ) rethrows -> R
20
+ /// The buffer's element type.
21
+ associatedtype Element
22
+
23
+ /// The number of elements in the buffer.
24
+ var count : Int { get }
25
+
26
+ /// Calls a closure with a pointer to the object's contiguous storage.
27
+ func withUnsafeBufferPointer< R> (
28
+ _ body: ( UnsafeBufferPointer < Element > ) throws -> R
29
+ ) rethrows -> R
30
30
}
31
31
32
32
/// A mutable object composed of count elements that are stored contiguously
@@ -36,29 +36,29 @@ public protocol AccelerateBuffer {
36
36
/// MutableCollections, but they need not be.
37
37
@available ( iOS 9999 , macOS 9999 , tvOS 9999 , watchOS 9999 , * )
38
38
public protocol AccelerateMutableBuffer : AccelerateBuffer {
39
- /// Calls the given closure with a pointer to the object's mutable
40
- /// contiguous storage.
41
- mutating func withUnsafeMutableBufferPointer< R> (
42
- _ body: ( inout UnsafeMutableBufferPointer < Element > ) throws -> R
43
- ) rethrows -> R
39
+ /// Calls the given closure with a pointer to the object's mutable
40
+ /// contiguous storage.
41
+ mutating func withUnsafeMutableBufferPointer< R> (
42
+ _ body: ( inout UnsafeMutableBufferPointer < Element > ) throws -> R
43
+ ) rethrows -> R
44
44
}
45
45
46
46
@available ( iOS 9999 , macOS 9999 , tvOS 9999 , watchOS 9999 , * )
47
47
public extension AccelerateBuffer where Self: Collection {
48
- func withUnsafeBufferPointer< R> (
49
- _ body: ( UnsafeBufferPointer < Element > ) throws -> R
50
- ) rethrows -> R {
51
- return try withContiguousStorageIfAvailable ( body) !
52
- }
48
+ func withUnsafeBufferPointer< R> (
49
+ _ body: ( UnsafeBufferPointer < Element > ) throws -> R
50
+ ) rethrows -> R {
51
+ return try withContiguousStorageIfAvailable ( body) !
52
+ }
53
53
}
54
54
55
55
@available ( iOS 9999 , macOS 9999 , tvOS 9999 , watchOS 9999 , * )
56
56
extension AccelerateMutableBuffer where Self: MutableCollection {
57
- public mutating func withUnsafeMutableBufferPointer< R> (
58
- _ body: ( inout UnsafeMutableBufferPointer < Element > ) throws -> R
59
- ) rethrows -> R {
60
- return try withContiguousMutableStorageIfAvailable ( body) !
61
- }
57
+ public mutating func withUnsafeMutableBufferPointer< R> (
58
+ _ body: ( inout UnsafeMutableBufferPointer < Element > ) throws -> R
59
+ ) rethrows -> R {
60
+ return try withContiguousMutableStorageIfAvailable ( body) !
61
+ }
62
62
}
63
63
64
64
@available ( iOS 9999 , macOS 9999 , tvOS 9999 , watchOS 9999 , * )
0 commit comments