pub async fn wait_interface_with_id<S, St, F, T>(
stream: St,
init: &mut InterfaceState<S>,
predicate: F
) -> Result<T, WatcherOperationError<S, InterfaceState<S>>>
Expand description
Wait for a condition on a specific interface to be satisfied.
Note that stream
must be created from a watcher with interest in all
fields, such as one created from event_stream_from_state
.
With the initial state in init
, take events from stream
and update the state, calling
predicate
whenever the state changes. When predicate
returns Some(T)
, yield Ok(T)
.
Since the state passed via init
is mutably updated for every event, when this function
returns successfully, the state can be used as the initial state in a subsequent call with a
stream of events from the same watcher.