pub async fn signaled(self) -> Result<(), Aborted> {
        let Self {
            mut interrupt,
            mut terminate,
            mut tx,
        } = self;

        tokio::select! {
            _ = interrupt.recv() => {
                debug!("Received SIGINT; draining");
            },

            _ = terminate.recv() => {
                debug!("Received SIGTERM; draining");
            }

            _ = tx.closed() => {
                debug!("All shutdown receivers dropped");
                // Drain can't do anything if the receivers have been dropped
                return Ok(());
            }
        }

        tokio::select! {
            _ = tx.drain() => {
                debug!("Drained");
                Ok(())
            },

            _ = interrupt.recv() => {
                debug!("Received SIGINT; aborting");
                Err(Aborted(()))
            },

            _ = terminate.recv() => {
                debug!("Received SIGTERM; aborting");
                Err(Aborted(()))
            }
        }
    }
/// Watches for signals and drives shutdown
///
/// When a `SIGINT` or `SIGTERM` signal is received, the shutdown is initiated, notifying all
/// [`Watch`] instances. When all watches are dropped, the shutdown is completed.
///
/// If a second signal is received while waiting for watches to be dropped, this future
/// completes immediately with an [`Aborted`] error.


If a second signal is received while waiting for watches to be dropped, this future
completes immediately with an [`Aborted`] error.
If a second signal is received while waiting for watches to be dropped this future completes immediately with an [ ` Aborted ` ] error .
pub async fn signaled(self) -> Result<(), Aborted> {
        let Self {
            mut interrupt,
            mut terminate,
            mut tx,
        } = self;
        tokio::select! {
            _ = interrupt.recv() => {
                debug!("Received SIGINT; draining");
            },
            _ = terminate.recv() => {
                debug!("Received SIGTERM; draining");
            }
            _ = tx.closed() => {
                debug!("All shutdown receivers dropped");
                // Drain can't do anything if the receivers have been dropped
                return Ok(());
            }
        }
        tokio::select! {
            _ = tx.drain() => {
                debug!("Drained");
                Ok(())
            },
            _ = interrupt.recv() => {
                debug!("Received SIGINT; aborting");
                Err(Aborted(()))
            },
            _ = terminate.recv() => {
                debug!("Received SIGTERM; aborting");
                Err(Aborted(()))
            }
        }
    }
pub async fn signaled ( self ) -> Result < ( ) , Aborted > { let Self { mut interrupt , mut terminate , mut tx , } = self ; tokio :: select ! { interrupt recv ( ) { debug ( " " ) } terminate recv ( ) { debug ( " " ) } tx closed ( ) { debug ( " " ) // Drain can't do anything if the receivers have been dropped return Ok ( ( ) ) } } tokio :: select ! { tx drain ( ) { debug ( " " ) Ok ( ( ) ) } interrupt recv ( ) { debug ( " " ) Err ( Aborted ( ( ) ) ) } terminate recv ( ) { debug ( " " ) Err ( Aborted ( ( ) ) ) } } }
Watches for signals and drives shutdown
When a `SIGINT` or `SIGTERM` signal is received, the shutdown is initiated, notifying all
[`Watch`] instances.
Watches for signals and drives shutdown When a ` SIGINT ` or ` SIGTERM ` signal is received the shutdown is initiated notifying all [ ` Watch ` ] instances .
self
self