Skip to main content

scope

Function scope 

Source
pub fn scope<'a, T, Fut>(fut: Fut) -> ScopedPoolFuture<'a, T>
where Fut: Future<Output = PgResult<T>> + Send + 'a,
Expand description

Helper to box async closures for scoped pool helpers.

This avoids writing Box::pin(...) directly at every callsite.

§Example

use qail_pg::scope;

let users = pool
    .with_tenant(tenant_id, |conn| scope(async move {
        conn.fetch_all_uncached(&cmd).await
    }))
    .await?;