aboutsummaryrefslogtreecommitdiff
path: root/examples/unbound/bootstrap.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-08-20 18:06:42 +0200
committerHampusM <hampus@hampusmat.com>2022-08-21 18:17:51 +0200
commit55f5e8ca096467be2db895b459760ec34b63fce6 (patch)
treebb34d7f74d5ee7e423e57dbdfd9865d0115b0ff9 /examples/unbound/bootstrap.rs
parent12acab96a7d9ba8032378f8be7b6932f4406a849 (diff)
docs: add example for displaying a unbound interface error
Diffstat (limited to 'examples/unbound/bootstrap.rs')
-rw-r--r--examples/unbound/bootstrap.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/unbound/bootstrap.rs b/examples/unbound/bootstrap.rs
new file mode 100644
index 0000000..7835619
--- /dev/null
+++ b/examples/unbound/bootstrap.rs
@@ -0,0 +1,23 @@
+use syrette::DIContainer;
+
+// Concrete implementations
+use crate::animals::dog::Dog;
+use crate::animals::human::Human;
+//
+// Interfaces
+use crate::interfaces::dog::IDog;
+use crate::interfaces::human::IHuman;
+
+pub fn bootstrap() -> DIContainer
+{
+ let mut di_container: DIContainer = DIContainer::new();
+
+ di_container
+ .bind::<dyn IDog>()
+ .to_singleton::<Dog>()
+ .unwrap();
+
+ di_container.bind::<dyn IHuman>().to::<Human>().unwrap();
+
+ di_container
+}