pub trait CountersOwner {
    // Required methods
    fn charge_gas_for_token(
        &mut self,
        token: CostToken
    ) -> Result<(), ChargeError>;
    fn charge_gas_if_enough(&mut self, amount: u64) -> Result<(), ChargeError>;
    fn gas_left(&self) -> GasLeft;
    fn current_counter_type(&self) -> CounterType;
    fn decrease_current_counter_to(&mut self, amount: u64);
    fn define_current_counter(&mut self) -> u64;

    // Provided method
    fn current_counter_value(&self) -> u64 { ... }
}
Expand description

Counters owner can change gas limit and allowance counters.

Required Methods§

source

fn charge_gas_for_token(&mut self, token: CostToken) -> Result<(), ChargeError>

Charge for runtime api call.

source

fn charge_gas_if_enough(&mut self, amount: u64) -> Result<(), ChargeError>

Charge gas if enough, else just returns error.

source

fn gas_left(&self) -> GasLeft

Returns gas limit and gas allowance left.

source

fn current_counter_type(&self) -> CounterType

Currently set gas counter type.

source

fn decrease_current_counter_to(&mut self, amount: u64)

Decreases gas left by fetched single numeric of actual counter.

source

fn define_current_counter(&mut self) -> u64

Returns minimal amount of gas counters and set the type of current counter.

Provided Methods§

source

fn current_counter_value(&self) -> u64

Returns value of gas counter currently set.

Implementors§