wasmtime_context_set_fuel function

  1. @Native<Pointer<wasmtime_error_t> Function(Pointer<wasmtime_context_t>, Uint64)>(ffi.Pointer<wasmtime_context_t>, ffi.Uint64)>()
Pointer<wasmtime_error_t> wasmtime_context_set_fuel(
  1. Pointer<wasmtime_context_t> store,
  2. int fuel
)

\brief Set fuel to this context's store for wasm to consume while executing.

For this method to work fuel consumption must be enabled via #wasmtime_config_consume_fuel_set. By default a store starts with 0 fuel for wasm to execute with (meaning it will immediately trap). This function must be called for the store to have some fuel to allow WebAssembly to execute.

Note that when fuel is entirely consumed it will cause wasm to trap.

If fuel is not enabled within this store then an error is returned. If fuel is successfully added then NULL is returned.

Implementation

@ffi.Native<
  ffi.Pointer<wasmtime_error_t> Function(
    ffi.Pointer<wasmtime_context_t>,
    ffi.Uint64,
  )
>()
external ffi.Pointer<wasmtime_error_t> wasmtime_context_set_fuel(
  ffi.Pointer<wasmtime_context_t> store,
  int fuel,
);