mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
add missing stdlib Span extension
This commit is contained in:
1 parent
6d0848fc7f
commit
46df103786
1 file changed
+8
@@ -493,4 +493,12 @@ extension Span where Element: BitwiseCopyable {
|
||||
}
|
||||
}
|
||||
|
||||
extension RawSpan {
|
||||
public consuming func withBytes<E: Error, Result: ~Copyable>(
|
||||
_ body: (_ elements: RawSpan) throws(E) -> Result
|
||||
) throws(E) -> Result {
|
||||
try body(self)
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: extend SIMD vectors with `withSpan` and with `withBytes`.
|
||||
Reference in new issue
Block a user