diff options
Diffstat (limited to 'examples/unbound/bootstrap.rs')
-rw-r--r-- | examples/unbound/bootstrap.rs | 23 |
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 +} |