Add fuel related functions to c-api (#2643)
Co-authored-by: Shu <me@wadza.fr>
This commit is contained in:
@@ -55,6 +55,11 @@ pub extern "C" fn wasmtime_config_interruptable_set(c: &mut wasm_config_t, enabl
|
||||
c.config.interruptable(enable);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasmtime_config_consume_fuel_set(c: &mut wasm_config_t, enable: bool) {
|
||||
c.config.consume_fuel(enable);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasmtime_config_max_wasm_stack_set(c: &mut wasm_config_t, size: usize) {
|
||||
c.config.max_wasm_stack(size);
|
||||
|
||||
@@ -42,3 +42,13 @@ pub extern "C" fn wasmtime_interrupt_handle_new(
|
||||
pub extern "C" fn wasmtime_interrupt_handle_interrupt(handle: &wasmtime_interrupt_handle_t) {
|
||||
handle.handle.interrupt();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasmtime_add_fuel(store: &wasm_store_t, fuel: u64) {
|
||||
store.store.add_fuel(fuel);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasmtime_fuel_consumed(store: &wasm_store_t) -> u64 {
|
||||
store.store.fuel_consumed().unwrap_or(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user