pub(crate) async fn check_out(&self) -> Result<Connection> {
        self.emit_event(|handler| {
            let event = ConnectionCheckoutStartedEvent {
                address: self.address.clone(),
            };

            handler.handle_connection_checkout_started_event(event);
        });

        let response = self.connection_requester.request().await;

        let conn = match response {
            ConnectionRequestResult::Pooled(c) => Ok(c),
            ConnectionRequestResult::Establishing(task) => task.await,
            ConnectionRequestResult::PoolCleared(e) => {
                Err(Error::pool_cleared_error(&self.address, &e))
            }
        };

        match conn {
            Ok(ref conn) => {
                self.emit_event(|handler| {
                    handler.handle_connection_checked_out_event(conn.checked_out_event());
                });
            }
            Err(_) => {
                self.emit_event(|handler| {
                    handler.handle_connection_checkout_failed_event(ConnectionCheckoutFailedEvent {
                        address: self.address.clone(),
                        reason: ConnectionCheckoutFailedReason::ConnectionError,
                    })
                });
            }
        }

        conn
    }
/// Checks out a connection from the pool. This method will yield until this thread is at the
/// front of the wait queue, and then will block again if no available connections are in the
/// pool and the total number of connections is not less than the max pool size.
Checks out a connection from the pool. This method will yield until this thread is at the
front of the wait queue, and then will block again if no available connections are in the
pool and the total number of connections is not less than the max pool size.
Checks out a connection from the pool . This method will yield until this thread is at the front of the wait queue and then will block again if no available connections are in the pool and the total number of connections is not less than the max pool size .
pub(crate) async fn check_out(&self) -> Result<Connection> {
        self.emit_event(|handler| {
            let event = ConnectionCheckoutStartedEvent {
                address: self.address.clone(),
            };
            handler.handle_connection_checkout_started_event(event);
        });
        let response = self.connection_requester.request().await;
        let conn = match response {
            ConnectionRequestResult::Pooled(c) => Ok(c),
            ConnectionRequestResult::Establishing(task) => task.await,
            ConnectionRequestResult::PoolCleared(e) => {
                Err(Error::pool_cleared_error(&self.address, &e))
            }
        };
        match conn {
            Ok(ref conn) => {
                self.emit_event(|handler| {
                    handler.handle_connection_checked_out_event(conn.checked_out_event());
                });
            }
            Err(_) => {
                self.emit_event(|handler| {
                    handler.handle_connection_checkout_failed_event(ConnectionCheckoutFailedEvent {
                        address: self.address.clone(),
                        reason: ConnectionCheckoutFailedReason::ConnectionError,
                    })
                });
            }
        }
        conn
    }
pub ( crate ) async fn check_out ( & self ) -> Result < Connection > { self . emit_event ( | handler | { let event = ConnectionCheckoutStartedEvent { address : self . address . clone ( ) , } ; handler . handle_connection_checkout_started_event ( event ) ; } ) ; let response = self . connection_requester . request ( ) . await ; let conn = match response { ConnectionRequestResult :: Pooled ( c ) => Ok ( c ) , ConnectionRequestResult :: Establishing ( task ) => task . await , ConnectionRequestResult :: PoolCleared ( e ) => { Err ( Error :: pool_cleared_error ( & self . address , & e ) ) } } ; match conn { Ok ( ref conn ) => { self . emit_event ( | handler | { handler . handle_connection_checked_out_event ( conn . checked_out_event ( ) ) ; } ) ; } Err ( _ ) => { self . emit_event ( | handler | { handler . handle_connection_checkout_failed_event ( ConnectionCheckoutFailedEvent { address : self . address . clone ( ) , reason : ConnectionCheckoutFailedReason :: ConnectionError , } ) } ) ; } } conn }
Checks out a connection from the pool.
Checks out a connection from the pool .
&self
&self