ruice 0.2.0

Runtime based dependency injection for Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::Services;

pub trait Inject<C> {
    fn inject(&self, container: &mut C);
}

pub trait InjectServices: Services {
    fn inject<I>(&mut self, injector: I)
    where
        I: Inject<Self>,
    {
        injector.inject(self);
    }
}

impl<C> InjectServices for C where C: Services {}