diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-12-05 18:01:31 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-12-05 18:01:31 +0200 |
commit | 7ed2a28e3c7fb2e17095e63bd4153031d507cc71 (patch) | |
tree | 73bfdef2e15218558981955cd8df11c2f6523a2b | |
parent | 494db061417627c3f5847fd7b4c47248e5d8d2ea (diff) | |
download | obnam-benchmark-7ed2a28e3c7fb2e17095e63bd4153031d507cc71.tar.gz |
refactor: move execution into Step, from main
Sponsored-by: author
-rw-r--r-- | Cargo.lock | 4 | ||||
-rw-r--r-- | src/bin/obnam-benchmark.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 7 |
3 files changed, 10 insertions, 3 deletions
@@ -466,9 +466,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.108" +version = "0.2.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119" +checksum = "f98a04dce437184842841303488f70d0188c5f51437d2a834dc097eafa909a01" [[package]] name = "linked-hash-map" 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(()) } @@ -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(()) + } } |