Skip to main content

PooledConn

Struct PooledConn 

Source
pub struct PooledConn { /* private fields */ }
Expand description

RAII guard from Pool::acquire. Derefs to the Client, and returns the connection to the pool on drop so the next checkout reuses it — unless the connection was poisoned, in which case it is dropped and the next checkout connects fresh (CLT-014/030).

Implementations§

Source§

impl PooledConn

Source

pub fn client(&self) -> &Client

Borrow the checked-out client. (Also available via [Deref].)

Methods from Deref<Target = Client>§

Source

pub async fn call( &self, command: impl Into<String>, args: Vec<Value>, ) -> Result<Value, ClientError>

Issue one call with the client’s default timeout (CLT-020).

Concurrent callers multiplex over the one connection; completion order follows the server, not submission order (CLT-010).

Source

pub async fn call_with_timeout( &self, command: &str, args: Vec<Value>, timeout: Duration, ) -> Result<Value, ClientError>

Issue one call with a per-call timeout override (CLT-020).

Source

pub fn on_push<F>(&self, handler: F)
where F: Fn(Value) + Send + Sync + 'static,

Register the push hook (CLT-060). Frames with id == PUSH_ID are routed here under PushPolicy::Enabled and never matched against pending calls. The handler runs on the reader task.

Source

pub async fn close(&self)

Explicit, idempotent close (CLT-004): fails all in-flight calls with a typed connection-closed error and shuts the socket down.

Source

pub fn is_authenticated(&self) -> bool

true once the current connection’s handshake authenticated (CLT-003 — auth is sticky per connection).

Source

pub fn is_alive(&self) -> bool

true while the current connection is live — not poisoned (CLT-014) and not closed (CLT-004). The optional pool (CLT-080) uses this to drop a dead connection instead of handing it back; ordinary callers rely on typed call errors and lazy reconnect (CLT-030) rather than polling this.

Source

pub fn capabilities(&self) -> Vec<String>

Capabilities the server advertised in the HELLO reply.

Source

pub fn handshake_info(&self) -> HandshakeInfo

Snapshot of what the handshake learned (CLT-002).

Source

pub fn unknown_response_drops(&self) -> u64

How many responses matched no pending call and were dropped (CLT-013 — client stats, never fatal).

Source

pub fn config(&self) -> &Config

The application’s protocol config this client drives its behavior from (SPEC-002).

Trait Implementations§

Source§

impl Deref for PooledConn

Source§

type Target = Client

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Client

Dereferences the value.
Source§

impl Drop for PooledConn

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.