pub async fn wait_for_condition<C: Update, S: Stream<Item = Result<Event, WatchError>>, F: Fn(&C) -> bool>(
event_stream: S,
initial_state: &mut C,
predicate: F,
) -> Result<(), WaitForConditionError>Expand description
Wait for a condition on filtering state to be satisfied.
With the given initial_state, take events from event_stream and update
the state, calling predicate whenever the state changes. When predicates
returns True yield Ok(()).