[−][src]Macro coi_actix_web::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. Transient, singleton and scoped registrations are possible, with transient 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, transient_dep => ImplProvider.transient, singleton_dep => ImplProvider.singleton, scoped_dep => ImplProvider.scoped };
For details on how each registration works, see coi::Registration