We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Span.withUnsafeBytes()
1 parent ed6bf06 commit 88fb80fCopy full SHA for 88fb80f
stdlib/public/core/Span/Span.swift
@@ -703,7 +703,9 @@ extension Span where Element: BitwiseCopyable {
703
public func withUnsafeBytes<E: Error, Result: ~Copyable>(
704
_ body: (_ buffer: UnsafeRawBufferPointer) throws(E) -> Result
705
) throws(E) -> Result {
706
- try RawSpan(_elements: self).withUnsafeBytes(body)
+ try body(
707
+ .init(start: _pointer, count: _count * MemoryLayout<Element>.stride)
708
+ )
709
}
710
711
0 commit comments