1use std::time::Duration;
2use waitforit::Wait;
3
4const CHECK_DURATION: Duration = Duration::from_secs(1);
5
6fn main() {
10 let ten_sec = Wait::new_elapsed_from_duration(Duration::from_secs(10));
11 let lockfile = !Wait::new_file_exists("something.lock");
12
13 let w = ten_sec & lockfile;
15 let start = std::time::Instant::now();
16 w.wait(CHECK_DURATION);
17 println!("Step 1 complete after {:?}", start.elapsed());
18
19 let ten_sec = Wait::new_elapsed_from_duration(Duration::from_secs(10));
23 let lockfile = !Wait::new_file_exists("something.lock");
24 let w = ten_sec & lockfile;
25 let not_w = !w;
26 let start = std::time::Instant::now();
27 not_w.wait(CHECK_DURATION);
28 println!("Step 2 complete after {:?}", start.elapsed());
29}