summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-12-05 18:01:31 +0200
committerLars Wirzenius <liw@liw.fi>2021-12-05 18:01:31 +0200
commit7ed2a28e3c7fb2e17095e63bd4153031d507cc71 (patch)
tree73bfdef2e15218558981955cd8df11c2f6523a2b /src
parent494db061417627c3f5847fd7b4c47248e5d8d2ea (diff)
downloadobnam-benchmark-7ed2a28e3c7fb2e17095e63bd4153031d507cc71.tar.gz
refactor: move execution into Step, from main
Sponsored-by: author
Diffstat (limited to 'src')
-rw-r--r--src/bin/obnam-benchmark.rs2
-rw-r--r--src/lib.rs7
2 files changed, 8 insertions, 1 deletions
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(())
+ }
}