5#ifndef WASMTIME_MEMORY_HH
6#define WASMTIME_MEMORY_HH
39 if (error !=
nullptr) {
73 if (error !=
nullptr) {
Errors coming from Wasmtime.
Definition: error.hh:25
A WebAssembly instance.
Definition: instance.hh:31
Type information about a WebAssembly linear memory.
Definition: types/memory.hh:18
A WebAssembly linear memory.
Definition: memory.hh:27
Memory(wasmtime_memory_t memory)
Creates a new memory from the raw underlying C API representation.
Definition: memory.hh:33
static Result< Memory > create(Store::Context cx, const MemoryType &ty)
Creates a new host-defined memory with the type specified.
Definition: memory.hh:36
const wasmtime_memory_t & capi() const
Returns the raw underlying C API memory this is using.
Definition: memory.hh:80
Span< uint8_t > data(Store::Context cx) const
Definition: memory.hh:60
MemoryType type(Store::Context cx) const
Returns the type of this memory.
Definition: memory.hh:46
uint64_t size(Store::Context cx) const
Returns the size, in WebAssembly pages, of this memory.
Definition: memory.hh:51
Result< uint64_t > grow(Store::Context cx, uint64_t delta) const
Definition: memory.hh:70
Fallible result type used for Wasmtime.
Definition: error.hh:82
Span class used when c++20 is not available.
Definition: span.hh:47
An interior pointer into a Store.
Definition: store.hh:60
uint8_t * wasmtime_memory_data(const wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the base pointer in memory where the linear memory starts.
wasmtime_error_t * wasmtime_memory_grow(wasmtime_context_t *store, const wasmtime_memory_t *memory, uint64_t delta, uint64_t *prev_size)
Attempts to grow the specified memory by delta pages.
wasmtime_error_t * wasmtime_memory_new(wasmtime_context_t *store, const wasm_memorytype_t *ty, wasmtime_memory_t *ret)
Creates a new WebAssembly linear memory.
size_t wasmtime_memory_data_size(const wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the byte length of this linear memory.
uint64_t wasmtime_memory_size(const wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the length, in WebAssembly pages, of this linear memory.
wasm_memorytype_t * wasmtime_memory_type(const wasmtime_context_t *store, const wasmtime_memory_t *memory)
Returns the type of the memory specified.
Representation of a memory in Wasmtime.
Definition: extern.h:57