add missing stdlib Span extension

This commit is contained in:
Guillaume Lessard authored and Guillaume Lessard committed 2024-10-06 10:24:55 -07:00
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`.