withContiguousStorageIfAvailable(_:)
func withContiguousStorageIfAvailable<R>(_ body: (UnsafeBufferPointer<Element>) throws -> R) rethrows -> R? func withContiguousStorageIfAvailable<R>(_ body: (UnsafeBufferPointer<Element>) throws -> R) rethrows -> R? sSR32withContiguousStorageIfAvailableyqd__Sgqd__SRyxGKXEKlF What are these?9DSX3import Swift@frozen struct UnsafeBufferPointer<Element> where Element : ~CopyableA nonowning collection interface to a buffer of elements stored contiguously in memory.
init(_ other: UnsafeMutableBufferPointer<Element>) Creates an immutable typed buffer pointer referencing the same memory as the given mutable buffer pointer.
init(rebasing slice: Slice<UnsafeBufferPointer<Element>>) Creates a buffer over the same memory as the given buffer slice.
init(rebasing slice: Slice<UnsafeMutableBufferPointer<Element>>) Creates a buffer over the same memory as the given buffer slice.
init(start: UnsafePointer<Element>?, count: Int) Creates a new buffer pointer over the specified number of contiguous instances beginning at the given pointer.
var baseAddress: UnsafePointer<Element>? { get }A pointer to the first element of the buffer.
let count: IntThe number of elements in the buffer.
var debugDescription: String { get }A textual representation of the buffer, suitable for debugging.
var endIndex: Int { get }The “past the end” position—that is, the position one greater than the last valid subscript argument.
var indices: Range<Int> { get }var isEmpty: Bool { get }A Boolean value indicating whether the buffer is empty.
var span: Span<Element> { get }var startIndex: Int { get }The index of the first element in a nonempty buffer.
subscript(i: Int) -> Element { get } Accesses the element at the specified position.
subscript(bounds: Range<Int>) -> Slice<UnsafeBufferPointer<Element>> { get } Accesses a contiguous subrange of the buffer’s elements.
subscript(i: Int) -> Element { get } Accesses the element at the specified position.
func deallocate() Deallocates the memory block previously allocated at this buffer pointer’s base address.
func distance(from start: Int, to end: Int) -> Int func extracting(_ bounds: Range<Int>) -> UnsafeBufferPointer<Element> Constructs a standalone buffer pointer over the items within the supplied range of positions in the memory region addressed by this buffer pointer.
func extracting(_ bounds: some RangeExpression<Int>) -> UnsafeBufferPointer<Element> Constructs a standalone buffer pointer over the items within the supplied range of positions in the memory region addressed by this buffer pointer.
func extracting(_ bounds: (UnboundedRange_) -> ()) -> UnsafeBufferPointer<Element> Extracts and returns a copy of the entire buffer.
func formIndex(after i: inout Int) func formIndex(before i: inout Int) func index(_ i: Int, offsetBy n: Int) -> Int func index(_ i: Int, offsetBy n: Int, limitedBy limit: Int) -> Int? func index(after i: Int) -> Int func index(before i: Int) -> Int func makeIterator() -> UnsafeBufferPointer<Element>.Iterator Returns an iterator over the elements of this buffer.
func withMemoryRebound<T, E, Result>(to type: T.Type, _ body: (UnsafeBufferPointer<T>) throws(E) -> Result) throws(E) -> Result where E : Error, T : ~Copyable, Result : ~Copyable Executes the given closure while temporarily binding the memory referenced by this buffer to the given type.
@frozen struct IteratorAn iterator for the elements in the buffer referenced by an UnsafeBufferPointer or UnsafeMutableBufferPointer instance.
typealias Index = Inttypealias Indices = Range<Int>typealias SubSequence = Slice<UnsafeBufferPointer<Element>>