[−][src]Macro coi::container
A macro to simplify building of Container
s.
It takes a list of key-value pairs, where the keys are converted to string keys, and the values are converted into registrations. Normal, singleton and scoped registrations are possible, with normal being the default:
use coi::{container, Inject}; trait Dep: Inject {} #[derive(Inject)] #[provides(dyn Dep with Impl)] struct Impl; impl Dep for Impl {} let mut container = container! { dep => ImplProvider, normal_dep => ImplProvider.normal, singleton_dep => ImplProvider.singleton, scoped_dep => ImplProvider.scoped };
For details on how each registration works, see coi::Registration