fidl_fuchsia_net_interfaces_ext

Function to_reachability_stream

Source
pub fn to_reachability_stream<I: FieldInterests>(
    event_stream: impl Stream<Item = Result<EventWithInterest<I>, Error>>,
) -> impl Stream<Item = Result<bool, WatcherOperationError<(), HashMap<u64, PropertiesAndState<(), I>>>>>
Expand description

Wraps event_stream and returns a stream which yields the reachability status as a bool (true iff there exists an interface with properties that satisfy is_globally_routable) whenever it changes. The first item the returned stream yields is the reachability status of the first interface discovered through an Added or Existing event on event_stream.

Note that event_stream must be created from a watcher with interest in the appropriate fields, such as one created from crate::event_stream_from_state.