aboutsummaryrefslogtreecommitdiff
path: root/examples/basic/bootstrap.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-07-27 19:10:30 +0200
committerHampusM <hampus@hampusmat.com>2022-07-31 12:17:51 +0200
commitf75a7d58135825c4f9094c1e10f36de4a952f455 (patch)
treebd8bae08591b7355407ee44002e0494bdd8d2268 /examples/basic/bootstrap.rs
parent3388f857b32cf1893d7b54582c8fd16e4965550b (diff)
feat: add injecting singletons into constructors
Diffstat (limited to 'examples/basic/bootstrap.rs')
-rw-r--r--examples/basic/bootstrap.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/basic/bootstrap.rs b/examples/basic/bootstrap.rs
index 71ef713..10a7041 100644
--- a/examples/basic/bootstrap.rs
+++ b/examples/basic/bootstrap.rs
@@ -14,7 +14,10 @@ pub fn bootstrap() -> DIContainer
{
let mut di_container: DIContainer = DIContainer::new();
- di_container.bind::<dyn IDog>().to::<Dog>();
+ di_container
+ .bind::<dyn IDog>()
+ .to_singleton::<Dog>()
+ .unwrap();
di_container.bind::<dyn ICat>().to::<Cat>();
di_container.bind::<dyn IHuman>().to::<Human>();