Skip to main content

Exchange

Trait Exchange 

Source
pub trait Exchange<M: Manage>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn park(&self, conn: M::Connection, meta: SlotMeta) -> Parked<M>;
    fn unpark(&self) -> impl Future<Output = Unparked<M>>;
    fn parked(&self) -> u64;

    // Provided method
    fn clear(&self) { ... }
}
Expand description

Strategy for moving idle connections between per-thread shards.

Required Methods§

Source

fn park(&self, conn: M::Connection, meta: SlotMeta) -> Parked<M>

Offers an idle connection to other threads. Must not block.

Source

fn unpark(&self) -> impl Future<Output = Unparked<M>>

Tries to claim a connection parked by another thread and reattach it to this one.

Source

fn parked(&self) -> u64

Connections currently parked and claimable.

Provided Methods§

Source

fn clear(&self)

Drops every parked connection. Called by Pool::close.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§