pub struct ConnectionPool { /* private fields */ }Expand description
A synchronous, r2d2-style pool of blocking Connections.
Cloneable handles share one underlying pool. Connections are opened lazily,
validated on checkout per the configured SyncRecycleStrategy, and
returned to the pool when the SyncPooledConnection guard drops. The hot
path uses only std synchronization primitives — no Tokio.
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub fn get(&self) -> Result<SyncPooledConnection>
pub fn get(&self) -> Result<SyncPooledConnection>
Acquires a connection, blocking up to the configured
wait_timeout for a slot.
§Errors
Returns Error::Timeout if no slot becomes available within
wait_timeout, or the underlying connection error if opening a new
connection fails.
Sourcepub fn get_timeout(
&self,
timeout: Option<Duration>,
) -> Result<SyncPooledConnection>
pub fn get_timeout( &self, timeout: Option<Duration>, ) -> Result<SyncPooledConnection>
Sourcepub fn status(&self) -> PoolStatus
pub fn status(&self) -> PoolStatus
Trait Implementations§
Source§impl Clone for ConnectionPool
impl Clone for ConnectionPool
Source§fn clone(&self) -> ConnectionPool
fn clone(&self) -> ConnectionPool
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 !RefUnwindSafe for ConnectionPool
impl !UnwindSafe for ConnectionPool
impl Freeze for ConnectionPool
impl Send for ConnectionPool
impl Sync for ConnectionPool
impl Unpin for ConnectionPool
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request