// TODO(https://fxbug.dev/81964): Introduce type with better concurrency safety
// for hanging gets.
/// Wait until the Assigned state is observed on `stream`.
///
/// After this async function resolves successfully, the underlying
/// `AddressStateProvider` may be used as usual. If an error is returned, a
/// terminal error has occurred on the underlying channel.
Introduce type with better concurrency safety
for hanging gets.
Wait until the Assigned state is observed on `stream`.

After this async function resolves successfully, the underlying
`AddressStateProvider` may be used as usual. If an error is returned, a
terminal error has occurred on the underlying channel.
Introduce type with better concurrency safety for hanging gets . Wait until the Assigned state is observed on ` stream ` . After this async function resolves successfully the underlying ` AddressStateProvider ` may be used as usual . If an error is returned a terminal error has occurred on the underlying channel .
pub async fn wait_assignment_state<S>(
    stream: &mut S,
    want: fidl_fuchsia_net_interfaces_admin::AddressAssignmentState,
) -> Result<(), AddressStateProviderError>
where
    S: Stream<
            Item = Result<fnet_interfaces_admin::AddressAssignmentState, AddressStateProviderError>,
        > + Unpin,
{
    stream
        .try_filter_map(|state| futures::future::ok((state == want).then(|| ())))
        .try_next()
        .await
        .and_then(|opt| opt.ok_or_else(|| AddressStateProviderError::ChannelClosed))
}
pub async fn wait_assignment_state < S > ( stream : & mut S , want : fidl_fuchsia_net_interfaces_admin :: AddressAssignmentState , ) -> Result < ( ) , AddressStateProviderError > where S : Stream < Item = Result < fnet_interfaces_admin :: AddressAssignmentState , AddressStateProviderError > , > + Unpin , { stream . try_filter_map ( | state | futures :: future :: ok ( ( state == want ) . then ( | | ( ) ) ) ) . try_next ( ) . await . and_then ( | opt | opt . ok_or_else ( | | AddressStateProviderError :: ChannelClosed ) ) }
TODO(https://fxbug.dev/81964): Introduce type with better concurrency safety
for hanging gets.
TODO ( https : // fxbug . dev / 81964 ) : Introduce type with better concurrency safety for hanging gets .
stream
&mut S
want
fidl_fuchsia_net_interfaces_admin::AddressAssignmentState