Skip to content

alignOf ​

SignaturealignOf<T>(): usize

alignOf returns the byte boundary required to store a primitive type. An f64 has alignment 8, so its address must be a multiple of 8. The compiler inserts padding inside structs when needed to satisfy this requirement. It is evaluated at compile time.

tyrus
import { alignOf } from "tyrus:memory";

print(alignOf<f64>()); // 8

It accepts integer types, floating-point types, boolean, and char. Managed values such as string and dynamic arrays are rejected.