AbstractMeasurement: remove the DynClone requirement

This commit is contained in:
2022-07-28 21:49:28 -07:00
parent 3722512554
commit 2d1a15eabc
2 changed files with 7 additions and 11 deletions

View File

@@ -2,17 +2,13 @@ use crate::geom::{Meters, Region, Torus, WorldRegion};
use crate::real::{Real as _, ToFloat as _};
use crate::cross::vec::Vec3;
use crate::sim::GenericSim;
use dyn_clone::{self, DynClone};
use indexmap::IndexMap;
use serde::{Serialize, Deserialize};
// TODO: remove this Clone and Send requirement? Have Measurements be shared by-reference across
// threads? i.e. Sync, and no Clone
pub trait AbstractMeasurement: Send + Sync + DynClone {
pub trait AbstractMeasurement: Send + Sync {
fn eval(&self, state: &dyn GenericSim) -> String;
fn key_value(&self, state: &dyn GenericSim) -> IndexMap<String, String>;
}
dyn_clone::clone_trait_object!(AbstractMeasurement);
/// create one IndexMap out of several measurements
pub fn eval_multiple_kv(state: &dyn GenericSim, meas: &[&dyn AbstractMeasurement]) -> IndexMap<String, String> {