use remote_control_rs::tasks::{IntoTaskErr, Task}; pub struct Executor<'a, 't> { task: &'a Task<'t>, args: Box<[&'a str]>, output: Option>, } impl<'a, 't> Executor<'a, 't> { pub fn new(task: &'t Task<'t>, args: impl IntoIterator) -> Result { Ok(Self { task: task, args: args.into_iter().collect(), output: None }) } pub fn run(&mut self) -> Option<&Result> { self.output = Some((self.task.exec)(&self.args)); self.output.as_ref() } }