|
|
|
@ -11,10 +11,10 @@ Primitives are usually aligned to their size, although this is
|
|
|
|
|
platform-specific behavior. For example, on x86 `u64` and `f64` are often
|
|
|
|
|
aligned to 4 bytes (32 bits).
|
|
|
|
|
|
|
|
|
|
A type's size must always be a multiple of its alignment. This ensures that an
|
|
|
|
|
array of that type may always be indexed by offsetting by a multiple of its
|
|
|
|
|
size. Note that the size and alignment of a type may not be known
|
|
|
|
|
statically in the case of [dynamically sized types][dst].
|
|
|
|
|
A type's size must always be a multiple of its alignment (Zero being a valid size
|
|
|
|
|
for any alignment). This ensures that an array of that type may always be indexed
|
|
|
|
|
by offsetting by a multiple of its size. Note that the size and alignment of a
|
|
|
|
|
type may not be known statically in the case of [dynamically sized types][dst].
|
|
|
|
|
|
|
|
|
|
Rust gives you the following ways to lay out composite data:
|
|
|
|
|
|
|
|
|
|