Skip to main content

ClientManager

Trait ClientManager 

Source
pub trait ClientManager:
    Send
    + Sync
    + 'static {
    type Client: Send + 'static;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn create<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Client, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn recycle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        client: &'life1 mut Self::Client,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Creates and validates one protocol-specific outbound client.

These futures may be dropped before completion. The manager owns cleanup of partially created protocol resources; the pool returns its reservation.

Required Associated Types§

Source

type Client: Send + 'static

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn create<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Client, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Establish a fresh client. Called only after capacity is reserved.

Source

fn recycle<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 mut Self::Client, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Prove that an idle client may be handed out again.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§