Trait gear_core::gas::CountersOwner
source · 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§
sourcefn charge_gas_for_token(&mut self, token: CostToken) -> Result<(), ChargeError>
fn charge_gas_for_token(&mut self, token: CostToken) -> Result<(), ChargeError>
Charge for runtime api call.
sourcefn charge_gas_if_enough(&mut self, amount: u64) -> Result<(), ChargeError>
fn charge_gas_if_enough(&mut self, amount: u64) -> Result<(), ChargeError>
Charge gas if enough, else just returns error.
sourcefn current_counter_type(&self) -> CounterType
fn current_counter_type(&self) -> CounterType
Currently set gas counter type.
sourcefn decrease_current_counter_to(&mut self, amount: u64)
fn decrease_current_counter_to(&mut self, amount: u64)
Decreases gas left by fetched single numeric of actual counter.
sourcefn define_current_counter(&mut self) -> u64
fn define_current_counter(&mut self) -> u64
Returns minimal amount of gas counters and set the type of current counter.
Provided Methods§
sourcefn current_counter_value(&self) -> u64
fn current_counter_value(&self) -> u64
Returns value of gas counter currently set.