agcodex_execpolicy/
exec_call.rs1use std::fmt::Display;
2
3use serde::Serialize;
4
5#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
6pub struct ExecCall {
7 pub program: String,
8 pub args: Vec<String>,
9}
10
11impl ExecCall {
12 pub fn new(program: &str, args: &[&str]) -> Self {
13 Self {
14 program: program.to_string(),
15 args: args.iter().map(|&s| s.into()).collect(),
16 }
17 }
18}
19
20impl Display for ExecCall {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 write!(f, "{}", self.program)?;
23 for arg in &self.args {
24 write!(f, " {arg}")?;
25 }
26 Ok(())
27 }
28}