pub trait GcTypeLayouts {
// Required methods
fn array_length_field_offset(&self) -> u32;
fn exception_tag_instance_offset(&self) -> u32;
fn exception_tag_defined_offset(&self) -> u32;
fn array_layout(&self, ty: &WasmArrayType) -> GcArrayLayout;
fn struct_layout(
&self,
ty: &WasmStructType,
) -> Result<GcStructLayout, OutOfMemory>;
fn exn_layout(
&self,
ty: &WasmExnType,
) -> Result<GcStructLayout, OutOfMemory>;
// Provided method
fn gc_layout(
&self,
ty: &WasmCompositeType,
) -> Result<Option<GcLayout>, OutOfMemory> { ... }
}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 exception_tag_instance_offset(&self) -> u32
fn exception_tag_instance_offset(&self) -> u32
The offset of an exception object’s tag reference: defining instance index field.
This must be the same for all exception objects in the heap, regardless of their specific signature.
Sourcefn exception_tag_defined_offset(&self) -> u32
fn exception_tag_defined_offset(&self) -> u32
The offset of an exception object’s tag reference: defined tag index field.
This must be the same for all exception objects in the heap, regardless of their specific signature.
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,
) -> Result<GcStructLayout, OutOfMemory>
fn struct_layout( &self, ty: &WasmStructType, ) -> Result<GcStructLayout, OutOfMemory>
Get this collector’s layout for the given struct type.
Sourcefn exn_layout(&self, ty: &WasmExnType) -> Result<GcStructLayout, OutOfMemory>
fn exn_layout(&self, ty: &WasmExnType) -> Result<GcStructLayout, OutOfMemory>
Get this collector’s layout for the given exception type.
Provided Methods§
Sourcefn gc_layout(
&self,
ty: &WasmCompositeType,
) -> Result<Option<GcLayout>, OutOfMemory>
fn gc_layout( &self, ty: &WasmCompositeType, ) -> Result<Option<GcLayout>, OutOfMemory>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".