Module checked

Module checked 

Source
Expand description

Definitions for checked, safe variants of methods defined on Store and Linker.

This module defines extensions in the form of new types and new methods. It only relies on the fact that the Store and the Linker both store a StoreId. No other changes are required to be made to the main interpreter for this checked API.

All extension methods defined in this module use special stored objects. These objects are essentially normal objects like FuncAddr, RunState or Value. However, they also contain an additional field of type StoreId as a tag to know to which Store they belong to.

While this is easy for address types like FuncAddr or MemAddr, some types are enums and their variants are visible to the user. For example, consider the Value enum, where users have full access to all of its variants. To be able to attach a tag only to the Value::Ref variant of this enum, the entire enum has to be re-defined. The result is a completely new type StoredValue.

Re-exportsยง

pub use interop::*;
pub use value::*;

Modulesยง

interop ๐Ÿ”’
value ๐Ÿ”’

Structsยง

Stored
A generic stored wrapper. This is used to wrap struct types such as FuncAddr, MemAddr, etc.
StoredInstantiationOutcome
A stored variant of InstantiationOutcome

Enumsยง

StoredExternVal
A stored variant of ExternVal
StoredRunState
A stored variant of RunState

Traitsยง

AbstractStored ๐Ÿ”’
A trait for types that might have a StoreId attached to them, so-called stored types.

Functionsยง

try_unwrap_values ๐Ÿ”’
Helper method for checking if all Values in a slice have the given StoreId and then, if the check was true, converting them to a Vec<Value>.
wrap_vec_elements ๐Ÿ”’ โš 
Helper method for associating every element in a Vec with a StoreId.