[−][src]Function scoped_callback::scope_async
pub async fn scope_async<'env, R>(
f: impl for<'r> FnOnce(&'r Scope<'env>) -> BoxFuture<'r, R>
) -> R
Same as scope but also allow async
borrows.
The Scope
instance passed to f
can not outlive the call of this function.
However, for async functions, this would be useless as the function returns a Future
that is yet to complete, and may contain references to the given Scope
.
In order to remedy this, scope_async
explicitly makes sure Scope
lives throughout
the lifetime of the future returned by f
.