Contents

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 == UInt8

Parameters

  • source:

    A collection of UInt8 elements. source.count must be less than or equal to this buffer’s count.

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.