Struct portaldi_core::container::DIContainer
source · pub struct DIContainer { /* private fields */ }Expand description
DI container holds component refs.
Implementations§
source§impl DIContainer
impl DIContainer
sourcepub fn new() -> DIContainer
pub fn new() -> DIContainer
Create new instance.
sourcepub fn get_or_init<T, F>(&self, init: F) -> DI<T>where
T: DITarget,
F: Fn() -> T,
pub fn get_or_init<T, F>(&self, init: F) -> DI<T>where
T: DITarget,
F: Fn() -> T,
Get a component by type with a initialization. If a target component does not exists, create and put into the container.