[−][src]Struct kamikaze_di::Container
Dependency container. Can be used with Resolver or Injector.
See Injector and Resolver on how to use. Use the ContainerBuilder to set up containers.
Methods
impl Container
[src]
pub fn new() -> Container
[src]
Creates an empty container.
Even though it will be empty, it will still resolve dependencies via the Injector trait.
Examples
use kamikaze_di::{Container, Inject, Injector, Result}; #[derive(Clone)] struct X { inner: usize, }; impl Inject for X { fn resolve(container: &Container) -> Result<X> { Ok(X { inner: 42 }) } } let container: Container = Container::new(); let x: X = container.inject()?; assert_eq!(42, x.inner);
Trait Implementations
impl<T> Injector<T> for Container where
T: Clone + 'static,
[src]
T: Clone + 'static,
impl<T> Injector<T> for Container where
T: Inject + Clone + 'static,
[src]
T: Inject + Clone + 'static,
impl<T> Injector<Rc<T>> for Container where
T: InjectAsRc + 'static,
[src]
T: InjectAsRc + 'static,
impl Resolver for Container
[src]
impl Default for Container
[src]
impl Debug for Container
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,