pub trait SpecificCostContextTrait<CostType: CostTypeTrait> {
// Required methods
fn to_cost_map(cost: CostType) -> OrderedHashMap<CostTokenType, i64>;
fn to_full_cost_map(cost: CostType) -> OrderedHashMap<CostTokenType, i64>;
fn get_gas_withdrawal(
&self,
idx: &StatementIdx,
branch_cost: &BranchCost,
wallet_value: &CostType,
future_wallet_value: CostType,
) -> Result<CostType, CostError>;
fn get_branch_requirement(
&self,
wallet_at_fn: &dyn Fn(&StatementIdx) -> WalletInfo<CostType>,
idx: &StatementIdx,
branch_info: &BranchInfo,
branch_cost: &BranchCost,
) -> WalletInfo<CostType>;
}
Required Methods§
sourcefn to_cost_map(cost: CostType) -> OrderedHashMap<CostTokenType, i64>
fn to_cost_map(cost: CostType) -> OrderedHashMap<CostTokenType, i64>
Converts a CostType
to a OrderedHashMap from CostTokenType to i64.
sourcefn to_full_cost_map(cost: CostType) -> OrderedHashMap<CostTokenType, i64>
fn to_full_cost_map(cost: CostType) -> OrderedHashMap<CostTokenType, i64>
Converts a CostType
to a OrderedHashMap from CostTokenType to i64.
All relevant CostTokenType are included (even if their value is 0).
sourcefn get_gas_withdrawal(
&self,
idx: &StatementIdx,
branch_cost: &BranchCost,
wallet_value: &CostType,
future_wallet_value: CostType,
) -> Result<CostType, CostError>
fn get_gas_withdrawal( &self, idx: &StatementIdx, branch_cost: &BranchCost, wallet_value: &CostType, future_wallet_value: CostType, ) -> Result<CostType, CostError>
Computes the value that should be withdrawn and added to the wallet.
sourcefn get_branch_requirement(
&self,
wallet_at_fn: &dyn Fn(&StatementIdx) -> WalletInfo<CostType>,
idx: &StatementIdx,
branch_info: &BranchInfo,
branch_cost: &BranchCost,
) -> WalletInfo<CostType>
fn get_branch_requirement( &self, wallet_at_fn: &dyn Fn(&StatementIdx) -> WalletInfo<CostType>, idx: &StatementIdx, branch_info: &BranchInfo, branch_cost: &BranchCost, ) -> WalletInfo<CostType>
Returns the required value for the wallet for a single branch.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.