rskit_bench/runner/
options.rs1use std::collections::HashMap;
4
5pub struct RunOptions {
7 pub concurrency: usize,
8 pub timeout_secs: u64,
9 pub tag: String,
10 pub fail_on_regression: bool,
11 pub targets: HashMap<String, f64>,
12}
13
14impl Default for RunOptions {
15 fn default() -> Self {
16 Self {
17 concurrency: 4,
18 timeout_secs: 30,
19 tag: String::from("default"),
20 fail_on_regression: false,
21 targets: HashMap::new(),
22 }
23 }
24}
25
26impl RunOptions {
27 #[must_use]
28 pub fn with_concurrency(mut self, n: usize) -> Self {
29 self.concurrency = n;
30 self
31 }
32
33 #[must_use]
34 pub fn with_timeout(mut self, secs: u64) -> Self {
35 self.timeout_secs = secs;
36 self
37 }
38
39 #[must_use]
40 pub fn with_tag(mut self, tag: impl Into<String>) -> Self {
41 self.tag = tag.into();
42 self
43 }
44
45 #[must_use]
46 pub fn with_fail_on_regression(mut self, fail: bool) -> Self {
47 self.fail_on_regression = fail;
48 self
49 }
50
51 #[must_use]
52 pub fn with_target(mut self, metric: impl Into<String>, threshold: f64) -> Self {
53 self.targets.insert(metric.into(), threshold);
54 self
55 }
56}