Skip to main content

stop_mapping

Function stop_mapping 

Source
pub fn stop_mapping(stop: &Stop, confidence: f64) -> Result<Value>
Expand description

The stop mapping of a specification of confidence level confidence whose rule is stop: the inverse of the parser, for a rule the format can write. A specification stops when all its targets (min_errors, precision, with min_trials) are met, or any of its caps (max_trials, max_time_s).

use comnum_sim::stopping::Stop;
let rule = Stop::min_errors("ber", 100).or(Stop::max_trials(1000));
let m = comnum_spec::stop_mapping(&rule, 0.95)?;
assert_eq!(m, serde_json::json!({"min_errors": {"ber": 100}, "max_trials": 1000}));

ยงErrors

Error::Config for a rule the format cannot write: targets combined by or, a cap inside an and, a cap or a target given twice, a precision target at another confidence level than confidence, or no target and no cap.