Contents

init(viewing:)

View initialized raw memory as a typed span.

Declaration

init(viewing bytes: RawSpan) where Element : ConvertibleFromBytes

Parameters

  • bytes:

    An existing RawSpan, which will define both this Span’s lifetime and the memory it represents.

Discussion

The byteCount of bytes must be a multiple of Element’s stride, and the starting address of bytes must be well-aligned for the type of Element. If either of these requirements is not met, this initializer will trap at runtime.