pub async fn wait_for_routes<I: FidlRouteIpExt, S: Stream<Item = Result<Event<I>, WatchError>> + Unpin, F: Fn(&HashSet<InstalledRoute<I>>) -> bool>(
event_stream: S,
initial_state: &mut HashSet<InstalledRoute<I>>,
predicate: F,
) -> Result<(), WaitForRoutesError<I>>
Expand description
Wait for a condition on routing 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(())
.