From 7ed2a28e3c7fb2e17095e63bd4153031d507cc71 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 5 Dec 2021 18:01:31 +0200 Subject: refactor: move execution into Step, from main Sponsored-by: author --- src/bin/obnam-benchmark.rs | 2 +- src/lib.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/bin/obnam-benchmark.rs b/src/bin/obnam-benchmark.rs index 3c2060e..b36565e 100644 --- a/src/bin/obnam-benchmark.rs +++ b/src/bin/obnam-benchmark.rs @@ -48,7 +48,7 @@ impl Run { fn run(&self) -> anyhow::Result<()> { let spec = Specification::from_file(&self.spec)?; for step in spec.steps() { - println!("{:?}", step); + step.execute()?; } Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index 6e731c2..85c6941 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -147,4 +147,11 @@ impl Step { Change::Delete(x) => Self::Delete(x.clone()), } } + + pub fn execute(&self) -> Result<(), SpecificationError> { + println!("execute {:?}", self); + let t = std::time::Duration::from_millis(1000); + std::thread::sleep(t); + Ok(()) + } } -- cgit v1.2.1