pub trait YamlConfigurable: Sized {
// Required methods
fn from_yaml(spec: &ExperimentSpec) -> Result<Self, ConfigError>;
fn validate_against_emc(&self, emc: &EquationModelCard) -> ValidationResult;
fn parameters(&self) -> HashMap<String, f64>;
}Expand description
YAML configuration trait for EDD simulations.
Allows simulations to be configured from declarative YAML experiment specifications without custom code.
§Example
ⓘ
impl YamlConfigurable for HarmonicOscillator {
fn from_yaml(spec: &ExperimentSpec) -> Result<Self, ConfigError> {
let omega = spec.parameter("omega")
.ok_or_else(|| ConfigError::field_error("omega", "required"))?;
Ok(Self::new(omega))
}
fn validate_against_emc(&self, emc: &EquationModelCard) -> ValidationResult {
// Check parameters are within EMC domain of validity
}
}Required Methods§
Sourcefn from_yaml(spec: &ExperimentSpec) -> Result<Self, ConfigError>
fn from_yaml(spec: &ExperimentSpec) -> Result<Self, ConfigError>
Sourcefn validate_against_emc(&self, emc: &EquationModelCard) -> ValidationResult
fn validate_against_emc(&self, emc: &EquationModelCard) -> ValidationResult
Validate configuration against EMC domain of validity.
Checks that all parameters fall within the valid ranges specified in the Equation Model Card.
Sourcefn parameters(&self) -> HashMap<String, f64>
fn parameters(&self) -> HashMap<String, f64>
Extract parameters as a hashmap for evaluation.
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.