pub fn alloc_size(
ty: &AirType,
types: &BTreeMap<TypeId, AirType>,
) -> Option<u64>Expand description
Returns the allocation size in bytes for a type.
Uses a default pointer width of 8 bytes (64-bit). For target-aware layout,
use alloc_size_with_ptr.
Returns None for Opaque types, variable-length arrays, or types that
reference unknown TypeIds.
ยงSize rules
Pointer/Reference-> 8Integer { bits }->ceil(bits / 8)Float { bits }->bits / 8(minimum 4)Vector { element, lanes }->alloc_size(element) * lanesArray { element, count: Some(n) }->n * alloc_size(element)Array { element, count: None }->None(VLA)Struct { total_size, .. }->total_sizeVoid-> 0Function { .. }-> 0 (function types have no allocation size)Opaque->None