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§