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