wasmtime_environ

Trait GcTypeLayouts

Source
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§

Source

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.

Source

fn array_layout(&self, ty: &WasmArrayType) -> GcArrayLayout

Get this collector’s layout for the given array type.

Source

fn struct_layout(&self, ty: &WasmStructType) -> GcStructLayout

Get this collector’s layout for the given struct type.

Provided Methods§

Source

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.

Implementors§