pub struct ConnectionPool { /* private fields */ }Expand description
Connection pool for reusing TCP connections
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub fn with_config(config: PoolConfig) -> Self
pub fn with_config(config: PoolConfig) -> Self
Create a new connection pool with custom configuration
Sourcepub async fn get_connection(&self, host: &str, port: u16) -> Result<TcpStream>
pub async fn get_connection(&self, host: &str, port: u16) -> Result<TcpStream>
Get a connection from the pool or create a new one
Sourcepub async fn return_connection(&self, host: &str, port: u16, stream: TcpStream)
pub async fn return_connection(&self, host: &str, port: u16, stream: TcpStream)
Return a connection to the pool for reuse
Sourcepub async fn cleanup_expired(&self)
pub async fn cleanup_expired(&self)
Clean up expired connections
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConnectionPool
impl !RefUnwindSafe for ConnectionPool
impl Send for ConnectionPool
impl Sync for ConnectionPool
impl Unpin for ConnectionPool
impl !UnwindSafe for ConnectionPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more