1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/// Helper [Inspector] that keeps track of gas.
#[derive(Clone, Copy, Debug, Default)]
pub struct GasInspector {
    gas_remaining: u64,
    last_gas_cost: u64,
}

impl GasInspector {
    pub fn gas_remaining(&self) -> u64 { self.gas_remaining }

    pub fn last_gas_cost(&self) -> u64 { self.last_gas_cost }

    pub fn set_gas_remainning(&mut self, remainning: u64) {
        self.gas_remaining = remainning;
    }

    pub fn set_last_gas_cost(&mut self, gas_cost: u64) {
        self.last_gas_cost = gas_cost;
    }
}