pub async fn wait_for_routes_map<I: FidlRouteIpExt, S: Stream<Item = Result<Event<I>, WatchError>> + Unpin, T, F: Fn(&HashSet<InstalledRoute<I>>) -> Option<T>>(
event_stream: S,
initial_state: &mut HashSet<InstalledRoute<I>>,
predicate: F,
) -> Result<T, WaitForRoutesError<I>>Expand description
Wait for a condition on routing state to be satisfied, yielding a result from the predicate.
With the given initial_state, take events from event_stream and update
the state, calling predicate whenever the state changes. When predicate
returns Some(T) yield Ok(T). Note, this function will hang if no events
arrive on event_stream.