From 55f5e8ca096467be2db895b459760ec34b63fce6 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 20 Aug 2022 18:06:42 +0200 Subject: docs: add example for displaying a unbound interface error --- examples/unbound/bootstrap.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/unbound/bootstrap.rs (limited to 'examples/unbound/bootstrap.rs') 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::() + .to_singleton::() + .unwrap(); + + di_container.bind::().to::().unwrap(); + + di_container +} -- cgit v1.2.3-18-g5258