Trait wasmtime_environ::InitMemory
source · pub trait InitMemory {
// Required methods
fn memory_size_in_pages(&mut self, memory_index: MemoryIndex) -> u64;
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§
sourcefn memory_size_in_pages(&mut self, memory_index: MemoryIndex) -> u64
fn memory_size_in_pages(&mut self, memory_index: MemoryIndex) -> u64
Returns the size, in wasm pages, of the the memory specified. For compile-time purposes this would be the memory type’s minimum size.
sourcefn eval_offset(
&mut self,
memory_index: MemoryIndex,
expr: &ConstExpr
) -> Option<u64>
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.
sourcefn write(
&mut self,
memory_index: MemoryIndex,
init: &StaticMemoryInitializer
) -> bool
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.