Struct springtime_di::factory::ComponentFactory
source · pub struct ComponentFactory { /* private fields */ }Expand description
Generic factory for Component instances. Uses definitions from the ComponentDefinitionRegistry and scopes to create and store instances for reuse.
Implementations§
source§impl ComponentFactory
impl ComponentFactory
sourcepub fn new(
definition_registry: ComponentDefinitionRegistryPtr,
scope_factories: FxHashMap<String, ScopeFactoryPtr>
) -> Self
pub fn new( definition_registry: ComponentDefinitionRegistryPtr, scope_factories: FxHashMap<String, ScopeFactoryPtr> ) -> Self
Creates a new factory with given registry and scope factories. The factory map should include built-in SINGLETON and PROTOTYPE for maximum compatibility with components, since they are usually the most popular. This is not a hard requirement, but care needs to be taken to ensue no component uses them.