Skip to main content

attach_shared_adapter

Function attach_shared_adapter 

Source
pub async fn attach_shared_adapter<F, Fut>(
    pool: &Arc<ResourcePool>,
    adapter_name: &str,
    phase: &str,
    key: ResourceKey,
    factory: F,
) -> Result<(Arc<dyn DriverAdapter>, AttachGuard), String>
where F: FnOnce() -> Fut + Send + 'static, Fut: Future<Output = Result<Arc<dyn DriverAdapter>, String>> + Send + 'static,
Expand description

Push B high-level helper: attach a shareable adapter through the pool under Shared policy. The first phase whose params produce key triggers factory; every subsequent matching phase reuses the same Arc<dyn DriverAdapter>. Each call returns a fresh guard; the pool’s refcount drops the entry only when every guard is released.