pub async fn await_teardown(&self) -> Result<(), Error> {
        let mut watches: Vec<_>;
        {
            let l = self.sessions.lock().unwrap();
            watches = l
                .sessions
                .iter()
                .filter_map(|s| s.teardown_rx.clone())
                .collect();
        }

        let mut overall_result = Ok(());
        for w in &mut watches {
            let mut r = (*w.borrow_and_update()).clone();

            if r.is_none() {
                // An attempt hasn't finished yet. Wait for it.
                w.changed()
                    .await
                    .expect("teardown Sender shouldn't be dropped");
                r = (*w.borrow()).clone();
            }

            // Now an attempt has finished, success or failure.
            let r = r.expect("teardown result should be populated after change");
            overall_result = overall_result.and(r);
        }
        overall_result
    }
/// Waits for a reasonable attempt at `TEARDOWN` on all stale sessions that
/// exist as of when this method is called, returning an error if any fail.
///
/// This has no timeout other than the sessions' expiration times. The
/// caller can wrap the call in `tokio::time::timeout` for an earlier time.
///
/// Currently on `Session::drop`, a `TEARDOWN` loop is started in the
/// background. This method waits for an attempt on an existing connection
/// (if any) and the first attempt on a fresh connection.
///
/// Ignores the discovered sessions, as it's impossible to send a `TEARDOWN`
/// without knowing the session id. If desired, the caller can learn of the
/// existence of the sessions through [`SessionGroup::stale_sessions`] and
/// sleep until they expire.
Waits for a reasonable attempt at `TEARDOWN` on all stale sessions that
exist as of when this method is called, returning an error if any fail.

This has no timeout other than the sessions' expiration times. The
caller can wrap the call in `tokio::time::timeout` for an earlier time.

Currently on `Session::drop`, a `TEARDOWN` loop is started in the
background. This method waits for an attempt on an existing connection
(if any) and the first attempt on a fresh connection.

Ignores the discovered sessions, as it's impossible to send a `TEARDOWN`
without knowing the session id. If desired, the caller can learn of the
existence of the sessions through [`SessionGroup::stale_sessions`] and
sleep until they expire.
Waits for a reasonable attempt at ` TEARDOWN ` on all stale sessions that exist as of when this method is called returning an error if any fail . This has no timeout other than the sessions ' expiration times . The caller can wrap the call in ` tokio :: time :: timeout ` for an earlier time . Currently on ` Session :: drop ` a ` TEARDOWN ` loop is started in the background . This method waits for an attempt on an existing connection ( if any ) and the first attempt on a fresh connection . Ignores the discovered sessions as it ' s impossible to send a ` TEARDOWN ` without knowing the session id . If desired the caller can learn of the existence of the sessions through [ ` SessionGroup :: stale_sessions ` ] and sleep until they expire .
pub async fn await_teardown(&self) -> Result<(), Error> {
        let mut watches: Vec<_>;
        {
            let l = self.sessions.lock().unwrap();
            watches = l
                .sessions
                .iter()
                .filter_map(|s| s.teardown_rx.clone())
                .collect();
        }
        let mut overall_result = Ok(());
        for w in &mut watches {
            let mut r = (*w.borrow_and_update()).clone();
            if r.is_none() {
                // An attempt hasn't finished yet. Wait for it.
                w.changed()
                    .await
                    .expect("teardown Sender shouldn't be dropped");
                r = (*w.borrow()).clone();
            }
            // Now an attempt has finished, success or failure.
            let r = r.expect("teardown result should be populated after change");
            overall_result = overall_result.and(r);
        }
        overall_result
    }
pub async fn await_teardown ( & self ) -> Result < ( ) , Error > { let mut watches : Vec < _ > ; { let l = self . sessions . lock ( ) . unwrap ( ) ; watches = l . sessions . iter ( ) . filter_map ( | s | s . teardown_rx . clone ( ) ) . collect ( ) ; } let mut overall_result = Ok ( ( ) ) ; for w in & mut watches { let mut r = ( * w . borrow_and_update ( ) ) . clone ( ) ; if r . is_none ( ) { // An attempt hasn't finished yet. Wait for it. w . changed ( ) . await . expect ( " " ) ; r = ( * w . borrow ( ) ) . clone ( ) ; } // Now an attempt has finished, success or failure. let r = r . expect ( " " ) ; overall_result = overall_result . and ( r ) ; } overall_result }
Waits for a reasonable attempt at `TEARDOWN` on all stale sessions that
exist as of when this method is called, returning an error if any fail.
Waits for a reasonable attempt at ` TEARDOWN ` on all stale sessions that exist as of when this method is called returning an error if any fail .
&self