rename meas::{eval_multiple_kv -> eval_multiple}

This commit is contained in:
2022-07-31 23:27:37 -07:00
parent 0e0945f744
commit 723fed4786
2 changed files with 6 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ pub fn as_dyn_measurements<S, M: AbstractMeasurement<S>>(meas: &[M]) -> Vec<&dyn
/// combine several measurements /// combine several measurements
pub fn eval_multiple_kv<S>(state: &S, meas: &[&dyn AbstractMeasurement<S>]) -> Vec<Measurement> { pub fn eval_multiple<S>(state: &S, meas: &[&dyn AbstractMeasurement<S>]) -> Vec<Measurement> {
meas.into_iter().flat_map(|m| m.key_value(state).into_iter()).collect() meas.into_iter().flat_map(|m| m.key_value(state).into_iter()).collect()
} }

View File

@@ -294,7 +294,7 @@ impl<'a, S: AbstractSim> RenderSteps<'a, S> {
self.im = im; self.im = im;
} }
fn render_measurements(&mut self) { fn render_measurements(&mut self) {
for (meas_no, m) in meas::eval_multiple_kv(self.sim, &self.meas).into_iter().enumerate() { for (meas_no, m) in meas::eval_multiple(self.sim, &self.meas).into_iter().enumerate() {
let meas_string = m.str_value(); let meas_string = m.str_value();
for (i, c) in meas_string.chars().enumerate() { for (i, c) in meas_string.chars().enumerate() {
let glyph = BASIC_FONTS.get(c) let glyph = BASIC_FONTS.get(c)
@@ -425,7 +425,7 @@ impl<S: AbstractSim> Renderer<S> for ColorTermRenderer {
measurements: &[&dyn AbstractMeasurement<S>], measurements: &[&dyn AbstractMeasurement<S>],
config: RenderConfig, config: RenderConfig,
) { ) {
let measurements = meas::eval_multiple_kv(state, measurements); let measurements = meas::eval_multiple(state, measurements);
let (max_w, mut max_h) = crossterm::terminal::size().unwrap(); let (max_w, mut max_h) = crossterm::terminal::size().unwrap();
max_h = max_h.saturating_sub(2 + measurements.len() as u16); 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); let im = RenderSteps::render_configured(state, &[], z, (max_w as _, max_h as _), config);
@@ -657,9 +657,9 @@ impl<S: AbstractSim + Serialize> Renderer<S> for SerializerRenderer {
} }
fn render(&self, state: &S, measurements: &[&dyn AbstractMeasurement<S>], _config: RenderConfig) { fn render(&self, state: &S, measurements: &[&dyn AbstractMeasurement<S>], _config: RenderConfig) {
if self.prefer_generic { if self.prefer_generic {
self.serialize(&state.to_generic(), meas::eval_multiple_kv(state, measurements)); self.serialize(&state.to_generic(), meas::eval_multiple(state, measurements));
} else { } else {
self.serialize(state, meas::eval_multiple_kv(state, measurements)); self.serialize(state, meas::eval_multiple(state, measurements));
} }
} }
} }
@@ -699,7 +699,7 @@ impl<S: AbstractSim> Renderer<S> for CsvRenderer {
default_render_z_slice(self, state, z, measurements, config) default_render_z_slice(self, state, z, measurements, config)
} }
fn render(&self, state: &S, measurements: &[&dyn AbstractMeasurement<S>], _config: RenderConfig) { fn render(&self, state: &S, measurements: &[&dyn AbstractMeasurement<S>], _config: RenderConfig) {
let row = meas::eval_multiple_kv(state, measurements); let row = meas::eval_multiple(state, measurements);
let step = state.step_no(); let step = state.step_no();
let mut lock = self.state.lock().unwrap(); let mut lock = self.state.lock().unwrap();
let mut writer = match lock.take().unwrap() { let mut writer = match lock.take().unwrap() {