#[macro_export]
macro_rules! until {
($method:expr, $timeout:expr, $poll:expr) => {{
let start = std::time::Instant::now();
loop {
if start.elapsed() > std::time::Duration::from_secs($timeout) {
break Err(PebblesError::TimeoutError(PebblesErrorDetails::new(
"Timeout Reached Without a Success",
)));
}
match $method() {
Ok(response) => {
break Ok(response);
}
Err(_) => {
std::thread::sleep(std::time::Duration::from_secs_f64($poll));
}
};
}
}};
}
#[macro_export]
macro_rules! sleep {
($ms:expr) => {
std::thread::sleep(std::time::Duration::from_millis($ms));
};
}