pub fn set_remaining_points(
    ctx: &mut impl AsStoreMut,
    instance: &Instance,
    points: u64
)
Expand description

Set the new provided remaining points in an Instance.

Note: This can be used in a headless engine after an ahead-of-time compilation as all required state lives in the instance.

Panic

The given Instance must have been processed with the Metering middleware at compile time, otherwise this will panic.

Example

use wasmer::{AsStoreMut, Instance};
use wasmer_middlewares::metering::set_remaining_points;

fn update_remaining_points(store: &mut impl AsStoreMut, instance: &Instance) {
    // The new limit.
    let new_limit = 10;

    // Update the remaining points to the `new_limit`.
    set_remaining_points(store, instance, new_limit);
}