pub async fn wait_for_active_connection_state(
        &self,
        expected_state: ConnectionState,
        path: dbus::Path<'_>,
        timeout_value: std::time::Duration,
        negate: bool,
    ) -> Result<ConnectionState, CaptivePortalError> {
        let p = nonblock::Proxy::new(NM_BUSNAME, path, self.conn.clone());

        use super::connection_active::ConnectionActive;
        let state: ConnectionState = p.state().await?.into();
        if (state == expected_state) ^ negate {
            return Ok(state);
        }

        use super::connection_active::ConnectionActiveStateChanged as StateChanged;

        let rule = StateChanged::match_rule(None, None).static_clone();
        let stream: SignalStream<StateChanged> = SignalStream::new(self.conn.clone(), rule).await?;
        pin_utils::pin_mut!(stream);
        let mut stream = stream; // Idea IDE Workaround

        while let Ok(Some((state, _path))) = timeout(timeout_value, stream.next()).await {
            let state = ConnectionState::from(state.state);
            if (state == expected_state) ^ negate {
                return Ok(state);
            }
        }

        let state: ConnectionState = p.state().await?.into();
        Ok(state)
    }
/// The returned future resolves when either the timeout expired or state of the
/// **active** connection (eg /org/freedesktop/NetworkManager/ActiveConnection/12) is the expected state
/// or changes into the expected state.
The returned future resolves when either the timeout expired or state of the
active** connection  is the expected state
or changes into the expected state.
The returned future resolves when either the timeout expired or state of the active ** connection is the expected state or changes into the expected state .
pub async fn wait_for_active_connection_state(
        &self,
        expected_state: ConnectionState,
        path: dbus::Path<'_>,
        timeout_value: std::time::Duration,
        negate: bool,
    ) -> Result<ConnectionState, CaptivePortalError> {
        let p = nonblock::Proxy::new(NM_BUSNAME, path, self.conn.clone());
        use super::connection_active::ConnectionActive;
        let state: ConnectionState = p.state().await?.into();
        if (state == expected_state) ^ negate {
            return Ok(state);
        }
        use super::connection_active::ConnectionActiveStateChanged as StateChanged;
        let rule = StateChanged::match_rule(None, None).static_clone();
        let stream: SignalStream<StateChanged> = SignalStream::new(self.conn.clone(), rule).await?;
        pin_utils::pin_mut!(stream);
        let mut stream = stream; // Idea IDE Workaround
        while let Ok(Some((state, _path))) = timeout(timeout_value, stream.next()).await {
            let state = ConnectionState::from(state.state);
            if (state == expected_state) ^ negate {
                return Ok(state);
            }
        }
        let state: ConnectionState = p.state().await?.into();
        Ok(state)
    }
pub async fn wait_for_active_connection_state ( & self , expected_state : ConnectionState , path : dbus :: Path < ' _ > , timeout_value : std :: time :: Duration , negate : bool , ) -> Result < ConnectionState , CaptivePortalError > { let p = nonblock :: Proxy :: new ( NM_BUSNAME , path , self . conn . clone ( ) ) ; use super :: connection_active :: ConnectionActive ; let state : ConnectionState = p . state ( ) . await ? . into ( ) ; if ( state == expected_state ) ^ negate { return Ok ( state ) ; } use super :: connection_active :: ConnectionActiveStateChanged as StateChanged ; let rule = StateChanged :: match_rule ( None , None ) . static_clone ( ) ; let stream : SignalStream < StateChanged > = SignalStream :: new ( self . conn . clone ( ) , rule ) . await ? ; pin_utils :: pin_mut ! ( stream ) ; let mut stream = stream ; // Idea IDE Workaround while let Ok ( Some ( ( state , _path ) ) ) = timeout ( timeout_value , stream . next ( ) ) . await { let state = ConnectionState :: from ( state . state ) ; if ( state == expected_state ) ^ negate { return Ok ( state ) ; } } let state : ConnectionState = p . state ( ) . await ? . into ( ) ; Ok ( state ) }
The returned future resolves when either the timeout expired or state of the
active** connection (eg /org/freedesktop/NetworkManager/ActiveConnection/12) is the expected state
or changes into the expected state.
The returned future resolves when either the timeout expired or state of the active ** connection ( eg / org / freedesktop / NetworkManager / ActiveConnection / 12 ) is the expected state or changes into the expected state .
&self
expected_state
ConnectionState
path
dbus::Path<'_>
timeout_value
std::time::Duration
negate
bool
&self
expected_state
ConnectionState
path
dbus::Path<'_>
timeout_value
std::time::Duration
negate
bool