use crate::executor::tasks::{IntoTask, IntoTaskErr, Task}; pub mod tasks; pub struct Executor { task: &'static Task, args: Box<[String]>, output: Option>, } impl Executor { pub fn new( task: impl IntoTask, args: impl IntoIterator, ) -> Result { let task = task.into_task()?; 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() } }