hyperdriver::client::pool

Trait PoolableConnection

Source
pub trait PoolableConnection:
    Unpin
    + Send
    + Sized
    + 'static {
    // Required methods
    fn is_open(&self) -> bool;
    fn can_share(&self) -> bool;
    fn reuse(&mut self) -> Option<Self>;
}
Available on crate feature client only.
Expand description

A crate::client::conn::Connection that can be pooled.

These connections must report to the pool whether they remain open, and whether they can be shared / multiplexed.

The pool will call PoolableConnection::reuse to get a new connection to return to the pool, which will multiplex against this one. If multiplexing is not possible, then None should be returned.

Required Methods§

Source

fn is_open(&self) -> bool

Returns true if the connection is open.

Source

fn can_share(&self) -> bool

Returns true if the connection can be shared / multiplexed.

If this returns true, then PoolableConnection::reuse will be called to get a new connection to return to the pool.

Source

fn reuse(&mut self) -> Option<Self>

Returns a new connection to return to the pool, which will multiplex against this one if possible.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl PoolableConnection for MockSender

Available on crate feature mocks only.
Source§

impl<B> PoolableConnection for HttpConnection<B>
where B: Send + 'static,