Skip to main content

PoolExtension

Trait PoolExtension 

Source
pub trait PoolExtension:
    Any
    + Send
    + Sync {
    // Required methods
    fn close(&self);
    fn as_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync> ⓘ;
}
Expand description

Session-lived state an adapter keeps in the pool (ResourcePool::extension).

Required Methods§

Source

fn close(&self)

The session is ending. Release what the extension holds: stop threads, close files. Called once, off the async workers, so it may block. Other holders of the extension may outlive this call, which is why it is a call and not a drop.

Source

fn as_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync> ⓘ

The extension as Any, for the pool to hand it back typed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§