MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime-go / SetFuel

Method SetFuel

store.go:282–290  ·  view source on GitHub ↗

SetFuel sets this store's fuel to the specified value. For this method to work fuel consumption must be enabled via `Config.SetConsumeFuel`. 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 fue

(fuel uint64)

Source from the content-addressed store, hash-verified

280//
281// If fuel is not enabled within this store then an error is returned.
282func (store *Store) SetFuel(fuel uint64) error {
283 err := C.wasmtime_context_set_fuel(store.Context(), C.uint64_t(fuel))
284 runtime.KeepAlive(store)
285 if err != nil {
286 return mkError(err)
287 }
288
289 return nil
290}
291
292// Limiter provides limits for a store. Used by hosts to limit resource
293// consumption of instances. Use negative value to keep the default value

Callers 2

TestAddFuelFunction · 0.95
ExampleConfig_fuelFunction · 0.95

Calls 2

ContextMethod · 0.95
mkErrorFunction · 0.85

Tested by 2

TestAddFuelFunction · 0.76
ExampleConfig_fuelFunction · 0.76