Skip to main content

attach

Function attach 

Source
pub async fn attach(
    pool: &Arc<ResourcePool>,
    key: ResourceKey,
    policy: ResourceSharePolicy,
    phase: impl Into<String>,
    factory: ResourceFactory<'_>,
) -> Result<AttachGuard, String>
Expand description

Public attach call. Builds (or reuses) the entry for key under policy, lazily realises the resource via factory if this is the first attach, emits resource.attach, and returns a guard that detaches on drop.

phase is a free-form label that lands on the resource.attach / resource.detach event lines so operators can correlate lifecycle events with the per-phase activation that drove them.