timeout

Macro timeout 

Source
macro_rules! timeout {
    ( $timeout:expr, $interval:expr, $f:block ) => { ... };
    ( $timeout:expr, $f:block ) => { ... };
}
Expand description

Use this macro to execute a block of code (which must return a bool) repeatedly until the provided timeout is hit. If the code blocks indefinitely, the timeout will not work.