asimov_patterns/programs/
runner.rs1use crate::Execute;
4use alloc::{collections::btree_map::BTreeMap, string::String, vec::Vec};
5use bon::Builder;
6
7pub trait Runner<T, E>: Execute<T, E> {}
12
13#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Builder)]
25#[builder(derive(Debug), on(String, into))]
26pub struct RunnerOptions {
27 #[builder(field)]
29 pub other: Vec<String>,
30
31 #[builder(field)]
33 pub define: BTreeMap<String, String>,
34}
35
36impl<S: runner_options_builder::State> RunnerOptionsBuilder<S> {
37 pub fn other(mut self, flag: impl Into<String>) -> Self {
38 self.other.push(flag.into());
39 self
40 }
41
42 pub fn maybe_other(mut self, flag: Option<impl Into<String>>) -> Self {
43 if let Some(flag) = flag {
44 self.other.push(flag.into());
45 }
46 self
47 }
48
49 pub fn define(mut self, key: impl Into<String>, val: impl Into<String>) -> Self {
50 self.define.insert(key.into(), val.into());
51 self
52 }
53}