pub type AsyncServiceFactory = Arc<dyn Fn(Arc<ServiceProvider>) -> Pin<Box<dyn Future<Output = Arc<dyn Any + Send + Sync>> + Send>> + Send + Sync>;Expand description
Async variant of ServiceFactory — for services that require async
initialization (e.g., database connections, remote config loading).
Used with ServiceCollection::build_async.
The factory receives an Arc<ServiceProvider> (instead of &dyn IServiceResolver)
because async closures cannot borrow from the caller’s stack frame.
Aliased Type§
pub struct AsyncServiceFactory { /* private fields */ }