Wasm::Wasmtime::Store - Wasmtime store class
version 0.24
use Wasm::Wasmtime; my $store = Wasm::Wasmtime::Store->new;
WARNING: WebAssembly and Wasmtime are a moving target and the interface for these modules is under active development. Use with caution.
This class represents storage used by the WebAssembly engine. In the modern Wasmtime C API almost every operation on a live WebAssembly object (function, memory, global, table, instance) is performed relative to a store, via its wasmtime_context_t. The "context" method exposes that pointer for internal use by the other Wasm::Wasmtime classes.
my $store = Wasm::Wasmtime::Store->new; my $store = Wasm::Wasmtime::Store->new( $engine, # Wasm::Wasmtime::Engine );
Creates a new storage instance. If the optional Wasm::Wasmtime::Engine object isn't provided, then a new one will be created.
my $context = $store->context;
Returns the wasmtime_context_t pointer (an opaque) for this store. This is primarily for internal use by other Wasm::Wasmtime classes.
my $engine = $store->engine;
Returns the Wasm::Wasmtime::Engine object for this storage object.
$store->gc;
Garbage collects externrefs that are used within this store.
$store->set_fuel($fuel);
Sets the amount of fuel available for WebAssembly to consume while executing. Requires that the engine was configured with $config->consume_fuel(1).
my $fuel = $store->get_fuel;
Returns the amount of fuel remaining in this store.
$store->set_wasi($wasi_config);
Configures the WASI state for instances created within this store. Takes ownership of the Wasm::Wasmtime::WasiConfig object (it must not be used afterwards).
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2020-2026 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.