var baseAddress: UnsafeMutableRawPointer?
A pointer to the first byte of the buffer.
var count: Int
The number of bytes in the buffer.
var debugDescription: String
A textual representation of the buffer, suitable for debugging.
var endIndex: UnsafeMutableRawBufferPointer.Index
The “past the end” position—that is, the position one greater than the last valid subscript argument.
var indices: UnsafeMutableRawBufferPointer.Indices
var startIndex: UnsafeMutableRawBufferPointer.Index
Always zero, which is the index of the first byte in a nonempty buffer.
subscript(Range<Int>) -> UnsafeMutableRawBufferPointer.SubSequence
Accesses the bytes in the specified memory region.
subscript(Int) -> UnsafeMutableRawBufferPointer.Element
Accesses the byte at the given offset in the memory region as a UInt8
value.
func assumingMemoryBound<T>(to: T.Type) -> UnsafeMutableBufferPointer<T>
Returns a typed buffer to the memory referenced by this buffer, assuming that the memory is already bound to the specified type.
func bindMemory<T>(to: T.Type) -> UnsafeMutableBufferPointer<T>
Binds this buffer’s memory to the specified type and returns a typed buffer of the bound memory.
func copyBytes<C>(from: C)
Copies from a collection of UInt8
into this buffer’s memory.
func copyMemory(from: UnsafeRawBufferPointer)
Copies the bytes from the given buffer to this buffer’s memory.
func deallocate()
Deallocates the memory block previously allocated at this buffer pointer’s base address.
func initializeMemory<S>(as: S.Element.Type, from: S) -> (unwritten: S.Iterator, initialized: UnsafeMutableBufferPointer<S.Element>)
Initializes the buffer’s memory with the given elements, binding the initialized memory to the elements’ type.
func initializeMemory<C>(as: C.Element.Type, fromContentsOf: C) -> UnsafeMutableBufferPointer<C.Element>
Initializes the buffer’s memory with every element of the source, binding the initialized memory to the elements’ type.
func initializeMemory<T>(as: T.Type, repeating: T) -> UnsafeMutableBufferPointer<T>
Initializes the memory referenced by this buffer with the given value, binds the memory to the value’s type, and returns a typed buffer of the initialized memory.
func load<T>(fromByteOffset: Int, as: T.Type) -> T
Returns a new instance of the given type, read from the buffer pointer’s raw memory at the specified byte offset.
func loadUnaligned<T>(fromByteOffset: Int, as: T.Type) -> T
func loadUnaligned<T>(fromByteOffset: Int, as: T.Type) -> T
Returns a new instance of the given type, constructed from the raw memory at the specified offset.
func makeIterator() -> UnsafeMutableRawBufferPointer.Iterator
Returns an iterator over the bytes of this sequence.
func moveInitializeMemory<T>(as: T.Type, fromContentsOf: UnsafeMutableBufferPointer<T>) -> UnsafeMutableBufferPointer<T>
Moves every element of an initialized source buffer into the uninitialized memory referenced by this buffer, leaving the source memory uninitialized and this buffer’s memory initialized.
func moveInitializeMemory<T>(as: T.Type, fromContentsOf: Slice<UnsafeMutableBufferPointer<T>>) -> UnsafeMutableBufferPointer<T>
Moves every element of an initialized source buffer slice into the uninitialized memory referenced by this buffer, leaving the source memory uninitialized and this buffer’s memory initialized.
func storeBytes<T>(of: T, toByteOffset: Int, as: T.Type)
Stores a value’s bytes into the buffer pointer’s raw memory at the specified byte offset.
func swapAt(Int, Int)
Exchanges the byte values at the specified indices in this buffer’s memory.
func withContiguousMutableStorageIfAvailable<R>((inout UnsafeMutableBufferPointer<UnsafeMutableRawBufferPointer.Element>) throws -> R) rethrows -> R?
func withContiguousStorageIfAvailable<R>((UnsafeBufferPointer<UnsafeMutableRawBufferPointer.Element>) throws -> R) rethrows -> R?
func withMemoryRebound<T, E, Result>(to: T.Type, (UnsafeMutableBufferPointer<T>) throws(E) -> Result) throws(E) -> Result
Executes the given closure while temporarily binding the buffer to instances of type T
.