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

            handler.handle_connection_checkout_started_event(event);
        });

        let result = self.acquire_or_create_connection();

        let mut conn = match result {
            Ok(conn) => conn,
            Err(e) => {
                if let ErrorKind::WaitQueueTimeoutError { .. } = e.kind.as_ref() {
                    self.emit_event(|handler| {
                        handler.handle_connection_checkout_failed_event(
                            ConnectionCheckoutFailedEvent {
                                address: self.inner.address.clone(),
                                reason: ConnectionCheckoutFailedReason::Timeout,
                            },
                        )
                    });
                }

                return Err(e);
            }
        };

        self.emit_event(|handler| {
            handler.handle_connection_checked_out_event(conn.checked_out_event());
        });

        conn.mark_checked_out(Arc::downgrade(&self.inner));

        Ok(conn)
    }
/// Checks out a connection from the pool. This method will block 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. If the method
/// blocks for longer than `wait_queue_timeout`, a `WaitQueueTimeoutError` will be returned.
Checks out a connection from the pool. This method will block 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. If the method
blocks for longer than `wait_queue_timeout`, a `WaitQueueTimeoutError` will be returned.
Checks out a connection from the pool . This method will block 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 . If the method blocks for longer than ` wait_queue_timeout ` a ` WaitQueueTimeoutError ` will be returned .
pub(crate) fn check_out(&self) -> Result<Connection> {
        self.emit_event(|handler| {
            let event = ConnectionCheckoutStartedEvent {
                address: self.inner.address.clone(),
            };
            handler.handle_connection_checkout_started_event(event);
        });
        let result = self.acquire_or_create_connection();
        let mut conn = match result {
            Ok(conn) => conn,
            Err(e) => {
                if let ErrorKind::WaitQueueTimeoutError { .. } = e.kind.as_ref() {
                    self.emit_event(|handler| {
                        handler.handle_connection_checkout_failed_event(
                            ConnectionCheckoutFailedEvent {
                                address: self.inner.address.clone(),
                                reason: ConnectionCheckoutFailedReason::Timeout,
                            },
                        )
                    });
                }
                return Err(e);
            }
        };
        self.emit_event(|handler| {
            handler.handle_connection_checked_out_event(conn.checked_out_event());
        });
        conn.mark_checked_out(Arc::downgrade(&self.inner));
        Ok(conn)
    }
pub ( crate ) fn check_out ( & self ) -> Result < Connection > { self . emit_event ( | handler | { let event = ConnectionCheckoutStartedEvent { address : self . inner . address . clone ( ) , } ; handler . handle_connection_checkout_started_event ( event ) ; } ) ; let result = self . acquire_or_create_connection ( ) ; let mut conn = match result { Ok ( conn ) => conn , Err ( e ) => { if let ErrorKind :: WaitQueueTimeoutError { .. } = e . kind . as_ref ( ) { self . emit_event ( | handler | { handler . handle_connection_checkout_failed_event ( ConnectionCheckoutFailedEvent { address : self . inner . address . clone ( ) , reason : ConnectionCheckoutFailedReason :: Timeout , } , ) } ) ; } return Err ( e ) ; } } ; self . emit_event ( | handler | { handler . handle_connection_checked_out_event ( conn . checked_out_event ( ) ) ; } ) ; conn . mark_checked_out ( Arc :: downgrade ( & self . inner ) ) ; Ok ( conn ) }
Checks out a connection from the pool.
Checks out a connection from the pool .
&self
&self