Contents

ConvertibleToBytes

A protocol for types whose memory can safely be read as individual raw bytes.

Declaration

protocol ConvertibleToBytes

Overview

A type can conform to ConvertibleToBytes if its memory representation includes no padding. The sum of the size of its stored properties must be equal to its stride.

A type that conforms to ConvertibleToBytes must have:

  • one or more stored properties,

  • all of its stored properties have a type which conforms to ConvertibleToBytes,

  • its stored properties are stored contiguously in memory, with no padding,

  • none of its values disregards a subset of its bytes, making most enums ineligible.

See Also

Safe Access to Raw Bytes