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

Method GetFuel

store.go:258–268  ·  view source on GitHub ↗

GetFuel returns the amount of fuel remaining in this store. If fuel consumption is not enabled via `Config.SetConsumeFuel` then this function will return an error. Otherwise this will retrieve the fuel remaining and return it. Also note that fuel, if enabled, must be originally configured via `Sto

()

Source from the content-addressed store, hash-verified

256// Also note that fuel, if enabled, must be originally configured via
257// `Store.SetFuel`.
258func (store *Store) GetFuel() (uint64, error) {
259 var remaining uint64
260 c_remaining := C.uint64_t(remaining)
261 err := C.wasmtime_context_get_fuel(store.Context(), &c_remaining)
262 runtime.KeepAlive(store)
263 if err != nil {
264 return 0, mkError(err)
265 }
266
267 return uint64(c_remaining), nil
268}
269
270// SetFuel sets this store's fuel to the specified value.
271//

Callers 3

TestFuelConsumedFunction · 0.95
TestAddFuelFunction · 0.95
ExampleConfig_fuelFunction · 0.95

Calls 2

ContextMethod · 0.95
mkErrorFunction · 0.85

Tested by 3

TestFuelConsumedFunction · 0.76
TestAddFuelFunction · 0.76
ExampleConfig_fuelFunction · 0.76