1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// This is free and unencumbered software released into the public domain.
//! Language-runtime execution: the runner marker trait and named definitions.
use crateExecute;
use ;
use Builder;
/// A language runtime that executes program text and emits its result as text.
///
/// The program defines its language and version, input grammar and encoding,
/// how definitions are exposed to code, and how results are represented.
/// Executing code can have external side effects; the pattern does not imply
/// sandboxing, determinism, or rollback after failure.
///
/// # Command-line contract
///
/// `PROGRAM [OPTIONS] [INPUT-FILE]`
///
/// The program file defaults to `-` (stdin); the execution result goes to
/// stdout. [`RunnerOptions::define`] supplies runtime variables through the
/// repeatable `--define=VAR=VAL` option. No standard input/output-format
/// options or output-file operand are defined for this pattern.
///
/// `T` is the implementation's result representation. This trait identifies the
/// language-runtime role, not generic process launching. See [`crate::programs`]
/// for links to concrete execution behavior and the [runner specification][spec].
///
/// [spec]: https://asimov-specs.github.io/program-patterns/#runner
/// Runtime variable definitions and additional arguments for a [`Runner`].
///
/// `Default` creates an empty definition map and argument list. The map holds
/// at most one value per name and is forwarded in key order, not insertion
/// order. Values are stored without validating the selected runtime's naming
/// or value rules.
///
/// # Examples
///
/// ```rust
/// use asimov_patterns::RunnerOptions;
///
/// let options = RunnerOptions::builder()
/// .define("mode", "preview")
/// .define("expression", "a=b")
/// .build();
///
/// assert_eq!(options.define.get("expression").map(String::as_str), Some("a=b"));
/// ```