pub trait SpecificCostContextTrait<CostType: CostTypeTrait> {
// Required methods
fn to_cost_map(cost: CostType) -> OrderedHashMap<CostTokenType, i64>;
fn into_full_cost_iter(
cost: CostType,
) -> impl Iterator<Item = (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 into_full_cost_iter(
cost: CostType,
) -> impl Iterator<Item = (CostTokenType, i64)>
fn into_full_cost_iter( cost: CostType, ) -> impl Iterator<Item = (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.