summaryrefslogtreecommitdiff
path: root/src/executor.rs
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-09-21 23:08:41 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-09-21 23:08:41 +0800
commit22c98311a8e8f4a1c94b0e4ac0f36b4e016a2bf4 (patch)
tree6453e6991b39e05bda169bd13ceb4cf0f2ccecbd /src/executor.rs
parent2e1d12ec90ea12e8824d79dfc31b5b3cae397df8 (diff)
format
Diffstat (limited to 'src/executor.rs')
-rw-r--r--src/executor.rs31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/executor.rs b/src/executor.rs
index 58be87d..a2a7856 100644
--- a/src/executor.rs
+++ b/src/executor.rs
@@ -9,12 +9,35 @@ pub struct Executor<'a, 't, N: Copy + PartialEq, T = ()> {
impl<'a, 't, N: Copy + PartialEq, T> Executor<'a, 't, N, T> {
pub fn new(task: &'t Task<N, T>, args: impl IntoIterator<Item = &'a str>, ctx: T) -> Self {
- Self { task: task, args: args.into_iter().collect(), ctx, complete_task: None }
+ Self {
+ task: task,
+ args: args
+ .into_iter()
+ .collect(),
+ ctx,
+ complete_task: None,
+ }
}
pub fn run(&mut self) -> &TaskOutput {
- let output = (self.task.exec)(&self.args, &self.ctx);
- self.complete_task = Some(CompletedTask { name: self.task.name, output: Some(output) });
- self.complete_task.as_ref().unwrap().output.as_ref().unwrap()
+ let output = (self
+ .task
+ .exec)(
+ &self.args, &self.ctx,
+ );
+ self.complete_task = Some(
+ CompletedTask {
+ name: self
+ .task
+ .name,
+ output: Some(output),
+ },
+ );
+ self.complete_task
+ .as_ref()
+ .unwrap()
+ .output
+ .as_ref()
+ .unwrap()
}
}