blob: f7b66ad536a49ce7954529a6d2ac14b88224d895 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
use anyhow::Result;
use syrette::DIContainer;
use crate::interfaces::ninja::INinja;
use crate::interfaces::weapon::IWeapon;
use crate::katana::Katana;
use crate::ninja::Ninja;
use crate::shuriken::Shuriken;
pub fn bootstrap() -> Result<DIContainer>
{
let mut di_container = DIContainer::new();
di_container
.bind::<dyn IWeapon>()
.to::<Katana>()?
.in_transient_scope()
.when_named("strong")?;
di_container
.bind::<dyn IWeapon>()
.to::<Shuriken>()?
.in_transient_scope()
.when_named("weak")?;
di_container.bind::<dyn INinja>().to::<Ninja>()?;
Ok(di_container)
}
|