cairo_lang_sierra_ap_change/
ap_change_info.rsuse cairo_lang_sierra::ids::FunctionId;
use cairo_lang_sierra::program::StatementIdx;
use cairo_lang_utils::ordered_hash_map::OrderedHashMap;
use itertools::Itertools;
#[derive(Debug, Default, Eq, PartialEq)]
pub struct ApChangeInfo {
pub variable_values: OrderedHashMap<StatementIdx, usize>,
pub function_ap_change: OrderedHashMap<FunctionId, usize>,
}
impl std::fmt::Display for ApChangeInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
for (statement_idx, value) in self
.variable_values
.iter()
.filter(|(_, value)| **value != 0)
.sorted_by(|(a, _), (b, _)| a.0.cmp(&b.0))
{
writeln!(f, "#{statement_idx}: {value}")?;
}
writeln!(f)?;
for (function_id, costs) in self.function_ap_change.iter() {
writeln!(f, "{function_id}: {costs:?}")?;
}
Ok(())
}
}