Skip to main content

wait_for_condition

Function wait_for_condition 

Source
pub async fn wait_for_condition<F>(
    condition: F,
    timeout: Duration,
    poll_interval: Duration,
    timeout_message: &str,
)
where F: Fn() -> bool,
Expand description

Wait for a condition to become true, polling at regular intervals

§Arguments

  • condition - A closure that returns true when the wait should end
  • timeout - Maximum time to wait before panicking
  • poll_interval - How often to check the condition
  • timeout_message - Message to display if timeout occurs

§Panics

Panics if the condition doesn’t become true within the timeout period