pub struct RpcPool { /* private fields */ }Expand description
A minimal connection pool.
Implementations§
Source§impl RpcPool
impl RpcPool
Sourcepub fn new(config: RpcPoolConfig) -> Self
pub fn new(config: RpcPoolConfig) -> Self
Build a new pool. Does NOT open any connections eagerly; the
first acquire() call dials the first connection.
Sourcepub async fn acquire(&self) -> Result<PooledClient, RpcClientError>
pub async fn acquire(&self) -> Result<PooledClient, RpcClientError>
Acquire a client from the pool. Blocks (asynchronously) when
the pool is at capacity until a slot frees. The returned
PooledClient returns the client to the pool on Drop.
Sourcepub fn idle_count(&self) -> usize
pub fn idle_count(&self) -> usize
Number of idle clients currently sitting in the pool. Useful for diagnostics and testing — production code should not branch on this.
Auto Trait Implementations§
impl Freeze for RpcPool
impl !RefUnwindSafe for RpcPool
impl Send for RpcPool
impl Sync for RpcPool
impl Unpin for RpcPool
impl UnsafeUnpin for RpcPool
impl !UnwindSafe for RpcPool
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> 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