pub fn wait_for<T>(
deadline: Duration,
desc: &str,
probe: impl FnMut() -> Option<T>,
) -> TExpand description
Poll probe until it returns Some(value), or panic once deadline
elapses.
This is the workspace’s standard replacement for blind sleeps: the wait observes real state, succeeds as soon as possible, and fails with a descriptive message instead of a misleading downstream assert.
ⓘ
let value = wait_for(Duration::from_secs(5), "reader applied resize", || {
state.lock().unwrap_or_else(|err| err.into_inner()).applied.then_some(())
});§Panics
Panics if probe never returns Some within deadline.