Skip to content

sizeOf ​

SignaturesizeOf<T>(): usize

sizeOf returns the number of bytes occupied by a primitive type. It is evaluated at compile time.

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

print(sizeOf<i32>()); // 4

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