measurement: remove the eval
method
This commit is contained in:
@@ -294,8 +294,8 @@ impl<'a, S: AbstractSim> RenderSteps<'a, S> {
|
||||
self.im = im;
|
||||
}
|
||||
fn render_measurements(&mut self) {
|
||||
for (meas_no, m) in self.meas.iter().enumerate() {
|
||||
let meas_string = m.eval(self.sim);
|
||||
for (meas_no, m) in meas::eval_multiple_kv(self.sim, &self.meas).into_iter().enumerate() {
|
||||
let meas_string = m.str_value();
|
||||
for (i, c) in meas_string.chars().enumerate() {
|
||||
let glyph = BASIC_FONTS.get(c)
|
||||
.or_else(|| GREEK_FONTS.get(c))
|
||||
@@ -425,6 +425,7 @@ impl<S: AbstractSim> Renderer<S> for ColorTermRenderer {
|
||||
measurements: &[&dyn AbstractMeasurement<S>],
|
||||
config: RenderConfig,
|
||||
) {
|
||||
let measurements = meas::eval_multiple_kv(state, measurements);
|
||||
let (max_w, mut max_h) = crossterm::terminal::size().unwrap();
|
||||
max_h = max_h.saturating_sub(2 + measurements.len() as u16);
|
||||
let im = RenderSteps::render_configured(state, &[], z, (max_w as _, max_h as _), config);
|
||||
@@ -453,7 +454,7 @@ impl<S: AbstractSim> Renderer<S> for ColorTermRenderer {
|
||||
for m in measurements {
|
||||
// Measurements can be slow to compute
|
||||
stdout.flush().unwrap();
|
||||
let meas_string = m.eval(state);
|
||||
let meas_string = m.str_value();
|
||||
stdout.queue(cursor::MoveDown(1)).unwrap();
|
||||
stdout.queue(cursor::MoveToColumn(1)).unwrap();
|
||||
stdout.queue(PrintStyledContent(style(meas_string))).unwrap();
|
||||
|
Reference in New Issue
Block a user