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 put_if_absent<T: DITarget>(&self, c: &DI<T>) -> DI<T>
pub fn put_if_absent<T: DITarget>(&self, c: &DI<T>) -> DI<T>
Put a component into the container.
Sourcepub fn get_or_init<T, F>(&self, init: F) -> DI<T>
pub fn get_or_init<T, F>(&self, init: F) -> DI<T>
Get a component by type with a initialization. If a target component does not exists, create and put into the container.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DIContainer
impl RefUnwindSafe for DIContainer
impl Send for DIContainer
impl Sync for DIContainer
impl Unpin for DIContainer
impl UnwindSafe for DIContainer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more