use crate::executor::tasks::{IntoTask, IntoTaskErr, Task}; mod tasks; struct Executor<'a> { task: &'a Task, args: Box<[&'a str]>, output: Option>, } impl<'a> Executor<'a> { fn new(task: impl IntoTask, args: &'a str) -> Result { let task = task.into_task()?; Ok(Self { task: task, args: Box::new([args]), output: None, }) } fn run(&mut self) -> Option<&Result> { self.output = Some((self.task.exec)(&self.args)); self.output.as_ref() } }