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/main.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 examples/unbound/main.rs (limited to 'examples/unbound/main.rs') diff --git a/examples/unbound/main.rs b/examples/unbound/main.rs new file mode 100644 index 0000000..3a937c3 --- /dev/null +++ b/examples/unbound/main.rs @@ -0,0 +1,26 @@ +#![deny(clippy::all)] +#![deny(clippy::pedantic)] +#![allow(clippy::module_name_repetitions)] + +mod animals; +mod bootstrap; +mod interfaces; + +use bootstrap::bootstrap; +use interfaces::dog::IDog; +use interfaces::human::IHuman; + +fn main() +{ + println!("Hello, world!"); + + let di_container = bootstrap(); + + let dog = di_container.get_singleton::().unwrap(); + + dog.woof(); + + let human = di_container.get::().unwrap(); + + human.make_pets_make_sounds(); +} -- cgit v1.2.3-18-g5258