beez_process/
process_call.rs1use std::ffi::OsString;
2use std::path::PathBuf;
3
4#[derive(Clone, Debug, Eq, PartialEq)]
6pub struct ProcessCall {
7 program: PathBuf,
8 arguments: Vec<OsString>,
9}
10
11impl ProcessCall {
12 #[must_use]
14 pub fn new(program: impl Into<PathBuf>) -> Self {
15 Self {
16 program: program.into(),
17 arguments: Vec::new(),
18 }
19 }
20
21 #[must_use]
23 pub fn argument(mut self, argument: impl Into<OsString>) -> Self {
24 self.arguments.push(argument.into());
25 self
26 }
27
28 #[must_use]
30 pub fn arguments(mut self, arguments: impl IntoIterator<Item = impl Into<OsString>>) -> Self {
31 self.arguments.extend(arguments.into_iter().map(Into::into));
32 self
33 }
34
35 pub(crate) fn into_parts(self) -> (PathBuf, Vec<OsString>) {
36 (self.program, self.arguments)
37 }
38}