pub trait GcTypeLayouts {
// Required methods
fn array_length_field_offset(&self) -> u32;
fn array_layout(&self, ty: &WasmArrayType) -> GcArrayLayout;
fn struct_layout(&self, ty: &WasmStructType) -> GcStructLayout;
// Provided method
fn gc_layout(&self, ty: &WasmCompositeType) -> Option<GcLayout> { ... }
}
Expand description
A trait for getting the layout of a Wasm GC struct or array inside a particular collector.
Required Methods§
sourcefn array_length_field_offset(&self) -> u32
fn array_length_field_offset(&self) -> u32
The offset of an array’s length field.
This must be the same for all arrays in the heap, regardless of their element type.
sourcefn array_layout(&self, ty: &WasmArrayType) -> GcArrayLayout
fn array_layout(&self, ty: &WasmArrayType) -> GcArrayLayout
Get this collector’s layout for the given array type.
sourcefn struct_layout(&self, ty: &WasmStructType) -> GcStructLayout
fn struct_layout(&self, ty: &WasmStructType) -> GcStructLayout
Get this collector’s layout for the given struct type.
Provided Methods§
sourcefn gc_layout(&self, ty: &WasmCompositeType) -> Option<GcLayout>
fn gc_layout(&self, ty: &WasmCompositeType) -> Option<GcLayout>
Get this collector’s layout for the given composite type.
Returns None
if the type is a function type, as functions are not
managed by the GC.