File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -1207,11 +1207,23 @@ extension ${Self} {
1207
1207
/// of the closure's execution.
1208
1208
/// - Returns: The return value, if any, of the `body` closure.
1209
1209
@inlinable
1210
- public func withUnsafeMutableBytes< T, Result> (
1210
+ @_alwaysEmitIntoClient
1211
+ public func withUnsafeMutableBytes< T, E: Error , Result> (
1212
+ of value: inout T ,
1213
+ _ body: ( UnsafeMutableRawBufferPointer ) throws ( E ) -> Result
1214
+ ) throws ( E) -> Result {
1215
+ let pointer = UnsafeMutableRawPointer ( Builtin . addressof ( & value) )
1216
+ return try body ( . init( start: pointer, count: MemoryLayout< T> . size) )
1217
+ }
1218
+
1219
+ /// ABI: Historical withUnsafeMutableBytes(of:_:) rethrows,
1220
+ /// expressed as "throws", which is ABI-compatible with "rethrows".
1221
+ @_silgen_name ( " $ss22withUnsafeMutableBytes2of_q_xz_q_SwKXEtKr0_lF " )
1222
+ @usableFromInline
1223
+ func __abi_se0413_withUnsafeMutableBytes< T, Result> (
1211
1224
of value: inout T ,
1212
1225
_ body: ( UnsafeMutableRawBufferPointer ) throws -> Result
1213
- ) rethrows -> Result
1214
- {
1226
+ ) throws -> Result {
1215
1227
return try withUnsafeMutablePointer ( to: & value) {
1216
1228
return try body ( UnsafeMutableRawBufferPointer (
1217
1229
start: $0, count: MemoryLayout< T> . size) )
You can’t perform that action at this time.
0 commit comments