wasmtime_environ

Trait InitMemory

source
pub trait InitMemory {
    // Required methods
    fn memory_size_in_bytes(
        &mut self,
        memory_index: MemoryIndex,
    ) -> Result<u64, SizeOverflow>;
    fn eval_offset(
        &mut self,
        memory_index: MemoryIndex,
        expr: &ConstExpr,
    ) -> Option<u64>;
    fn write(
        &mut self,
        memory_index: MemoryIndex,
        init: &StaticMemoryInitializer,
    ) -> bool;
}
Expand description

The various callbacks provided here are used to drive the smaller bits of memory initialization.

Required Methods§

source

fn memory_size_in_bytes( &mut self, memory_index: MemoryIndex, ) -> Result<u64, SizeOverflow>

Returns the size, in bytes, of the memory specified. For compile-time purposes this would be the memory type’s minimum size.

source

fn eval_offset( &mut self, memory_index: MemoryIndex, expr: &ConstExpr, ) -> Option<u64>

Returns the value of the constant expression, as a u64. Note that this may involve zero-extending a 32-bit global to a 64-bit number. May return None to indicate that the expression involves a value which is not available yet.

source

fn write( &mut self, memory_index: MemoryIndex, init: &StaticMemoryInitializer, ) -> bool

A callback used to actually write data. This indicates that the specified memory must receive the specified range of data at the specified offset. This can return false on failure.

Implementors§