File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
test/api-digester/Outputs Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -366,6 +366,10 @@ public protocol Sequence {
366
366
func withContiguousStorageIfAvailable< R> (
367
367
_ body: ( UnsafeBufferPointer < Element > ) throws -> R
368
368
) rethrows -> R ?
369
+
370
+ func _withRawContiguousStorageIfAvailable< R> (
371
+ _ body: ( UnsafeRawBufferPointer ) throws -> R
372
+ ) rethrows -> R ?
369
373
}
370
374
371
375
// Provides a default associated type witness for Iterator when the
@@ -1111,6 +1115,15 @@ extension Sequence {
1111
1115
) rethrows -> R ? {
1112
1116
return nil
1113
1117
}
1118
+
1119
+ @inlinable
1120
+ public func _withRawContiguousStorageIfAvailable< R> (
1121
+ _ body: ( UnsafeRawBufferPointer ) throws -> R
1122
+ ) rethrows -> R ? {
1123
+ return try withContiguousStorageIfAvailable {
1124
+ try body ( UnsafeRawBufferPointer ( $0) )
1125
+ }
1126
+ }
1114
1127
}
1115
1128
1116
1129
// FIXME(ABI)#182
Original file line number Diff line number Diff line change @@ -145,6 +145,17 @@ extension Unsafe${Mutable}RawBufferPointer: Sequence {
145
145
public func makeIterator( ) -> Iterator {
146
146
return Iterator ( _position: _position, _end: _end)
147
147
}
148
+
149
+ @inlinable @inline ( __always)
150
+ public func _withRawContiguousStorageIfAvailable< R> (
151
+ _ body: ( UnsafeRawBufferPointer ) throws -> R
152
+ ) rethrows -> R ? {
153
+ % if not mutable:
154
+ return try body ( self )
155
+ % else :
156
+ return try body ( UnsafeRawBufferPointer ( self ) )
157
+ % end
158
+ }
148
159
}
149
160
150
161
extension Unsafe ${ Mutable} RawBufferPointer: ${ Mutable} Collection {
Original file line number Diff line number Diff line change @@ -95,3 +95,4 @@ Struct String has removed conformance to _HasContiguousBytes
95
95
Struct Substring has removed conformance to _HasContiguousBytes
96
96
Var String._providesContiguousBytesNoCopy has been removed
97
97
Var Substring._providesContiguousBytesNoCopy has been removed
98
+ Func Sequence._withRawContiguousStorageIfAvailable(_:) has been added as a protocol requirement
You can’t perform that action at this time.
0 commit comments