pub struct ConnectionPool { /* private fields */ }Expand description
Connection pool for managing reusable TCP connections
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub fn with_idle_timeout(timeout: Duration) -> Self
pub fn with_idle_timeout(timeout: Duration) -> Self
Create a new connection pool with custom idle timeout
Sourcepub async fn get_or_create(&self, target_addr: &str) -> Result<TcpStream, Error>
pub async fn get_or_create(&self, target_addr: &str) -> Result<TcpStream, Error>
Get a connection from the pool or create a new one
Sourcepub async fn get(&self, target_addr: &str) -> Option<TcpStream>
pub async fn get(&self, target_addr: &str) -> Option<TcpStream>
Get a connection from the pool if available
Trait Implementations§
Source§impl Debug for ConnectionPool
impl Debug for ConnectionPool
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