Skip to content

Commit 29250b8

Browse files
Apply suggestions from code review
Co-authored-by: Ben Rimmington <[email protected]>
1 parent b344f40 commit 29250b8

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

proposals/NNNN-temporary-buffers.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ A new free function would be introduced in the Standard Library:
124124
/// the buffer) must not escape—it will be deallocated when `body` returns and
125125
/// cannot be used afterward.
126126
@_transparent
127-
public func withUnsafeUninitializedMutableBufferPointer<T, R>(to type: T.Type, capacity: Int, _ body: (UnsafeMutableBufferPointer<T>) throws -> R) rethrows -> R
127+
public func withUnsafeUninitializedMutableBufferPointer<T, R>(
128+
to type: T.Type,
129+
capacity: Int,
130+
_ body: (UnsafeMutableBufferPointer<T>) throws -> R
131+
) rethrows -> R
128132
```
129133

130134
We could optionally provide additional free functions for dealing with a raw buffer or a pointer to a single value. All of the proposed functions can be layered atop each other, so only one underlying implementation is ultimately needed:
@@ -162,7 +166,11 @@ We could optionally provide additional free functions for dealing with a raw buf
162166
/// the buffer) must not escape—it will be deallocated when `body` returns and
163167
/// cannot be used afterward.
164168
@_transparent
165-
public func withUnsafeUninitializedMutableRawBufferPointer<R>(byteCount: Int, alignment: Int, _ body: (UnsafeMutableRawBufferPointer) throws -> R) rethrows -> R
169+
public func withUnsafeUninitializedMutableRawBufferPointer<R>(
170+
byteCount: Int,
171+
alignment: Int,
172+
_ body: (UnsafeMutableRawBufferPointer) throws -> R
173+
) rethrows -> R
166174

167175
/// Provides scoped access to a pointer to memory of the specified type.
168176
///
@@ -187,7 +195,10 @@ public func withUnsafeUninitializedMutableRawBufferPointer<R>(byteCount: Int, al
187195
/// The pointer passed to `body` must not escape—it will be deallocated when
188196
/// `body` returns and cannot be used afterward.
189197
@_transparent
190-
public func withUnsafeUninitializedMutablePointer<T, R>(to type: T.Type, _ body: (UnsafeMutablePointer<T>) throws -> R) rethrows -> R
198+
public func withUnsafeUninitializedMutablePointer<T, R>(
199+
to type: T.Type,
200+
_ body: (UnsafeMutablePointer<T>) throws -> R
201+
) rethrows -> R
191202
```
192203

193204
Note the functions are marked `@_transparent` to ensure they are emitted into the calling frame. This is consistent with the annotations on most other pointer manipulation functions.

0 commit comments

Comments
 (0)