pub struct ConnectionPool { /* private fields */ }
Expand description
A connection pool
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
pub fn new(endpoint: Endpoint, alpn: &[u8], options: Options) -> Self
Sourcepub async fn get_or_connect(
&self,
id: NodeId,
) -> Result<ConnectionRef, PoolConnectError>
pub async fn get_or_connect( &self, id: NodeId, ) -> Result<ConnectionRef, PoolConnectError>
Returns either a fresh connection or a reference to an existing one.
This is guaranteed to return after approximately Options::connect_timeout with either an error or a connection.
Sourcepub async fn close(&self, id: NodeId) -> Result<(), ConnectionPoolError>
pub async fn close(&self, id: NodeId) -> Result<(), ConnectionPoolError>
Close an existing connection, if it exists
This will finish pending tasks and close the connection. New tasks will get a new connection if they are submitted after this call
Trait Implementations§
Source§impl Clone for ConnectionPool
impl Clone for ConnectionPool
Source§fn clone(&self) -> ConnectionPool
fn clone(&self) -> ConnectionPool
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto 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