copyBytes(from:)
Copies from a collection of UInt8 into this buffer’s memory.
Declaration
func copyBytes<C>(from source: C) where C : Collection, C.Element == UInt8Parameters
- source:
A collection of
UInt8elements.source.countmust be less than or equal to this buffer’scount.
Discussion
If the first source.count bytes of memory referenced by this buffer are bound to a type T, then T must be a trivial type, the underlying pointer must be properly aligned for accessing T, and source.count must be a multiple of MemoryLayout<T>.stride.
After calling copyBytes(from:), the first source.count bytes of memory referenced by this buffer are initialized to raw bytes. If the memory is bound to type T, then it contains values of type T.